aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-11 22:28:45 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-11 22:28:45 +0000
commit30bc58c9ab1563a1dcbbb671db9ee446dc7df37d (patch)
tree9647ad6b78b055071808e0834e9a7f96858a7810 /Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut
parent8cd6924c1112213442b755866a5b6811efae236c (diff)
downloadNorthstarMods-30bc58c9ab1563a1dcbbb671db9ee446dc7df37d.tar.gz
NorthstarMods-30bc58c9ab1563a1dcbbb671db9ee446dc7df37d.zip
more fixes
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut21
1 files changed, 14 insertions, 7 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut
index 60c4560f..5fb0778c 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut
@@ -33,21 +33,17 @@ void function PowerupSpawnerThink( entity spawnpoint, PowerUp powerupDef )
svGlobal.levelEnt.EndSignal( "CleanUpEntitiesForRoundEnd" )
entity base = CreatePropDynamic( powerupDef.baseModel, spawnpoint.GetOrigin(), spawnpoint.GetAngles(), 2 )
-
- entity powerup
- OnThreadEnd( function() : ( base, powerup )
+ OnThreadEnd( function() : ( base )
{
base.Destroy()
- if ( IsValid( powerup ) )
- powerup.Destroy()
})
-
+
while ( true )
{
if ( !powerupDef.spawnFunc() )
return
- powerup = CreateEntity( "item_powerup" )
+ entity powerup = CreateEntity( "item_powerup" )
powerup.SetOrigin( base.GetOrigin() + powerupDef.modelOffset )
powerup.SetAngles( base.GetAngles() + powerupDef.modelAngles )
@@ -66,11 +62,22 @@ void function PowerupSpawnerThink( entity spawnpoint, PowerUp powerupDef )
PickupGlow glow = CreatePickupGlow( powerup, powerupDef.glowColor.x.tointeger(), powerupDef.glowColor.y.tointeger(), powerupDef.glowColor.z.tointeger() )
glow.glowFX.SetOrigin( spawnpoint.GetOrigin() ) // want the glow to be parented to the powerup, but have the position of the spawnpoint
+ thread TrackPowerupCleanup( powerup )
+
powerup.WaitSignal( "OnDestroy" )
wait powerupDef.respawnDelay
}
}
+void function TrackPowerupCleanup( entity powerup )
+{
+ powerup.EndSignal( "OnDestroy" )
+
+ svGlobal.levelEnt.WaitSignal( "CleanUpEntitiesForRoundEnd" )
+ if ( IsValid( powerup ) )
+ powerup.Destroy()
+}
+
bool function OnPowerupCollected( entity player, entity healthpack )
{
PowerUp powerup = GetPowerUpFromItemRef( expect string( healthpack.s.powerupRef ) )