From 983d9ce87e4cb4a0c44dc8849c16847cf625cf65 Mon Sep 17 00:00:00 2001 From: JetBoom Date: Sun, 9 Nov 2014 17:30:30 -0500 Subject: [PATCH] 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. --- .../entities/trigger_zombieclass/init.lua | 45 +++++-------------- .../gamemode/obj_player_extend_sv.lua | 8 +++- 2 files changed, 17 insertions(+), 36 deletions(-) diff --git a/gamemodes/zombiesurvival/entities/entities/trigger_zombieclass/init.lua b/gamemodes/zombiesurvival/entities/entities/trigger_zombieclass/init.lua index 303a0c2..8a5080b 100644 --- a/gamemodes/zombiesurvival/entities/entities/trigger_zombieclass/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/trigger_zombieclass/init.lua @@ -45,11 +45,11 @@ function ENT:KeyValue(key, value) 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.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 - if string.lower(v.Name) == self.TouchClass then + if string.lower(v.Name) == class_name then local prev = ent:GetZombieClass() local prevpos = ent:GetPos() local prevang = ent:EyeAngles() @@ -67,9 +67,9 @@ function ENT:Touch(ent) break 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 - if string.lower(v.Name) == self.TouchDeathClass then + if string.lower(v.Name) == death_class_name then ent.DeathClass = k break end @@ -77,37 +77,12 @@ function ENT:Touch(ent) end end end + +function ENT:Touch(ent) + self:DoTouch(ent, self.TouchClass, self.TouchDeathClass) +end ENT.StartTouch = ENT.Touch function ENT:EndTouch(ent) - if self.On and ent:IsPlayer() and ent:Alive() and ent:Team() == TEAM_UNDEAD then - 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 + self:DoTouch(ent, self.EndTouchClass, self.EndTouchDeathClass) end diff --git a/gamemodes/zombiesurvival/gamemode/obj_player_extend_sv.lua b/gamemodes/zombiesurvival/gamemode/obj_player_extend_sv.lua index 1d91286..b1f5a93 100644 --- a/gamemodes/zombiesurvival/gamemode/obj_player_extend_sv.lua +++ b/gamemodes/zombiesurvival/gamemode/obj_player_extend_sv.lua @@ -764,8 +764,14 @@ function meta:AddBrains(amount) self:CheckRedeem() end +meta.GetBrains = self.Frags + 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 self:Redeem() else