aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Custom/mod/scripts
diff options
context:
space:
mode:
authorx3Karma <juliuslimck@gmail.com>2021-12-30 14:33:01 +0800
committerGitHub <noreply@github.com>2021-12-30 14:33:01 +0800
commit19f0d89e2160d0c152cf127e6bb102d7f872777a (patch)
treeb8b0643c4cb108d7705ef6accf87f10303987ede /Northstar.Custom/mod/scripts
parent269dda4ad2bf2ecf774f6a1f704b338d357811da (diff)
downloadNorthstarMods-19f0d89e2160d0c152cf127e6bb102d7f872777a.tar.gz
NorthstarMods-19f0d89e2160d0c152cf127e6bb102d7f872777a.zip
Prevents setting last survivor again when new player connects
Diffstat (limited to 'Northstar.Custom/mod/scripts')
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut5
1 files changed, 4 insertions, 1 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut
index 2e3f03ad9..a0e0b7431 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut
@@ -2,6 +2,7 @@ global function GamemodeInfection_Init
struct {
bool hasHadFirstInfection = false
+ bool hasHadLastInfection = false
array<entity> playersToNotifyOfInfection
} file
@@ -70,7 +71,7 @@ void function InfectPlayer( entity player )
array<entity> survivors = GetPlayerArrayOfTeam( INFECTION_TEAM_SURVIVOR )
if ( survivors.len() == 0 )
SetWinner( INFECTION_TEAM_INFECTED )
- else if ( survivors.len() == 1 )
+ else if ( survivors.len() == 1 && !file.hasHadLastInfection )
SetLastSurvivor( survivors[ 0 ] )
if ( !file.hasHadFirstInfection )
@@ -176,6 +177,8 @@ void function SetLastSurvivor( entity player )
if ( GameTime_TimeLeftSeconds() > 45 )
SetServerVar( "gameEndTime", Time() + 45.0 )
+
+ file.hasHadLastInfection = true
}
int function TimeoutCheckSurvivors()