--!strict local ArenaModes = {Procedural = "Procedural"} local trace: RaycastParams? = nil function ArenaModes.of(_player: Player): string return ArenaModes.Procedural end function ArenaModes.state(root: Instance, _mode: string): Instance return root:WaitForChild(ArenaModes.Procedural) end function ArenaModes.open(root: Instance, mode: string, now: number): boolean if mode ~= ArenaModes.Procedural then return false end local state = ArenaModes.state(root, mode) local deadline = state:GetAttribute("EndsAt") return state:GetAttribute("Phase") == "Round" and typeof(deadline) == "number" and now < deadline end function ArenaModes.geometry(_mode: string): Model return workspace:WaitForChild("ProceduralArena") :: Model end function ArenaModes.same(player: Player, other: Player): boolean return player:GetAttribute("ArenaMode") == other:GetAttribute("ArenaMode") end function ArenaModes.collision(mode: string): RaycastParams local cached = trace if cached then return cached end local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Include params.FilterDescendantsInstances = {ArenaModes.geometry(mode)} params.IgnoreWater = true params.RespectCanCollide = true trace = params return params end return table.freeze(ArenaModes)