From 66a75f222d7137026315dd74d3378445ab5a2329 Mon Sep 17 00:00:00 2001 From: Coopyy Date: Fri, 11 Feb 2022 17:41:54 -0600 Subject: Sticks & Stones: fix highlight on disconnect part 2 --- .../mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Northstar.Custom/mod/scripts/vscripts/gamemodes') diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut index 7ac728de..812c21ee 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut @@ -27,6 +27,7 @@ void function SNS_Init() AddCallback_OnPlayerKilled( OnPlayerKilled ) AddCallback_OnPlayerRespawned( OnPlayerRespawned ) + AddCallback_OnClientDisconnected(OnPlayerDisconnected) AddCallback_GameStateEnter( eGameState.WinnerDetermined, OnWinnerDetermined ) file.reset_pulse_blade_cooldown_on_pulse_blade_kill = GetCurrentPlaylistVarInt( "sns_reset_pulse_blade_cooldown_on_pulse_blade_kill", 1 ) == 1 @@ -38,6 +39,22 @@ void function SNS_Init() file.melee_kill_value = GetCurrentPlaylistVarInt( "sns_melee_kill_value", 5 ) } +void function OnPlayerDisconnected(entity player) +{ + if (GetWinningPlayer() == player) + thread CheckNewHighlight(player) +} + +void function CheckNewHighlight(entity player) +{ + while (IsValid(player)) //wait till disconnected player not exist + wait 0.25 + + entity winner = GetWinningPlayer() + if (IsValid(winner)) + SetHighlight(winner) +} + void function OnPlayerKilled( entity victim, entity attacker, var damageInfo ) { if ( victim != attacker && victim.IsPlayer() && attacker.IsPlayer() && GetGameState() == eGameState.Playing ) @@ -161,4 +178,4 @@ void function SetHighlight(entity player) { foreach ( entity player in GetPlayerArray() ) Highlight_ClearEnemyHighlight(player) Highlight_SetEnemyHighlight( player, file.score_leader_highlight ) -} \ No newline at end of file +} -- cgit v1.2.3