Refactor arena modes and add objective event feed

This commit is contained in:
Leshyi committed 2026-11-29 23:06:14 +05:00
1 parent df6ab8efe1
commit b87a3770a1
26 files changed
+1221 -654

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
--!strict
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remote = ReplicatedStorage:WaitForChild("ArenaObjectiveEvent") :: RemoteEvent
type Handler = (any) -> ()
local handlers: {[string]: {Handler}} = {}
local Router = {}
function Router.on(kind: string, handler: Handler): () -> ()
local list = handlers[kind] or {}
handlers[kind] = list
table.insert(list, handler)
return function()
local index = table.find(list, handler)
if index then table.remove(list, index) end
end
end
remote.OnClientEvent:Connect(function(kind: string, payload: any)
if typeof(payload) ~= "table" then return end
for _, handler in table.clone(handlers[kind] or {}) do task.spawn(handler, payload) end
end)
return Router