-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathboneanimlib.lua
More file actions
64 lines (56 loc) · 1.68 KB
/
boneanimlib.lua
File metadata and controls
64 lines (56 loc) · 1.68 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
if CLIENT or GetLuaAnimations ~= nil then return end
include("sh_boneanimlib.lua")
include("sh_mocap.lua")
AddCSLuaFile("cl_boneanimlib.lua")
AddCSLuaFile("sh_boneanimlib.lua")
AddCSLuaFile("cl_animeditor.lua")
AddCSLuaFile("sh_mocap.lua")
AddCSLuaFile("mocap_controller.lua")
hook.Add("Initialize", "BAL_Initialize", function()
util.AddNetworkString("bal_reset")
util.AddNetworkString("bal_set")
util.AddNetworkString("bal_stop")
util.AddNetworkString("bal_stopgroup")
util.AddNetworkString("bal_stopall")
end)
-- These are unreliable. All Lua animations should be set on both the client and server (predicted).
local meta = FindMetaTable("Entity")
if not meta then return end
function meta:ResetLuaAnimation(sAnimation, fTime, fPower, fTimeScale)
net.Start("bal_reset")
net.WriteEntity(self)
net.WriteString(sAnimation)
net.WriteFloat(fTime or -1)
net.WriteFloat(fPower or -1)
net.WriteFloat(fTimeScale or -1)
net.Broadcast()
end
function meta:SetLuaAnimation(sAnimation, fTime, fPower, fTimeScale)
net.Start("bal_set")
net.WriteEntity(self)
net.WriteString(sAnimation)
net.WriteFloat(fTime or -1)
net.WriteFloat(fPower or -1)
net.WriteFloat(fTimeScale or -1)
net.Broadcast()
end
function meta:StopLuaAnimation(sAnimation, fTime)
net.Start("bal_stop")
net.WriteEntity(self)
net.WriteString(sAnimation)
net.WriteFloat(fTime or 0)
net.Broadcast()
end
function meta:StopLuaAnimationGroup(sAnimation, fTime)
net.Start("bal_stopgroup")
net.WriteEntity(self)
net.WriteString(sAnimation)
net.WriteFloat(fTime or 0)
net.Broadcast()
end
function meta:StopAllLuaAnimations(fTime)
net.Start("bal_stopall")
net.WriteEntity(self)
net.WriteFloat(fTime or 0)
net.Broadcast()
end