Add round stages, respawn protection and match highlights

This commit is contained in:
Leshyi committed 2026-11-29 23:29:29 +05:00
1 parent b87a3770a1
commit d1c42a36b8
28 files changed
+753 -45

No files matched your search

+14 -2
View File
@@ -3,6 +3,7 @@
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Modes = require(ReplicatedStorage:WaitForChild("ArenaModes") :: ModuleScript)
local RoundConfig = require(ReplicatedStorage:WaitForChild("Hunter"):WaitForChild("RoundConfig") :: ModuleScript)
local random = Random.new()
local ArenaSpawns = {}
@@ -20,24 +21,35 @@ function ArenaSpawns.choose(player: Player): SpawnLocation
assert(#choices > 0, arena.Name .. " has no enabled spawns for this team")
local best = choices[random:NextInteger(1, #choices)]
local bestDistance = -1
local bestSafe: SpawnLocation? = nil
local bestSafeScore = -1
for _, marker in choices do
local nearest = 1000
local enemyDistance = math.huge
for _, other in Players:GetPlayers() do
local character = other.Character
local root = character and character:FindFirstChild("HumanoidRootPart")
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
if other ~= player and other:GetAttribute("InArena") == true and Modes.same(player, other)
and root and root:IsA("BasePart") and humanoid and humanoid.Health > 0 then
nearest = math.min(nearest, (root.Position - marker.Position).Magnitude)
local distance = (root.Position - marker.Position).Magnitude
nearest = math.min(nearest, distance)
local otherSide = other:GetAttribute("ArenaTeam")
if otherSide ~= nil and otherSide ~= side and other:GetAttribute("ArenaWaiting") ~= true then
enemyDistance = math.min(enemyDistance, distance)
end
end
end
local score = nearest + random:NextNumber(0, 24)
if enemyDistance >= RoundConfig.safeSpawnDistance and score > bestSafeScore then
bestSafe, bestSafeScore = marker, score
end
if score > bestDistance then
bestDistance = score
best = marker
end
end
return best
return bestSafe or best
end
function ArenaSpawns.place(character: Model, marker: SpawnLocation)