zombiesurvival-evolved/gamemodes/zombiesurvival/entities/entities/prop_obj_sigil/shared.lua
2014-10-01 20:49:54 -04:00

32 lines
858 B
Lua

ENT.Type = "anim"
ENT.MaxHealth = 1000
ENT.HealthRegen = 10
ENT.RegenDelay = 10
ENT.ModelScale = 1 --ENT.ModelScale = 0.5
ENT.m_NoNailUnfreeze = true
ENT.NoNails = true
ENT.IsBarricadeObject = true
AccessorFuncDT(ENT, "SigilHealthBase", "Float", 0)
AccessorFuncDT(ENT, "SigilHealthRegen", "Float", 1)
AccessorFuncDT(ENT, "SigilLastDamaged", "Float", 2)
function ENT:SetSigilHealth(health)
self:SetSigilHealthBase(health)
self:SetSigilLastDamaged(math.max(self:GetSigilLastDamaged(), self:GetSigilHealthRegen() - self.RegenDelay))
end
function ENT:GetSigilHealth()
local base = self:GetSigilHealthBase()
if base == 0 then return 0 end
return math.Clamp(base + self:GetSigilHealthRegen() * math.max(0, CurTime() - (self:GetSigilLastDamaged() + self.RegenDelay)), 0, self.MaxHealth)
end
function ENT:GetSigilMaxHealth()
return self.MaxHealth
end