gamemode: Implement Scoreboard support
The game mode will now assign points to teams as well as increment frags and deaths. This paves the way for a proper scoreboard to be added.
This commit is contained in:
@@ -61,6 +61,13 @@ function CLASS:DamageEntity(ent, attacker, dmginfo) end -- Damage Dealt To Entit
|
||||
function CLASS:Death(inflictor, attacker)
|
||||
self.Player.Data.Alive = false
|
||||
self.Player.Data.AliveTime = CurTime()
|
||||
-- Score support
|
||||
if IsValid(attacker) then
|
||||
if attacker:IsPlayer() then
|
||||
attacker:AddFrags(1)
|
||||
end
|
||||
self.Player:AddDeaths(1)
|
||||
end
|
||||
end
|
||||
function CLASS:SilentDeath()
|
||||
self.Player.Data.Alive = false
|
||||
|
||||
@@ -86,10 +86,19 @@ function StateSeek:OnLeave(NewState)
|
||||
if GAMEMODE.Config:DebugLog() then print("StateSeek: OnLeave") end
|
||||
|
||||
if GAMEMODE:GetRoundWinner() == GAMEMODE.Teams.Seekers then
|
||||
-- Run external Hooks
|
||||
hook.Run("RoundVictorySeeker")
|
||||
|
||||
-- Assign Team Points
|
||||
team.SetScore(GAMEMODE.Teams.Seekers, team.GetScore(GAMEMODE.Teams.Seekers) + 1)
|
||||
elseif GAMEMODE:GetRoundWinner() == GAMEMODE.Teams.Hiders then
|
||||
-- Run external Hooks
|
||||
hook.Run("RoundVictoryHider")
|
||||
|
||||
-- Assign Team Points
|
||||
team.SetScore(GAMEMODE.Teams.Hiders, team.GetScore(GAMEMODE.Teams.Hiders) + 1)
|
||||
else
|
||||
-- Run external Hooks
|
||||
hook.Run("RoundVictoryDraw")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user