mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
3591 individual conflicts Update build.js Update install_node.sh Update byond.js oh my fucking god hat slow huh holy shit we all fall down 2 more I missed 2900 individual conflicts 2700 Individual conflicts replaces yarn file with tg version, bumping us down to 2200-ish Down to 2000 individual conflicts 140 down mmm aaaaaaaaaaaaaaaaaaa not yt 575 soon 900 individual conflicts 600 individual conflicts, 121 file conflicts im not okay 160 across 19 files 29 in 4 files 0 conflicts, compiletime fix time some minor incap stuff missed ticks weird dupe definition stuff missed ticks 2 incap fixes undefs and pie fix Radio update and some extra minor stuff returns a single override no more dupe definitions, 175 compiletime errors Unticked file fix sound and emote stuff honk and more radio stuff
49 lines
1.3 KiB
Lua
49 lines
1.3 KiB
Lua
local SS13 = require("SS13")
|
|
local HandlerGroup = {}
|
|
HandlerGroup.__index = HandlerGroup
|
|
|
|
function HandlerGroup.new()
|
|
return setmetatable({
|
|
registered = {},
|
|
}, HandlerGroup)
|
|
end
|
|
|
|
-- Registers a signal on a datum for this handler group instance.
|
|
function HandlerGroup:register_signal(datum, signal, func)
|
|
local registered_successfully = SS13.register_signal(datum, signal, func)
|
|
if not registered_successfully then
|
|
return
|
|
end
|
|
table.insert(self.registered, { datum = datum, signal = signal, func = func })
|
|
end
|
|
|
|
-- Clears all the signals that have been registered on this HandlerGroup
|
|
function HandlerGroup:clear()
|
|
for _, data in self.registered do
|
|
if not data.func or not SS13.is_valid(data.datum) then
|
|
continue
|
|
end
|
|
SS13.unregister_signal(data.datum, data.signal, data.func)
|
|
end
|
|
table.clear(self.registered)
|
|
end
|
|
|
|
-- Clears all the signals that have been registered on this HandlerGroup when a specific signal is sent on a datum.
|
|
function HandlerGroup:clear_on(datum, signal, func)
|
|
SS13.register_signal(datum, signal, function(...)
|
|
if func then
|
|
func(...)
|
|
end
|
|
self:clear()
|
|
end)
|
|
end
|
|
|
|
-- Registers a signal on a datum and clears it after it is called once.
|
|
function HandlerGroup.register_once(datum, signal, func)
|
|
local callback = HandlerGroup.new()
|
|
callback:clear_on(datum, signal, func)
|
|
return callback
|
|
end
|
|
|
|
return HandlerGroup
|