aboutsummaryrefslogtreecommitdiff
path: root/entities
diff options
context:
space:
mode:
Diffstat (limited to 'entities')
-rw-r--r--entities/entities/ws_teleporter/init.lua24
-rw-r--r--entities/entities/ws_teleporter/shared.lua6
2 files changed, 24 insertions, 6 deletions
diff --git a/entities/entities/ws_teleporter/init.lua b/entities/entities/ws_teleporter/init.lua
index 08d73f5..f364cac 100644
--- a/entities/entities/ws_teleporter/init.lua
+++ b/entities/entities/ws_teleporter/init.lua
@@ -7,10 +7,24 @@ function ENT:Initialize()
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_NONE)
self:SetSolid(SOLID_VPHYSICS)
- if(self.model) then
- self:SetModel(self.model)
- else
- print("Teleporter constructed without model!, this might be an error!")
+ 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()
+ 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()
end
- if (!self.Item) then self:Remove() end
end
diff --git a/entities/entities/ws_teleporter/shared.lua b/entities/entities/ws_teleporter/shared.lua
index 000ebf6..3899060 100644
--- a/entities/entities/ws_teleporter/shared.lua
+++ b/entities/entities/ws_teleporter/shared.lua
@@ -3,14 +3,18 @@ ENT.Base = "base_anim"
function ENT:OnRemove()
end
-
+--[[
function ENT:PhysicsCollide(data, phys)
print("We're collideing!")
if(self.endpoint) then
if(data.HitEntity:IsPlayer()) then
+ print("Hit entity was player!")
data.HitEntity:SetPos(self.endpoint)
+ else
+ print("Hit entity was not player!")
end
else
print("Teleporter without endpoint, this might be an error!")
end
end
+]]--