diff --git a/gamemodes/zombiesurvival/entities/entities/trigger_zombieclass/init.lua b/gamemodes/zombiesurvival/entities/entities/trigger_zombieclass/init.lua index 3173014..50d5f09 100644 --- a/gamemodes/zombiesurvival/entities/entities/trigger_zombieclass/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/trigger_zombieclass/init.lua @@ -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) diff --git a/gamemodes/zombiesurvival/zombiesurvival.fgd b/gamemodes/zombiesurvival/zombiesurvival.fgd index 24d7b97..6458b0e 100644 --- a/gamemodes/zombiesurvival/zombiesurvival.fgd +++ b/gamemodes/zombiesurvival/zombiesurvival.fgd @@ -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"