blob: 60b71c19a03372fc3afd8a0e892edd117656ed23 (
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
|
---A registry of client-side effects.
-- Use this to register effects to be called with sv_effects.lua
--@client cl_effects.lua
local log = nrequire("log.lua")
local er = {} --master table of effects
local effects = {}
---Register an effect.
-- Registers an effect that can later be applied to the player
--@tparam string name The name of the effect
--@tparam function func The function to call when the effect is applied
function er.RegisterEffect(name,func)
if effects[name] ~= nil then
log.warn("Effect \"" .. name .. "\" already registered, replaceing...")
end
effects[name] = func
end
er.RegisterEffect("weapon_blocked",function(data)
util.ScreenShake( LocalPlayer():GetPos(), 3, 3, 0.25, 100 )
end)
net.Receive("art_clienteffect",function()
local effectname = net.ReadString()
local effectdata = net.ReadData(net.ReadUInt(32))
log.debug("Got effect name",effectname)
effects[effectname](effectdata)
end)
return er
|