Revert point reduction on death to end of the round
This commit is contained in:
parent
abfd76177b
commit
48a85fc6fa
@ -20,11 +20,10 @@ local function savePoints(ply)
|
||||
if PointSaving_shouldIgnoreMap(game.GetMap()) then return end
|
||||
|
||||
if ply:Team() == TEAM_HUMAN then
|
||||
--print("### PS Saved: "..ply:GetPoints())
|
||||
ply:SetSavedPoints(ply:GetPoints())
|
||||
end
|
||||
end
|
||||
--hook.Add("PlayerDeath", "pointsave_death", savePoints)
|
||||
hook.Add("PlayerDeath", "pointsave_death", savePoints)
|
||||
hook.Add("PlayerDisconnected", "pointsave_disconnect", savePoints)
|
||||
|
||||
hook.Add("PostEndRound", "pointsave_postendround", function(winner)
|
||||
@ -42,7 +41,6 @@ local function loadPoints(ply)
|
||||
|
||||
timer.Simple(0, function()
|
||||
if IsValid(ply) and ply:Team() == TEAM_HUMAN then
|
||||
--print("### Loaded: "..ply:GetSavedPoints())
|
||||
ply:SetPoints(ply:GetSavedPoints())
|
||||
end
|
||||
end)
|
||||
@ -60,6 +58,7 @@ function meta:GetSavedPoints()
|
||||
if SERVER then
|
||||
local points = self:GetPData("zs_savedpoints", settings.StartingSavedPoints)
|
||||
self:SetNWInt("zs_savedpoints", points)
|
||||
print("### PS Loaded: "..points)
|
||||
return points
|
||||
end
|
||||
|
||||
@ -72,6 +71,8 @@ if not SERVER then return end
|
||||
|
||||
function meta:SetSavedPoints(amount)
|
||||
if amount < settings.MinimumPoints then amount = settings.MinimumPoints end
|
||||
amount = math.Round(amount)
|
||||
print("### PS Saved: "..amount)
|
||||
self:SetNWInt("zs_savedpoints", amount)
|
||||
self:SetPData("zs_savedpoints", amount)
|
||||
end
|
||||
|
@ -63,17 +63,7 @@ local function postStatistics(mapParams, timesPlayed, freqMult, zombiePercentCal
|
||||
PrintMessage(HUD_PRINTTALK,"<c=204,204,0>Map jackpot is now "..(mapParams.Jackpot)..".</c>")
|
||||
end
|
||||
|
||||
hook.Add("PlayerDeath", "pointsave_death", function(ply)
|
||||
if PointSaving_shouldIgnoreMap(game.GetMap()) then return end
|
||||
|
||||
if ply:Team() == TEAM_HUMAN then
|
||||
--print("### PS Saved: "..ply:GetPoints())
|
||||
ply:SetSavedPoints(ply:GetPoints() * settings.LosePointReduction)
|
||||
ply:PrintMessage(HUD_PRINTTALK,"<c=255,0,0>You lost "..(settings.LosePointReduction * 100).."% of your saved points because you died!</c>")
|
||||
end
|
||||
end)
|
||||
|
||||
-- TODO: When round is lost, take away points from recently disconnected human team players
|
||||
-- TODO: When round is lost, take away points from human players that were there at the beginning of the game (All Human players that were there at the end of round 1, when late joiners join as zombies)
|
||||
|
||||
hook.Add("PostEndRound", "pointsave_givedapoints", function(winner)
|
||||
timer.Destroy("pointsave_zombieintervalcounter")
|
||||
@ -144,7 +134,7 @@ hook.Add("PostEndRound", "pointsave_givedapoints", function(winner)
|
||||
if ply:Team() == TEAM_HUMAN then
|
||||
pointsToGivePly = math.Round(pointsToGive)
|
||||
else
|
||||
pointsToGivePly = math.Round(pointsToGive * settings.ZombiePointsFactor)
|
||||
pointsToGivePly = math.Round(pointsToGive * settings.ZombiePointsFactor) - points * settings.LosePointReduction
|
||||
end
|
||||
-- Limit pointsToGivePly
|
||||
if points + pointsToGivePly < 0 then pointsToGivePly = -points end
|
||||
|
Loading…
Reference in New Issue
Block a user