Refactor arena modes and add objective event feed
This commit is contained in:
1 parent
df6ab8efe1
commit
b87a3770a1
26 files changed
+1221
-654
No files matched your search
@@ -0,0 +1,24 @@
|
||||
--!strict
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local Players = game:GetService("Players")
|
||||
local Types = require(script.Parent.Types)
|
||||
local existing = ReplicatedStorage:FindFirstChild("ArenaObjectiveEvent")
|
||||
local remote = if existing and existing:IsA("RemoteEvent") then existing else Instance.new("RemoteEvent")
|
||||
remote.Name = "ArenaObjectiveEvent"
|
||||
remote.Parent = ReplicatedStorage
|
||||
local Events = {}
|
||||
|
||||
function Events.new(members: () -> {Player}): Types.Events
|
||||
return {fire = function(kind, payload, audience)
|
||||
local packet = table.clone(payload or {}) :: {[string]: any}
|
||||
packet.t = workspace:GetServerTimeNow()
|
||||
for _, player in members() do
|
||||
if player.Parent ~= Players then continue end
|
||||
local side = player:GetAttribute("ArenaTeam")
|
||||
local want = audience == nil or audience == "All" or audience == side
|
||||
if not want and typeof(audience) == "table" then want = table.find(audience, player) ~= nil end
|
||||
if want then remote:FireClient(player, kind, packet) end
|
||||
end
|
||||
end}
|
||||
end
|
||||
return Events
|
||||
Reference in new issue
Block a user