Added trigger_bossclass

A new brush entity which turns the zombie who enters the volume into
their chosen preferred boss:

Keyvalues:
enabled - Enable the brush entity.
silent - If yes then then the server does not announce that a player has
become the new boss.
instantchange - If yes then anyone who gets swapped will instantly be
changed right on the spot.

Inputs:
enable(void) : Enable the entity.
disable(void) : Disable the entity.
seton(integer)  : Set Enabled keyvalue.
setsilent(integer) : Set Silent keyvalue.
setinstantchange(integer) : Set Change Instantly keyvalue.

Outputs:
OnBossTouched  : Set when a boss starts touching the brush. Is not fired
when a zombie becomes a boss in this volume.
This commit is contained in:
Ben 2014-10-29 21:45:33 +00:00
parent 397e915a30
commit cb1818b86f
2 changed files with 89 additions and 1 deletions

View file

@ -0,0 +1,59 @@
ENT.Type = "brush"
function ENT:Initialize()
self:SetTrigger(true)
if self.On == nil then self.On = true end
if self.Silent == nil then self.Silent = false end
if self.InstantChange == nil then self.InstantChange = true end
end
function ENT:Think()
end
function ENT:AcceptInput(name, activator, caller, args)
name = string.lower(name)
if string.sub(name, 1, 2) == "on" then
self:FireOutput(name, activator, caller, args)
elseif name == "seton" then
self.On = tonumber(args) == 1
return true
elseif name == "enable" then
self.On = true
return true
elseif name == "disable" then
self.On = false
return true
elseif name == "setsilent" or name == "setinstantchange" then
self:KeyValue(string.sub(name, 4), args)
end
end
function ENT:KeyValue(key, value)
key = string.lower(key)
if string.sub(key, 1, 2) == "on" then
self:AddOnOutput(key, value)
elseif key == "enabled" then
self.On = tonumber(value) == 1
elseif key == "silent" then
self.Silent = tonumber(value) == 1
elseif key == "instantchange" then
self.InstantChange = tonumber(value) == 1
end
end
function ENT:StartTouch(ent)
if self.On and ent:IsPlayer() and ent:Alive() and ent:Team() == TEAM_UNDEAD then
if ent:GetZombieClassTable().Boss then
self:Input("onbosstouched",ent,self,string.lower(ent:GetZombieClassTable().Name))
else
local prevpos = ent:GetPos()
local prevang = ent:GetAngles()
GAMEMODE:SpawnBossZombie(ent, self.Silent)
if self.InstantChange then
ent:SetPos(prevpos)
ent:SetEyeAngles(prevang)
end
end
end
end

View file

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////
// NoXiousNet Zombie Survival FGD - Last Edit by Benjy (24th July 2014) //
// NoXiousNet Zombie Survival FGD - Last Edit by Benjy (29th October 2014) //
// If there are any bugs with this file, or any additions that need to be made //
// make a post at: http://www.noxiousnet.com/forums/index.php?topic=14910 //
///////////////////////////////////////////////////////////////////////////////////
@ -172,6 +172,35 @@
input setinstantchange(integer) : "Set Change Instantly keyvalue. <boolean>"
]
@SolidClass base(Targetname) = trigger_bossclass : "ZS: A zombie that touches this brush"
[
enabled(choices) : "Enabled" : 0 : "Enable the brush entity." =
[
1 : "Yes"
0 : "No"
]
silent(choices) : "Silent" : 0 : "If yes then then the server does not announce that a player has become the new boss." =
[
1 : "Yes"
0 : "No"
]
instantchange(choices) : "Change Instantly?" : 1 : "If yes then anyone who gets swapped will instantly be changed right on the spot." =
[
1 : "Yes"
0 : "No"
]
// Inputs
input enable(void) : "Enable the entity."
input disable(void) : "Disable the entity."
input seton(integer) : "Set Enabled keyvalue. <boolean>"
input setsilent(integer) : "Set Silent keyvalue. <boolean>"
input setinstantchange(integer) : "Set Change Instantly keyvalue. <boolean>"
// Outputs
output OnBossTouched(void) : "Set when a boss starts touching the brush. Is not fired when a zombie becomes a boss in this volume."
]
///////////////////////////////////////////////////////////////////////////////////
// Gamemode - Point Entities //////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////