Merge pull request #88 from BClark09/master

Fixed class switching bug in trigger_zombieclass
This commit is contained in:
William Moodhe / JetBoom 2014-12-30 13:32:47 -05:00
commit 69ec091490

View file

@ -66,13 +66,14 @@ end
function ENT:DoTouch(ent, class_name, death_class_name) 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 class_name and class_name ~= string.lower(ent:GetZombieClassTable().Name) then local prev = ent:GetZombieClass()
for k, v in ipairs(GAMEMODE.ZombieClasses) do if table.HasValue( self.OnlyWhenClass, prev ) or self.OnlyWhenClass[1] == -1 then
if string.lower(v.Name) == class_name then if class_name and class_name ~= string.lower(ent:GetZombieClassTable().Name) then
local prev = ent:GetZombieClass() for k, v in ipairs(GAMEMODE.ZombieClasses) do
if table.HasValue( self.OnlyWhenClass, prev ) or self.OnlyWhenClass[1] == -1 then if string.lower(v.Name) == class_name then
local prevpos = ent:GetPos() local prevpos = ent:GetPos()
local prevang = ent:EyeAngles() local prevang = ent:EyeAngles()
ent:KillSilent()
ent:SetZombieClass(k) ent:SetZombieClass(k)
ent.DidntSpawnOnSpawnPoint = true ent.DidntSpawnOnSpawnPoint = true
ent:UnSpectateAndSpawn() ent:UnSpectateAndSpawn()
@ -83,15 +84,16 @@ function ENT:DoTouch(ent, class_name, death_class_name)
ent:SetPos(prevpos) ent:SetPos(prevpos)
ent:SetEyeAngles(prevang) ent:SetEyeAngles(prevang)
end end
break
end end
break
end end
end end
elseif death_class_name and death_class_name ~= string.lower(ent:GetZombieClassTable().Name) then if 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) == death_class_name then if string.lower(v.Name) == death_class_name then
ent.DeathClass = k ent.DeathClass = k
break break
end
end end
end end
end end