Fixed GAMEMODE.NoRedeeming being ignored.
Fixed GAMEMODE.NoRedeeming being ignored by the gamemode. For maps which are not objective maps, but only have one wave, redeeming is now enabled if there are 5 or more minutes remaining in the wave. Previously it was disabled completely.
This commit is contained in:
parent
aad1c56f47
commit
983d9ce87e
2 changed files with 17 additions and 36 deletions
|
@ -45,11 +45,11 @@ function ENT:KeyValue(key, value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:Touch(ent)
|
function ENT:DoTouch(ent, class_name, death_class_name)
|
||||||
if self.On and ent:IsPlayer() and ent:Alive() and ent:Team() == TEAM_UNDEAD then
|
if self.On and ent:IsPlayer() and ent:Alive() and ent:Team() == TEAM_UNDEAD then
|
||||||
if self.TouchClass and self.TouchClass ~= string.lower(ent:GetZombieClassTable().Name) then
|
if class_name and class_name ~= string.lower(ent:GetZombieClassTable().Name) then
|
||||||
for k, v in ipairs(GAMEMODE.ZombieClasses) do
|
for k, v in ipairs(GAMEMODE.ZombieClasses) do
|
||||||
if string.lower(v.Name) == self.TouchClass then
|
if string.lower(v.Name) == class_name then
|
||||||
local prev = ent:GetZombieClass()
|
local prev = ent:GetZombieClass()
|
||||||
local prevpos = ent:GetPos()
|
local prevpos = ent:GetPos()
|
||||||
local prevang = ent:EyeAngles()
|
local prevang = ent:EyeAngles()
|
||||||
|
@ -67,9 +67,9 @@ function ENT:Touch(ent)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif self.TouchDeathClass and self.TouchDeathClass ~= string.lower(ent:GetZombieClassTable().Name) then
|
elseif death_class_name and death_class_name ~= string.lower(ent:GetZombieClassTable().Name) then
|
||||||
for k, v in ipairs(GAMEMODE.ZombieClasses) do
|
for k, v in ipairs(GAMEMODE.ZombieClasses) do
|
||||||
if string.lower(v.Name) == self.TouchDeathClass then
|
if string.lower(v.Name) == death_class_name then
|
||||||
ent.DeathClass = k
|
ent.DeathClass = k
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -77,37 +77,12 @@ function ENT:Touch(ent)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ENT:Touch(ent)
|
||||||
|
self:DoTouch(ent, self.TouchClass, self.TouchDeathClass)
|
||||||
|
end
|
||||||
ENT.StartTouch = ENT.Touch
|
ENT.StartTouch = ENT.Touch
|
||||||
|
|
||||||
function ENT:EndTouch(ent)
|
function ENT:EndTouch(ent)
|
||||||
if self.On and ent:IsPlayer() and ent:Alive() and ent:Team() == TEAM_UNDEAD then
|
self:DoTouch(ent, self.EndTouchClass, self.EndTouchDeathClass)
|
||||||
if self.EndTouchClass and self.EndTouchClass ~= string.lower(ent:GetZombieClassTable().Name) then
|
|
||||||
for k, v in ipairs(GAMEMODE.ZombieClasses) do
|
|
||||||
if string.lower(v.Name) == self.EndTouchClass then
|
|
||||||
local prev = ent:GetZombieClass()
|
|
||||||
local prevpos = ent:GetPos()
|
|
||||||
local prevang = ent:GetAngles()
|
|
||||||
ent:SetZombieClass(k)
|
|
||||||
ent.DidntSpawnOnSpawnPoint = true
|
|
||||||
ent:UnSpectateAndSpawn()
|
|
||||||
if self.OneTime then
|
|
||||||
ent.DeathClass = prev
|
|
||||||
end
|
|
||||||
if self.InstantChange then
|
|
||||||
ent:SetPos(prevpos)
|
|
||||||
ent:SetEyeAngles(prevang)
|
|
||||||
end
|
|
||||||
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elseif self.EndTouchDeathClass and self.EndTouchDeathClass ~= string.lower(ent:GetZombieClassTable().Name) then
|
|
||||||
for k, v in ipairs(GAMEMODE.ZombieClasses) do
|
|
||||||
if string.lower(v.Name) == self.EndTouchDeathClass then
|
|
||||||
ent.DeathClass = k
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -764,8 +764,14 @@ function meta:AddBrains(amount)
|
||||||
self:CheckRedeem()
|
self:CheckRedeem()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
meta.GetBrains = self.Frags
|
||||||
|
|
||||||
function meta:CheckRedeem(instant)
|
function meta:CheckRedeem(instant)
|
||||||
if self:IsValid() and self:Team() == TEAM_UNDEAD and GAMEMODE:GetRedeemBrains() > 0 and GAMEMODE:GetRedeemBrains() <= self:Frags() and GAMEMODE:GetWave() ~= GAMEMODE:GetNumberOfWaves() and not self.NoRedeeming and not self:GetZombieClassTable().Boss then
|
if not self:IsValid() or self:Team() ~= TEAM_UNDEAD
|
||||||
|
or GAMEMODE:GetRedeemBrains() <= 0 or self:GetBrains() < GAMEMODE:GetRedeemBrains()
|
||||||
|
or GAMEMODE.NoRedeeming or self:GetZombieClassTable().Boss then return end
|
||||||
|
|
||||||
|
if GAMEMODE:GetWave() ~= GAMEMODE:GetNumberOfWaves() or not GAMEMODE.ObjectiveMap and GAMEMODE:GetNumberOfWaves() == 1 and CurTime() < GAMEMODE:GetWaveEnd() - 300 then
|
||||||
if instant then
|
if instant then
|
||||||
self:Redeem()
|
self:Redeem()
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue