diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-06-23 20:46:07 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-06-23 20:46:07 +0100 |
commit | 3f31a4a37a2acf8df302117c99c060cec5996704 (patch) | |
tree | 52c54da00ee00820f3f44637929f166102fe9fd1 /Northstar.CustomServers/scripts/vscripts/_powerup.gnut | |
parent | 8d4c71f7779120298773c9232dcdaa0fa0063786 (diff) | |
download | NorthstarMods-3f31a4a37a2acf8df302117c99c060cec5996704.tar.gz NorthstarMods-3f31a4a37a2acf8df302117c99c060cec5996704.zip |
fix bug with ejects crashing roundwinningkillreplay
Diffstat (limited to 'Northstar.CustomServers/scripts/vscripts/_powerup.gnut')
-rw-r--r-- | Northstar.CustomServers/scripts/vscripts/_powerup.gnut | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Northstar.CustomServers/scripts/vscripts/_powerup.gnut b/Northstar.CustomServers/scripts/vscripts/_powerup.gnut index a154ddb6..3a0ce273 100644 --- a/Northstar.CustomServers/scripts/vscripts/_powerup.gnut +++ b/Northstar.CustomServers/scripts/vscripts/_powerup.gnut @@ -11,6 +11,7 @@ void function PowerUps_Init() AddSpawnCallbackEditorClass( "script_ref", "script_power_up_other", AddPowerupSpawn ) AddCallback_OnTouchHealthKit( "item_powerup", OnPowerupCollected ) + AddCallback_GameStateEnter( eGameState.Prematch, RespawnPowerups ) } void function AddPowerupSpawn( entity spawnpoint ) @@ -40,22 +41,20 @@ void function PowerupSpawnerThink( entity spawnpoint, PowerUp powerupDef ) while ( true ) { if ( !powerupDef.spawnFunc() ) - { - // unsure if this is the best way of doing it - WaitFrame() - continue - } + return entity powerup = CreateEntity( "item_powerup" ) + // need to do this otherwise the position seems to mess up occasionally + powerup.SetOrigin( base.GetOrigin() ) + powerup.SetAngles( base.GetAngles() ) powerup.SetParent( base ) // parenting ensures that gravity isn't an issue powerup.SetValueForModelKey( powerupDef.model ) DispatchSpawn( powerup ) - // offset from parent's position/angles - powerup.SetOrigin( powerupDef.modelOffset ) - powerup.SetAngles( powerupDef.modelAngles ) + powerup.SetLocalOrigin( powerupDef.modelOffset ) + powerup.SetLocalAngles( powerupDef.modelAngles ) powerup.SetModel( powerupDef.model ) powerup.s.powerupRef <- powerupDef.itemRef |