aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-02-18 16:53:42 -0500
committerAlexander Pickering <alexandermpickering@gmail.com>2017-02-18 16:53:42 -0500
commit95d5c63cc93dc6985380fb53d4e6eb7aaa7cbd0a (patch)
tree73436e8c05cafce8817804e70b856dcd5087da11
parent7aba21de2727a55daa33b40fb6d31510b660040f (diff)
downloadwintersurvival2-95d5c63cc93dc6985380fb53d4e6eb7aaa7cbd0a.tar.gz
wintersurvival2-95d5c63cc93dc6985380fb53d4e6eb7aaa7cbd0a.tar.bz2
wintersurvival2-95d5c63cc93dc6985380fb53d4e6eb7aaa7cbd0a.zip
Fixed a problem with ws_prop's not loading after mapchange
-rw-r--r--entities/entities/ws_prop/init.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/entities/entities/ws_prop/init.lua b/entities/entities/ws_prop/init.lua
index f757148..c6113f9 100644
--- a/entities/entities/ws_prop/init.lua
+++ b/entities/entities/ws_prop/init.lua
@@ -1,7 +1,7 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
-include('shared.lua')
+include("shared.lua")
function ENT:Serialize()
local data = {}
@@ -27,9 +27,13 @@ function ENT:Initialize()
self:SetSolid(SOLID_VPHYSICS)
self:DrawShadow(false)
- local phys = self:GetPhysicsObject()
- phys:EnableMotion(false)
- phys:Sleep()
+ //Needed if loading a ws_prop after a map start
+ timer.Simple(0,function()
+ local phys = self:GetPhysicsObject()
+ phys:EnableMotion(false)
+ phys:Sleep()
+ end)
+
if self:Health() == 0 then self:SetHealth(30) end
@@ -39,10 +43,10 @@ end
function ENT:OnTakeDamage(dmginfo)
self.HP = self.HP-dmginfo:GetDamage()
- local newcolor = (self.HP/self.MaxHP)*255
+ 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:EmitSound(Sound("physics/wood/wood_plank_break" .. math.random(1,4) .. ".wav"))
self:Remove()
end
end