diff options
author | DBmaoha <56738369+DBmaoha@users.noreply.github.com> | 2023-03-03 05:24:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-02 22:24:33 +0100 |
commit | 85e2c14c5979cf350b488cd42abf9084d4a64bb1 (patch) | |
tree | ba8b6fe1e02dd478a2c5ebf986540016e0a551a4 | |
parent | 2e5e740558719f53cd29c979d9f78c0f9e03dbc1 (diff) | |
download | NorthstarMods-85e2c14c5979cf350b488cd42abf9084d4a64bb1.tar.gz NorthstarMods-85e2c14c5979cf350b488cd42abf9084d4a64bb1.zip |
Clean Team Score After Player Disconnecting in FFA (#589)
* Update _gamemode_ffa.nut
* delete the player struct after disconnecting
* force struct start from 0
* fix compile error
* remove useless structs
* Update _gamemode_ffa.nut
* Update _gamemode_ffa.nut
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ffa.nut | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ffa.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ffa.nut index 27eef177..4bff6038 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ffa.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ffa.nut @@ -6,6 +6,9 @@ void function FFA_Init() ScoreEvent_SetupEarnMeterValuesForMixedModes() AddCallback_OnPlayerKilled( OnPlayerKilled ) + + // modified for northstar + AddCallback_OnClientConnected( OnClientConnected ) } void function OnPlayerKilled( entity victim, entity attacker, var damageInfo ) @@ -16,4 +19,18 @@ void function OnPlayerKilled( entity victim, entity attacker, var damageInfo ) // why isn't this PGS_SCORE? odd game attacker.AddToPlayerGameStat( PGS_ASSAULT_SCORE, 1 ) } +} + +// modified for northstar +void function OnClientConnected( entity player ) +{ + thread FFAPlayerScoreThink( player ) // good to have this! instead of DisconnectCallback this could handle a null player +} + +void function FFAPlayerScoreThink( entity player ) +{ + int team = player.GetTeam() + + player.WaitSignal( "OnDestroy" ) // this can handle disconnecting + AddTeamScore( team, -GameRules_GetTeamScore( team ) ) }
\ No newline at end of file |