Merge pull request #4 from BClark09/master
3 commits dealing with zombie class changing
This commit is contained in:
commit
3a9a35363c
3 changed files with 93 additions and 1 deletions
|
@ -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:EyeAngles()
|
||||||
|
GAMEMODE:SpawnBossZombie(ent, self.Silent)
|
||||||
|
if self.InstantChange then
|
||||||
|
ent:SetPos(prevpos)
|
||||||
|
ent:SetEyeAngles(prevang)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -52,6 +52,7 @@ function ENT:Touch(ent)
|
||||||
if string.lower(v.Name) == self.TouchClass then
|
if string.lower(v.Name) == self.TouchClass then
|
||||||
local prev = ent:GetZombieClass()
|
local prev = ent:GetZombieClass()
|
||||||
local prevpos = ent:GetPos()
|
local prevpos = ent:GetPos()
|
||||||
|
local prevang = ent:EyeAngles()
|
||||||
ent:SetZombieClass(k)
|
ent:SetZombieClass(k)
|
||||||
ent:UnSpectateAndSpawn()
|
ent:UnSpectateAndSpawn()
|
||||||
if self.OneTime then
|
if self.OneTime then
|
||||||
|
@ -59,6 +60,7 @@ function ENT:Touch(ent)
|
||||||
end
|
end
|
||||||
if self.InstantChange then
|
if self.InstantChange then
|
||||||
ent:SetPos(prevpos)
|
ent:SetPos(prevpos)
|
||||||
|
ent:SetEyeAngles(prevang)
|
||||||
end
|
end
|
||||||
|
|
||||||
break
|
break
|
||||||
|
@ -83,6 +85,7 @@ function ENT:EndTouch(ent)
|
||||||
if string.lower(v.Name) == self.EndTouchClass then
|
if string.lower(v.Name) == self.EndTouchClass then
|
||||||
local prev = ent:GetZombieClass()
|
local prev = ent:GetZombieClass()
|
||||||
local prevpos = ent:GetPos()
|
local prevpos = ent:GetPos()
|
||||||
|
local prevang = ent:GetAngles()
|
||||||
ent:SetZombieClass(k)
|
ent:SetZombieClass(k)
|
||||||
ent:UnSpectateAndSpawn()
|
ent:UnSpectateAndSpawn()
|
||||||
if self.OneTime then
|
if self.OneTime then
|
||||||
|
@ -90,6 +93,7 @@ function ENT:EndTouch(ent)
|
||||||
end
|
end
|
||||||
if self.InstantChange then
|
if self.InstantChange then
|
||||||
ent:SetPos(prevpos)
|
ent:SetPos(prevpos)
|
||||||
|
ent:SetEyeAngles(prevang)
|
||||||
end
|
end
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
|
@ -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 //
|
// 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 //
|
// 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>"
|
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 //////////////////////////////////////////////////////
|
// Gamemode - Point Entities //////////////////////////////////////////////////////
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in a new issue