aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/animation/sv_animate.lua
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/core/animation/sv_animate.lua')
-rw-r--r--gamemode/core/animation/sv_animate.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/gamemode/core/animation/sv_animate.lua b/gamemode/core/animation/sv_animate.lua
index 24d0ed0..b8cec56 100644
--- a/gamemode/core/animation/sv_animate.lua
+++ b/gamemode/core/animation/sv_animate.lua
@@ -5,6 +5,8 @@ local meta = FindMetaTable("Player")
util.AddNetworkString("art_start_animation")
util.AddNetworkString("art_stop_animation")
+util.AddNetworkString("art_start_sequence")
+util.AddNetworkString("art_end_sequence")
function meta:StartAnimation(name)
net.Start("art_start_animation")
@@ -19,3 +21,34 @@ function meta:StopAnimation(name)
net.WriteString(name)
net.Broadcast()
end
+
+local sequences = {}
+
+function meta:StartSequence(name,untilstoped,speed)
+ untilstoped = untilstoped or false
+ speed = speed or 1
+ local seq, time = self:LookupSequence(name)
+ sequences[self] = sequences[self] or {}
+ if untilstoped then
+ sequences[self] = {CurTime() + 9999999, seq, speed}
+ else
+ sequences[self] = {CurTime() + time, seq, speed}
+ end
+ self:SetCycle(0)
+ net.Start("art_start_sequence")
+ net.WriteEntity(self)
+ net.WriteUInt(seq,31)
+ net.WriteFloat(time)
+ net.WriteBool(untilstoped)
+ net.WriteFloat(speed)
+ net.Broadcast()
+end
+
+function meta:EndSequence(name)
+ sequences[self] = nil
+ net.Start("art_end_sequence")
+ net.WriteEntity(self)
+ net.Broadcast()
+end
+
+return sequences