aboutsummaryrefslogtreecommitdiff
path: root/entities
diff options
context:
space:
mode:
authorAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-03-07 16:52:07 -0500
committerAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-03-07 16:52:07 -0500
commit10ef2a646da0b67d5c1baaed9ac4b0b17a800a98 (patch)
tree036fce3d01ddeb3b7f960a214b38a9371c57508f /entities
parent154aa39e820b32878a514c3cf1410043d26fcc08 (diff)
downloadwintersurvival2-10ef2a646da0b67d5c1baaed9ac4b0b17a800a98.tar.gz
wintersurvival2-10ef2a646da0b67d5c1baaed9ac4b0b17a800a98.tar.bz2
wintersurvival2-10ef2a646da0b67d5c1baaed9ac4b0b17a800a98.zip
Cleanued up crow code
Diffstat (limited to 'entities')
-rw-r--r--entities/entities/ws_pigeon/cl_init.lua56
1 files changed, 36 insertions, 20 deletions
diff --git a/entities/entities/ws_pigeon/cl_init.lua b/entities/entities/ws_pigeon/cl_init.lua
index 8ac0557..da6e4a8 100644
--- a/entities/entities/ws_pigeon/cl_init.lua
+++ b/entities/entities/ws_pigeon/cl_init.lua
@@ -8,27 +8,43 @@ function ENT:Initialize()
self.Player = NULL
self.Seq = -1
self.Rate = 1
-
- self.AutomaticFrameAdvance = true
-
- timer.Simple(0.5,function() if (IsValid(self)) then self:InitializeOwner() end end)
+
+ self.AutomaticFrameAdvance = true
+
+ timer.Simple(0.5,function()
+ if (IsValid(self)) then
+ self:InitializeOwner()
+ end
+ end)
end
function ENT:InitializeOwner()
for k,v in pairs(player.GetAll()) do
- if (IsValid(v.Pigeon) and v.Pigeon == self) then self.Player = v v.DeathPos = nil return end
+ if (IsValid(v.Pigeon) and v.Pigeon == self) then
+ self.Player = v
+ v.DeathPos = nil
+ return
+ end
end
-
- timer.Simple(0.5,function() if (IsValid(self)) then self:InitializeOwner() end end)
+
+ timer.Simple(0.5,function()
+ if (IsValid(self)) then
+ self:InitializeOwner()
+ end
+ end)
end
function ENT:OnRemove()
if (IsValid(self.Player)) then
- self.Player.DeathPos = self:GetPos()
+ self.Player.DeathPos = self:GetPos()
local Rag = self:BecomeRagdollOnClient( )
local Phy = Rag:GetPhysicsObject()
Phy:ApplyForceCenter(self:GetVelocity()*Phy:GetMass()*12)
- timer.Simple(3,function() if (IsValid(Rag)) then Rag:Remove() end end)
+ timer.Simple(3,function()
+ if (IsValid(Rag)) then
+ Rag:Remove()
+ end
+ end)
end
end
@@ -36,19 +52,19 @@ function ENT:Think()
local Pos = self:GetPos()
local vel = self:GetVelocity()
local velL = vel:Length()
-
+
local tr = util.TraceLine({
start = Pos,
endpos = Pos - Vector(0,0,12),
filter = self,
})
-
+
local ground = tr.Hit
-
+
if (velL < 16 and !ground) then
self.Seq = 0
self.Rate = 0.7
-
+
elseif (ground) then
if (velL > 30) then
self.Rate = 2
@@ -66,20 +82,20 @@ function ENT:Think()
else
self.Seq = 7
end
-
- if (self:GetSequence() != self.Seq) then self:SetSequence(self.Seq) end
-
+
+ if (self:GetSequence() != self.Seq) then self:SetSequence(self.Seq) end
+
local delta = UnPredictedCurTime()-self.lastdraw
self.lastdraw = UnPredictedCurTime()
-
+
self.Cycle = self.Cycle + delta*self.Rate
if (self.Cycle > 1) then self.Cycle = 0 end
-
+
self:SetCycle(self.Cycle)
end
function ENT:Draw()
if (!IsValid(self.Player)) then return end
-
+
self:DrawModel()
-end \ No newline at end of file
+end