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

+11 -1
View File
@@ -48,6 +48,7 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
local half = SiegeConfig.ATTACK_DURATION
local elapsed = now - ctx.liveAt
if elapsed >= half and not hadSiegeSwap then
ctx.setStage("RoleSwap", ctx.liveAt + half + SiegeConfig.SWAP_FREEZE)
hadSiegeSwap = true
for _, z in zones do z.marker.body.Parent = nil end
siegeSide, siegeIndex, siegeProgress = Common.opposite(siegeSide), 1, 0
@@ -76,6 +77,7 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
ctx.status(Strings.siegeSwap)
return false
end
if state:GetAttribute("RoundStage") == "RoleSwap" then ctx.setStage("Live") end
local attacker = Strings.team(siegeSide)
local zone = zones[siegeIndex]
data:SetAttribute("Index", siegeIndex)
@@ -87,10 +89,17 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
end
zone.marker.body.Parent = folder
local attack, defense = false, false
local attackers: {Player} = {}
for _, fighter in fighters do
local reason = Zones.classify(fighter.root.Position, zone.site.position, SPEC, geometry)
if reason == "Inside" then
if fighter.side == siegeSide then attack = true else defense = true end
ctx.contribute(fighter.player, "holdSeconds", dt)
if fighter.side == siegeSide then
attack = true
table.insert(attackers, fighter.player)
else
defense = true
end
end
fighter.player:SetAttribute("CitadelZone", reason)
end
@@ -114,6 +123,7 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
Common.paint(zone.marker, if phase == "Contested" then Common.orange else Common.blue)
if phase ~= "Captured" or not Score.record(siegeTimes, siegeSide, siegeIndex, elapsed - attackStart) then return false end
ctx.scoring.add(siegeSide, SiegeConfig.POINTS_PER_OBJECTIVE, Kinds.ZoneCaptured)
for _, player in attackers do ctx.contribute(player, "captures", 1) end
ctx.events.fire(Kinds.ZoneCaptured, {side = siegeSide, index = siegeIndex, text = zone.site.name, value = elapsed - attackStart})
ctx.cue(fighters, true, nil)
siegeCaptureStarted = false