aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod
diff options
context:
space:
mode:
authorRoyalBlue1 <malte.hoermeyer@web.de>2022-05-12 20:04:17 +0200
committerRoyalBlue1 <malte.hoermeyer@web.de>2022-05-12 20:04:17 +0200
commit6e3f6765f57b3fd5c7e2a990be4eb9dda438c0ef (patch)
tree50c32dc1814150e3f1cf31f064c6e4d6260ea4c7 /Northstar.CustomServers/mod
parent4caa1a38a2d2f4175f825927a7771c345e9b9c8c (diff)
downloadNorthstarMods-6e3f6765f57b3fd5c7e2a990be4eb9dda438c0ef.tar.gz
NorthstarMods-6e3f6765f57b3fd5c7e2a990be4eb9dda438c0ef.zip
Made wait until events more readable
also remove debugging prints
Diffstat (limited to 'Northstar.CustomServers/mod')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut37
1 files changed, 12 insertions, 25 deletions
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<entity> npcs = GetEntArrayByClassWildCard_Expensive("*npc*")
+
+ array<entity> 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()
- }
}
}