Files
Hunter/scripts/HostedArena.luau
2026-11-29 15:49:17 +03:00

33 lines
1.3 KiB
Luau

--!strict
local Rules = require(script.Parent:WaitForChild("MatchRules") :: ModuleScript)
local HostedArena = {}
HostedArena.InviteSeconds = 35
HostedArena.MaxPlayers = 20
export type Side = "Blue" | "Orange"
export type RoundOptions = {initialMode: string, allowModeChange: boolean}
export type Member = {userId: number, displayName: string}
export type Listing = {id: string, hostId: number, hostName: string, players: number, ruleset: string}
export type Details = {id: string, blue: {Member}, orange: {Member}, players: number}
function HostedArena.readRoundOptions(value: unknown): RoundOptions?
if value == nil then return {initialMode = Rules.Default, allowModeChange = true} end
if typeof(value) ~= "table" or typeof(value.allowModeChange) ~= "boolean" then return nil end
local rule = Rules.find(value.initialMode)
if not rule then return nil end
return {initialMode = rule.id, allowModeChange = value.allowModeChange}
end
function HostedArena.teamJoinError(own: number, other: number): string?
if own >= HostedArena.MaxPlayers // 2 then return "Full" end
if own > other then return "Balance" end
return nil
end
function HostedArena.isReserved(): boolean
return game.PrivateServerId ~= "" and game.PrivateServerOwnerId == 0
end
return table.freeze(HostedArena)