From 6e3f6765f57b3fd5c7e2a990be4eb9dda438c0ef Mon Sep 17 00:00:00 2001 From: RoyalBlue1 Date: Thu, 12 May 2022 20:04:17 +0200 Subject: Made wait until events more readable also remove debugging prints --- .../scripts/vscripts/gamemodes/_gamemode_fd.nut | 37 +++++++--------------- 1 file changed, 12 insertions(+), 25 deletions(-) (limited to 'Northstar.CustomServers') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut index 32297379..31983720 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut @@ -1487,49 +1487,36 @@ void function PingMinimap(float x, float y, float duration, float spreadRadius, void function waitUntilLessThanAmountAlive(int amount) { - printt("start wait") + int aliveTitans = file.spawnedNPCs.len() - float lasttime = Time() while(aliveTitans>amount) { WaitFrame() aliveTitans = file.spawnedNPCs.len() if(!IsAlive(fd_harvester.harvester)) break - if (Time() > lasttime + 5) // stop log spam - { - printt("npcs alive ", aliveTitans) - lasttime = Time() - } } } void function waitUntilLessThanAmountAlive_expensive(int amount) { - printt("start wait") - array npcs = GetEntArrayByClassWildCard_Expensive("*npc*") + + array npcs = GetNPCArray() int deduct = 0 - for ( int i = npcs.len() - 1; i >= 0; i-- ) - { - entity npc = npcs[i] - if (IsValid(GetPetTitanOwner( npc ))) - { - print("found player npc titan") + for (entity npc in npcs) + if (IsValid(GetPetTitanOwner( npcs[i] ))) deduct++ - } - } - float lasttime = Time() - int aliveTitans = npcs.len() + int aliveTitans = npcs.len() - deduct while(aliveTitans>amount) { WaitFrame() - aliveTitans = GetEntArrayByClassWildCard_Expensive("*npc*").len() - deduct + npcs = GetNPCArray() + detuct = 0 + foreach(entity npc in npcs) + if (IsValid(GetPetTitanOwner( npcs[i] ))) + deduct++ + aliveTitans = GetNPCArray().len() - deduct if(!IsAlive(fd_harvester.harvester)) break - if (Time() > lasttime + 5) // stop log spam - { - printt("npcs alive ", aliveTitans) - lasttime = Time() - } } } -- cgit v1.2.3