Zombie gas spawns on zm_ maps.

Altered zombie gas creation logic.
This commit is contained in:
JetBoom 2014-11-09 17:36:31 -05:00
parent 983d9ce87e
commit a5188d9f68

View file

@ -357,9 +357,9 @@ function GM:Initialize()
self.ObjectiveMap = true self.ObjectiveMap = true
end end
if string.sub(mapname, 1, 3) == "zm_" then --[[if string.sub(mapname, 1, 3) == "zm_" then
NOZOMBIEGASSES = true NOZOMBIEGASSES = true
end end]]
game.ConsoleCommand("fire_dmgscale 1\n") game.ConsoleCommand("fire_dmgscale 1\n")
game.ConsoleCommand("mp_flashlight 1\n") game.ConsoleCommand("mp_flashlight 1\n")
@ -651,27 +651,34 @@ function GM:CreateZombieGas()
if NOZOMBIEGASSES then return end if NOZOMBIEGASSES then return end
local humanspawns = team.GetValidSpawnPoint(TEAM_HUMAN) local humanspawns = team.GetValidSpawnPoint(TEAM_HUMAN)
local zombiespawns = team.GetValidSpawnPoint(TEAM_UNDEAD)
for _, spawn in pairs(team.GetValidSpawnPoint(TEAM_UNDEAD)) do for _, zombie_spawn in pairs(zombiespawns) do
local gasses = ents.FindByClass("zombiegasses") local gasses = ents.FindByClass("zombiegasses")
local numgasses = #gasses if 4 < #gasses then
if 4 < numgasses then return
break end
elseif numgasses == 0 or math.random(4) == 1 then
local spawnpos = spawn:GetPos() + Vector(0, 0, 24) if #gasses > 0 and math.random(5) ~= 1 then
continue
end
local spawnpos = zombie_spawn:GetPos() + Vector(0, 0, 24)
local near = false local near = false
if not self.ZombieEscape then if not self.ZombieEscape then
for _, humspawn in pairs(humanspawns) do for __, human_spawn in pairs(humanspawns) do
if humspawn:IsValid() and humspawn:GetPos():Distance(spawnpos) < 400 then if human_spawn:IsValid() and human_spawn:GetPos():Distance(spawnpos) < 500 then
near = true near = true
break break
end end
end end
end end
if not near then if not near then
for _, gas in pairs(gasses) do for __, gas in pairs(gasses) do
if gas:GetPos():Distance(spawnpos) < 300 then if gas:GetPos():Distance(spawnpos) < 350 then
near = true near = true
break break
end end
@ -686,7 +693,6 @@ function GM:CreateZombieGas()
end end
end end
end end
end
end end
function GM:CheckDynamicSpawnHR(ent) function GM:CheckDynamicSpawnHR(ent)