We actually have an event for team changes now, so move spree handling out of commands.lua

This commit is contained in:
Timo Smit 2016-09-07 20:23:36 +02:00
parent 7f5a18b779
commit 0fffcca1c2
2 changed files with 7 additions and 4 deletions

View file

@ -219,10 +219,6 @@ function commands.onclientcommand(clientId, cmdText)
return 1 return 1
end end
stats.set(clientId, "currentKillSpree", 0)
stats.set(clientId, "currentDeathSpree", 0)
stats.set(clientId, "currentReviveSpree", 0)
elseif wolfCmd == "callvote" then elseif wolfCmd == "callvote" then
local voteArguments = {} local voteArguments = {}
for i = 2, et.trap_Argc() - 1 do for i = 2, et.trap_Argc() - 1 do

View file

@ -110,8 +110,15 @@ function sprees.onconnect(clientId, firstTime, isBot)
end end
events.handle("onClientConnect", sprees.onconnect) events.handle("onClientConnect", sprees.onconnect)
function sprees.onteamchange(clientId, old, new)
stats.set(clientId, "currentKillSpree", 0)
stats.set(clientId, "currentDeathSpree", 0)
stats.set(clientId, "currentReviveSpree", 0)
end
function sprees.ongamestatechange(gameState) function sprees.ongamestatechange(gameState)
if gameState == constants.GAME_STATE_RUNNING then if gameState == constants.GAME_STATE_RUNNING then
events.handle("onClientTeamChange", sprees.onteamchange)
events.handle("onPlayerDeath", sprees.ondeath) events.handle("onPlayerDeath", sprees.ondeath)
events.handle("onPlayerRevive", sprees.onrevive) events.handle("onPlayerRevive", sprees.onrevive)
elseif gameState == constants.GAME_STATE_INTERMISSION then elseif gameState == constants.GAME_STATE_INTERMISSION then