diff options
| -rw-r--r-- | entities/entities/ws_prop/init.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/entities/entities/ws_prop/init.lua b/entities/entities/ws_prop/init.lua index 519f1e7..51e979f 100644 --- a/entities/entities/ws_prop/init.lua +++ b/entities/entities/ws_prop/init.lua @@ -8,21 +8,23 @@ function ENT:Initialize() self:SetMoveType(MOVETYPE_NONE)
self:SetSolid(SOLID_VPHYSICS)
self:DrawShadow(false)
-
+
local phys = self:GetPhysicsObject()
phys:EnableMotion(false)
phys:Sleep()
-
+
self:SetHealth(30)
-
+
self.HP = 500
+ self.MaxHP = self.HP
end
function ENT:OnTakeDamage(dmginfo)
self.HP = self.HP-dmginfo:GetDamage()
-
- if (self.HP <= 0) then
+ local newcolor = (self.HP/self.MaxHP)*255
+ self:SetColor(Color(newcolor,newcolor,newcolor))
+ if (self.HP <= 0) then
self:EmitSound(Sound("physics/wood/wood_plank_break"..math.random(1,4)..".wav"))
- self:Remove()
+ self:Remove()
end
end
|
