Skip to content

Commit

Permalink
Revert "improve fastball respawn logic" (#171)
Browse files Browse the repository at this point in the history
This reverts commit 050e707.
  • Loading branch information
GeckoEidechse authored Jan 29, 2022
1 parent e91e9bf commit 0fe2438
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,19 +239,22 @@ entity function CreatePanel( vector origin, vector angles )
DispatchSpawn( panel )

panel.SetModel( $"models/communication/terminal_usable_imc_01.mdl" )
panel.s.scriptedPanel <- true
SetControlPanelUseFunc( panel, FastballOnPanelHacked )
panel.s.onPlayerFinishesUsing_func = FastballOnPanelHacked

Highlight_SetNeutralHighlight( panel, "sp_enemy_pilot" )

return panel
}

// control panel code isn't very statically typed, pain
function FastballOnPanelHacked( panel, player )
function FastballOnPanelHacked( panel, player, success )
{
expect entity( panel )
expect entity( player )
expect bool( success )

if ( !success )
return

print( panel + " was hacked by " + player )
PanelFlipsToPlayerTeamAndUsableByEnemies( panel, player )
Expand All @@ -260,15 +263,12 @@ function FastballOnPanelHacked( panel, player )
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( respawnPos )
deadPlayer.SetOrigin( player.GetOrigin() )
deadPlayer.RespawnPlayer( null )
Remote_CallFunction_NonReplay( deadPlayer, "ServerCallback_FastballRespawnPlayer" )
}
Expand Down

0 comments on commit 0fe2438

Please sign in to comment.