diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-06-29 23:52:45 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-06-29 23:52:45 +0100 |
commit | 53194543e43f8a645ba83ddb464028ba0c3b9d70 (patch) | |
tree | bee4f045e4e0dba4ca07fef04e2600b2c897c3c1 /Northstar.CustomServers/scripts/vscripts/_powerup.gnut | |
parent | 31c8a052e8f3cdccedb7f6f8d2bd11678189001a (diff) | |
download | NorthstarMods-53194543e43f8a645ba83ddb464028ba0c3b9d70.tar.gz NorthstarMods-53194543e43f8a645ba83ddb464028ba0c3b9d70.zip |
fix lts spawn bugs and some crashes
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 3a0ce273..a6a117af 100644 --- a/Northstar.CustomServers/scripts/vscripts/_powerup.gnut +++ b/Northstar.CustomServers/scripts/vscripts/_powerup.gnut @@ -45,16 +45,16 @@ void function PowerupSpawnerThink( entity spawnpoint, PowerUp powerupDef ) 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.SetOrigin( base.GetOrigin() + powerupDef.modelOffset ) + powerup.SetAngles( base.GetAngles() + powerupDef.modelAngles ) powerup.SetValueForModelKey( powerupDef.model ) DispatchSpawn( powerup ) - powerup.SetLocalOrigin( powerupDef.modelOffset ) - powerup.SetLocalAngles( powerupDef.modelAngles ) + // unless i'm doing something really dumb, this all has to be done after dispatchspawn to get the powerup to not have gravity + powerup.StopPhysics() + powerup.SetOrigin( base.GetOrigin() + powerupDef.modelOffset ) + powerup.SetAngles( base.GetAngles() + powerupDef.modelAngles ) powerup.SetModel( powerupDef.model ) powerup.s.powerupRef <- powerupDef.itemRef @@ -65,9 +65,7 @@ void function PowerupSpawnerThink( entity spawnpoint, PowerUp powerupDef ) OnThreadEnd( function() : ( powerup ) { if ( IsValid( powerup ) ) - { powerup.Destroy() - } }) powerup.WaitSignal( "OnDestroy" ) @@ -86,6 +84,7 @@ bool function OnPowerupCollected( entity player, entity healthpack ) if ( ( powerup.index == ePowerUps.titanTimeReduction || powerup.index == ePowerUps.LTS_TitanTimeReduction ) && PlayerHasBattery( player ) ) return false + // idk why the powerup.destroyFunc doesn't just return a bool? would mean they could just handle stuff like this in powerup code powerup.destroyFunc( player ) return true // destroys the powerup } |