Check if map should be ignored
This commit is contained in:
parent
d0a0f452c6
commit
36db2dbd0d
@ -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,"<c=0,255,255>This map has been played "..timesPlayed.." times with humans winning "..(mapParams.TimesWon).." times.("..(math.Round((mapParams.TimesWon/timesPlayed)*100)).."%)</c>")
|
||||
PrintMessage(HUD_PRINTTALK,"<c=0,255,255>Zombies were only playing for "..math.Round(zombiePercentCalcMap * 100).."% of the time.</c>")
|
||||
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user