Merge pull request #88 from BClark09/master
Fixed class switching bug in trigger_zombieclass
This commit is contained in:
commit
69ec091490
1 changed files with 12 additions and 10 deletions
|
@ -66,13 +66,14 @@ end
|
|||
|
||||
function ENT:DoTouch(ent, class_name, death_class_name)
|
||||
if self.On and ent:IsPlayer() and ent:Alive() and ent:Team() == TEAM_UNDEAD then
|
||||
local prev = ent:GetZombieClass()
|
||||
if table.HasValue( self.OnlyWhenClass, prev ) or self.OnlyWhenClass[1] == -1 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) == class_name then
|
||||
local prev = ent:GetZombieClass()
|
||||
if table.HasValue( self.OnlyWhenClass, prev ) or self.OnlyWhenClass[1] == -1 then
|
||||
local prevpos = ent:GetPos()
|
||||
local prevang = ent:EyeAngles()
|
||||
ent:KillSilent()
|
||||
ent:SetZombieClass(k)
|
||||
ent.DidntSpawnOnSpawnPoint = true
|
||||
ent:UnSpectateAndSpawn()
|
||||
|
@ -83,11 +84,11 @@ function ENT:DoTouch(ent, class_name, death_class_name)
|
|||
ent:SetPos(prevpos)
|
||||
ent:SetEyeAngles(prevang)
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
elseif death_class_name and death_class_name ~= string.lower(ent:GetZombieClassTable().Name) then
|
||||
end
|
||||
if 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) == death_class_name then
|
||||
ent.DeathClass = k
|
||||
|
@ -96,6 +97,7 @@ function ENT:DoTouch(ent, class_name, death_class_name)
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Touch(ent)
|
||||
|
|
Loading…
Reference in a new issue