diff --git a/lua/autorun/server/mapcalc.lua b/lua/autorun/server/mapcalc.lua
index aa137a7..e030d7f 100644
--- a/lua/autorun/server/mapcalc.lua
+++ b/lua/autorun/server/mapcalc.lua
@@ -51,6 +51,8 @@ hook.Add("WaveStateChanged", "pointsave_zombieintervalactivator", function()
end
end)
+-- TODO: Reset counters on new round.
+
local function postStatistics(mapParams, timesPlayed, freqMult, zombiePercentCalcMap)
PrintMessage(HUD_PRINTTALK,"This map has been played "..timesPlayed.." times with humans winning "..(mapParams.TimesWon).." times.("..(math.Round((mapParams.TimesWon/timesPlayed)*100)).."%)")
PrintMessage(HUD_PRINTTALK,"Zombies were only playing for "..math.Round(zombiePercentCalcMap * 100).."% of the time.")
@@ -62,7 +64,7 @@ end
hook.Add("PostEndRound", "pointsave_givedapoints", function(winner)
timer.Destroy("pointsave_zombieintervalcounter")
- -- TODO: Check if map should be ignored
+ if PointSaving_shouldIgnoreMap(game.GetMap()) then return end
timer.Simple(0, function()
print("point bonus hook")
@@ -126,7 +128,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) - points * settings.LosePointReduction
+ pointsToGivePly = math.Round(pointsToGive * settings.ZombiePointsFactor) - points * settings.LosePointReduction -- TODO: Reduce points on death, not round end to avoid cheating
end
-- Limit pointsToGivePly
if points + pointsToGivePly < 0 then pointsToGivePly = -points end
diff --git a/lua/autorun/server/sv_pointsaving.lua b/lua/autorun/server/sv_pointsaving.lua
index 7ca93d6..ea37882 100644
--- a/lua/autorun/server/sv_pointsaving.lua
+++ b/lua/autorun/server/sv_pointsaving.lua
@@ -10,14 +10,14 @@ local settings = {
}
}
-local function shouldIgnoreMap(mapName)
+function PointSaving_shouldIgnoreMap(mapName)
for k, v in ipairs(settings.IgnoredMaps) do
if string.match(string.lower(mapName), "^"..v) then return true end
end
end
local function savePoints(ply)
- if shouldIgnoreMap(game.GetMap()) then return end
+ if PointSaving_shouldIgnoreMap(game.GetMap()) then return end
if ply:Team() == TEAM_HUMAN then
--print("### PS Saved: "..ply:GetPoints())
@@ -28,7 +28,7 @@ hook.Add("PlayerDeath", "pointsave_death", savePoints)
hook.Add("PlayerDisconnected", "pointsave_disconnect", savePoints)
hook.Add("PostEndRound", "pointsave_postendround", function(winner)
- if shouldIgnoreMap(game.GetMap()) then return end
+ if PointSaving_shouldIgnoreMap(game.GetMap()) then return end
for k, ply in pairs(player.GetAll()) do
savePoints(ply)
@@ -38,7 +38,7 @@ end)
-- TODO: Save points every minute or so
local function loadPoints(ply)
- if shouldIgnoreMap(game.GetMap()) then return end
+ if PointSaving_shouldIgnoreMap(game.GetMap()) then return end
timer.Simple(0, function()
if IsValid(ply) and ply:Team() == TEAM_HUMAN then