From 050e707f4762b976791c0934b88779e038f70ade Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Tue, 25 Jan 2022 18:44:08 +0000 Subject: improve fastball respawn logic --- .../mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Northstar.Custom/mod') diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut index f6c0968cf..628bb4b5d 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut @@ -238,7 +238,8 @@ entity function CreatePanel( vector origin, vector angles ) DispatchSpawn( panel ) panel.SetModel( $"models/communication/terminal_usable_imc_01.mdl" ) - panel.s.onPlayerFinishesUsing_func = FastballOnPanelHacked + panel.s.scriptedPanel <- true + SetControlPanelUseFunc( panel, FastballOnPanelHacked ) Highlight_SetNeutralHighlight( panel, "sp_enemy_pilot" ) @@ -246,14 +247,10 @@ entity function CreatePanel( vector origin, vector angles ) } // control panel code isn't very statically typed, pain -function FastballOnPanelHacked( panel, player, success ) +function FastballOnPanelHacked( panel, player ) { expect entity( panel ) expect entity( player ) - expect bool( success ) - - if ( !success ) - return print( panel + " was hacked by " + player ) PanelFlipsToPlayerTeamAndUsableByEnemies( panel, player ) @@ -262,12 +259,15 @@ function FastballOnPanelHacked( panel, player, success ) foreach ( entity otherPlayer in GetPlayerArray() ) Remote_CallFunction_NonReplay( otherPlayer, "ServerCallback_FastballPanelHacked", panel.GetEncodedEHandle(), panel.s.panelId, player.GetEncodedEHandle() ) + // calculate respawn pos rather than using respawning player's position + vector respawnPos = panel.GetOrigin() + panel.GetForwardVector() * 50.0 + // respawn dead players foreach ( entity deadPlayer in GetPlayerArrayOfTeam( player.GetTeam() ) ) { if ( !IsAlive( deadPlayer ) ) { - deadPlayer.SetOrigin( player.GetOrigin() ) + deadPlayer.SetOrigin( respawnPos ) deadPlayer.RespawnPlayer( null ) Remote_CallFunction_NonReplay( deadPlayer, "ServerCallback_FastballRespawnPlayer" ) } -- cgit v1.2.3