Merge pull request #83 from BClark09/master

Filter in trigger_zombieclass now takes lists
This commit is contained in:
William Moodhe / JetBoom 2014-12-27 16:18:19 -05:00
commit 9664c13a56
2 changed files with 15 additions and 14 deletions

View file

@ -5,7 +5,10 @@ function ENT:Initialize()
if self.On == nil then self.On = true end
if self.InstantChange == nil then self.InstantChange = true end
if self.OnlyWhenClass == nil then self.OnlyWhenClass = -1 end
if self.OnlyWhenClass == nil then
self.OnlyWhenClass = {}
self.OnlyWhenClass[1] = -1
end
end
function ENT:Think()
@ -34,15 +37,17 @@ function ENT:KeyValue(key, value)
elseif key == "touchclass" then
self.TouchClass = string.lower(value)
elseif key == "onlywhenclass" then
self.OnlyWhenClass = {}
if value == "disabled" then
self.OnlyWhenClass = -1
self.OnlyWhenClass[1] = -1
else
for k, v in ipairs(GAMEMODE.ZombieClasses) do
if string.lower(v.Name) == value then
self.OnlyWhenClass = k
break
else
self.OnlyWhenClass = -1
self.OnlyWhenClass[1] = -1
for i, allowed_class in pairs(string.Explode(",", string.lower(value))) do
for k, v in ipairs(GAMEMODE.ZombieClasses) do
if string.lower(v.Name) == allowed_class then
self.OnlyWhenClass[i] = k
break
end
end
end
end
@ -65,7 +70,7 @@ function ENT:DoTouch(ent, class_name, death_class_name)
for k, v in ipairs(GAMEMODE.ZombieClasses) do
if string.lower(v.Name) == class_name then
local prev = ent:GetZombieClass()
if self.OnlyWhenClass == prev or self.OnlyWhenClass == -1 then
if table.HasValue( self.OnlyWhenClass, prev ) or self.OnlyWhenClass[1] == -1 then
local prevpos = ent:GetPos()
local prevang = ent:EyeAngles()
ent:SetZombieClass(k)

View file

@ -36,7 +36,6 @@
]
touchclass(choices) : "On Touch Class" : "zombie" : "Any living zombie touching the brush will be set to this class name." =
[
"crow" : "Crow"
"will o' wisp" : "Will O' Wisp"
"zombie" : "Zombie"
"classic Zombie" : "Classic Zombie"
@ -66,7 +65,6 @@
]
endtouchclass(choices) : "On Leaving Class" : "zombie" : "Same as Touching Class but for when leaving the brush." =
[
"crow" : "Crow"
"will o' wisp" : "Will O' Wisp"
"zombie" : "Zombie"
"classic Zombie" : "Classic Zombie"
@ -96,7 +94,6 @@
]
touchdeathclass(choices) : "On Touch Respawn Class" : "zombie" : "Any living zombie touching the brush will be set to this class name on death." =
[
"crow" : "Crow"
"will o' wisp" : "Will O' Wisp"
"zombie" : "Zombie"
"classic Zombie" : "Classic Zombie"
@ -126,7 +123,6 @@
]
endtouchdeathclass(choices) : "On Leaving Respawn Class" : "zombie" : "Same as Touching Respawn Class but for when leaving the brush." =
[
"crow" : "Crow"
"will o' wisp" : "Will O' Wisp"
"zombie" : "Zombie"
"classic Zombie" : "Classic Zombie"
@ -154,7 +150,7 @@
"gore child" : "Gore Child"
"giga gore child" : "Giga Gore Child"
]
onlywhenclass(choices) : "Player Must Be This Class" : "disabled" : "Set this to a specific class to change only these zombie types." =
onlywhenclass(choices) : "Player Must Be This Class" : "disabled" : "Set this to a specific class to change only these zombie types, separate multiple classes with commas." =
[
"disabled" : "Disabled"
"will o' wisp" : "Will O' Wisp"