Merge pull request #66 from BClark09/master
Added nail functions previously described in FGD
This commit is contained in:
commit
6ebf7ab049
3 changed files with 34 additions and 12 deletions
|
@ -17,6 +17,9 @@ end)
|
|||
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/crossbow_bolt.mdl")
|
||||
self.m_NailUnremovable = self.m_NailUnremovable or false
|
||||
self.HealthOveride = self.HealthOveride or -1
|
||||
self.HealthMultiplier = self.HealthMultiplier or 1
|
||||
end
|
||||
|
||||
function ENT:OnDamaged(damage, attacker, inflictor, dmginfo)
|
||||
|
@ -48,6 +51,8 @@ function ENT:AttachTo(baseent, attachent, physbone, physbone2)
|
|||
|
||||
if baseent:GetBarricadeHealth() == 0 then
|
||||
local health = baseent:GetDefaultBarricadeHealth()
|
||||
if self.HealthOveride > 0 then health = self.HealthOveride end
|
||||
health = health * self.HealthMultiplier
|
||||
baseent:SetMaxBarricadeHealth(health)
|
||||
baseent:SetBarricadeHealth(health)
|
||||
baseent:SetBarricadeRepairs(baseent:GetMaxBarricadeRepairs())
|
||||
|
@ -84,6 +89,11 @@ function ENT:SetDeployer(pl)
|
|||
end
|
||||
end
|
||||
|
||||
function ENT:SetNewHealth(health)
|
||||
baseent = self:GetBaseEntity()
|
||||
baseent:SetBarricadeHealth(health)
|
||||
end
|
||||
|
||||
function ENT:AcceptInput(name, activator, caller, args)
|
||||
name = string.lower(name)
|
||||
if name == "attachto" then
|
||||
|
@ -105,13 +115,17 @@ function ENT:AcceptInput(name, activator, caller, args)
|
|||
elseif name == "setname" or name == "setdeployer" then
|
||||
self:SetDeployer(args)
|
||||
|
||||
return true
|
||||
elseif name == "sethealth" then
|
||||
self:SetNewHealth(args)
|
||||
|
||||
return true
|
||||
elseif name == "setunremoveable" or name == "setunremovable" then
|
||||
self.m_NailUnremovable = tonumber(args) == 1
|
||||
|
||||
return true
|
||||
elseif name == "toggleunremoveable" or name == "toggleunremovable" then
|
||||
self.m_NailUnremovable = not self.m_NailRemovable
|
||||
self.m_NailUnremovable = not self.m_NailUnremovable
|
||||
|
||||
return true
|
||||
end
|
||||
|
@ -133,6 +147,10 @@ end
|
|||
function ENT:KeyValue(key, value)
|
||||
key = string.lower(key)
|
||||
if key == "unremoveable" or key == "unremovable" then
|
||||
self.m_NailUnremoveable = tonumber(value) == 1
|
||||
self.m_NailUnremovable = tonumber(value) == 1
|
||||
elseif key == "healthoverride" then
|
||||
self.HealthOveride = tonumber(value)
|
||||
elseif key == "healthmultiplier" then
|
||||
self.HealthMultiplier = tonumber(value)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -470,8 +470,12 @@ function GM:CanPlaceNail(pl, tr)
|
|||
end
|
||||
|
||||
function GM:CanRemoveNail(pl, nail)
|
||||
if nail.m_NailUnremovable then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function GM:GetDamageResistance(fearpower)
|
||||
return fearpower * 0.35
|
||||
|
|
|
@ -407,7 +407,7 @@
|
|||
@PointClass studio("models/crossbow_bolt.mdl") base(Targetname,Angles) = prop_nail : "ZS: Allows you to manually place nails."
|
||||
[
|
||||
// Keys
|
||||
healthoverride(integer) : "Health Override" : 210 : "Sets the nail's maximum health to a specific number."
|
||||
healthoverride(integer) : "Health Override" : -1 : "Sets the nail's maximum health to a specific number. Set to -1 or 0 to disable override"
|
||||
healthmultiplier(float) : "Health Multiply" : 1 : "Multiply the nail's default maximum health by this number."
|
||||
unremovable(choices) : "Unremovable" : 0 : "Set to yes to make this nail unremovable by players." =
|
||||
[
|
||||
|
@ -417,8 +417,8 @@
|
|||
|
||||
// Inputs
|
||||
input sethealth(integer) : "Sets the nail's remaining health."
|
||||
input attachto(string) : "Parent to this entity."
|
||||
input nailto(string) : "Nail to this entity. Use attachto first and then this to weld the two. Use 'worldspawn' here to weld to the world."
|
||||
input attachto(target_destination) : "Parent to this entity."
|
||||
input nailto(target_destination) : "Nail to this entity. Use attachto first and then this to weld the two. Use 'worldspawn' here to weld to the world."
|
||||
input setname(string) : "Display this text as the owner name."
|
||||
input setunremovable(integer) : "Set if this nail is unremovable."
|
||||
input toggleunremovable(integer) : "Toggle unremovable state."
|
||||
|
|
Loading…
Reference in a new issue