aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/animation/cl_animate.lua
blob: 4b862342fd7d4530a1a020b3f85032dcadc3cd45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--- Client side of the animation subsystem
-- Stores the code to run animations client side.
-- Also see @{sh_animations.lua} and @{sv_animate.lua}
-- @client cl_animate.lua

net.Receive("art_start_animation",function()
	local what = net.ReadEntity()
	local anim = net.ReadString()
	what:SetupBones()
	what:SetLuaAnimation(anim)
end)

net.Receive("art_stop_animation",function()
	local what = net.ReadEntity()
	local anim = net.ReadString()
	what:StopLuaAnimation(anim)
end)

--- All visible players and their sequences.
-- @table sequences
-- Stores all the sequences for all visible players
local sequences = {}
net.Receive("art_start_sequence",function()
	local who = net.ReadEntity()
	local seq = net.ReadUInt(31)
	local time = net.ReadFloat()
	local untilstoped = net.ReadBool()
	local speed = net.ReadFloat()
	sequences[who] = sequences[who] or {}
	who:SetCycle(0)
	if untilstoped then
		sequences[who] = {CurTime() + 9999999, seq, speed}
	else
		sequences[who] = {CurTime() + time, seq, speed}
	end
end)

net.Receive("art_end_sequence",function()
	local who = net.ReadEntity()
	sequences[who] = nil
end)

return sequences