gamemode/player_class/class_hider: Add seeker bonus health on kill and log the kill

Fixes #7
This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2018-08-07 00:14:59 +02:00
parent 2bace089e9
commit 4169000b22
@@ -75,7 +75,28 @@ function CLASS:Spawn()
end
-- Death
function CLASS:PostDeath(attacker, dmginfo)
function CLASS:DoDeath(attacker, dmginfo)
BaseClass.DoDeath(self, attacker, dmginfo)
if GAMEMODE.Config:DebugLog() then
if (IsValid(attacker) && attacker:IsPlayer() && attacker != self.Player) then
print("Prop Hunt: Hider '"..self.Player:GetName().."' (SteamID: "..self.Player:SteamID()..") killed by '"..attacker:GetName().."' (SteamID: "..attacker:SteamID()..").")
end
end
if (!IsValid(attacker)) then return end
if (!attacker:IsPlayer()) then return end
if (attacker:Team() == self.Player:Team()) then return end
if (attacker:Team() == GAMEMODE.Teams.Seekers) then
if GAMEMODE.Config:DebugLog() then
print("Prop Hunt: Seeker '"..attacker:GetName().."' (SteamID: "..attacker:SteamID()..") gained "..GAMEMODE.Config.Seeker:HealthBonus().." health for killing Hider '"..self.Player:GetName().."' (SteamID: "..self.Player:SteamID()..").")
end
local newhealth = attacker:Health() + GAMEMODE.Config.Seeker:HealthBonus()
if (newhealth > attacker:GetMaxHealth()) then newhealth = attacker:GetMaxHealth() end
attacker:SetHealth(newhealth)
end
end
function CLASS:PostDeath()
if GAMEMODE.Config:DebugLog() then print("Prop Hunt: Hider '"..self.Player:GetName().."' (SteamID: "..self.Player:SteamID()..") died.") end
BaseClass.PostDeath(self, inflictor, attacker)