Polish Domination zone control and HUD

This commit is contained in:
Leshyi committed 2026-11-29 23:54:18 +05:00
1 parent c0b099e604
commit d3648c485b
9 files changed
+271 -13

No files matched your search

+62 -2
View File
@@ -161,6 +161,36 @@ siegeBar.BackgroundColor3 = Color3.fromRGB(34, 45, 65)
siegeBar.BorderSizePixel = 0
siegeBar.Visible = false
siegeBar.Parent = objective
local dominationChips = Instance.new("Frame")
dominationChips.Name = "DominationChips"
dominationChips.Position = UDim2.fromOffset(15, 88)
dominationChips.Size = UDim2.new(1, -30, 0, 40)
dominationChips.BackgroundTransparency = 1
dominationChips.Visible = false
dominationChips.Parent = objective
local domSlots: {[string]: {chip: GuiObject, text: TextLabel, ticks: {Frame}}} = {}
for i, key in {"A", "B", "C"} do
local chip = UI.element("ScoreChip", dominationChips, UDim2.new((i - 1) / 3, 0, 0, 0), UDim2.new(1 / 3, -6, 0, 25))
local templateValue = chip:FindFirstChild("Value")
if templateValue and templateValue:IsA("TextLabel") then templateValue.Visible = false end
local text = UI.label(chip, "Zone", key, UDim2.new(), UDim2.fromScale(1, 1), 17, ink)
local ticks: {Frame} = {}
for segment = 1, 10 do
local angle = (segment - 1) * math.pi / 5 - math.pi / 2
local dot = Instance.new("Frame")
dot.Name = "CaptureProgress"
dot.AnchorPoint = Vector2.new(.5, .5)
dot.Position = UDim2.new(.5, math.cos(angle) * 12, .5, math.sin(angle) * 10)
dot.Size = UDim2.fromOffset(3, 3)
dot.BorderSizePixel = 0
dot.Visible = false
dot.Parent = chip
Instance.new("UICorner", dot).CornerRadius = UDim.new(1, 0)
table.insert(ticks, dot)
end
domSlots[key] = {chip = chip, text = text, ticks = ticks}
end
local rateLabel = UI.label(dominationChips, "ScoreRate", "", UDim2.fromOffset(0, 26), UDim2.new(1, 0, 0, 17), 13, muted)
local siegeSteps = UI.label(objective, "SiegeSteps", "", UDim2.fromOffset(16, 96), UDim2.new(1, -32, 0, 22), 15, UI.Gold)
siegeSteps.Visible = false
local siegeChip = UI.label(objective, "SiegeChip", "", UDim2.fromOffset(16, 119), UDim2.new(1, -32, 0, 21), 14, UI.Mint)
@@ -415,6 +445,7 @@ local function refreshObjective()
local needsLayout = visible ~= objective.Visible
objective.Visible = visible
siegeBar.Visible, siegeSteps.Visible, siegeChip.Visible = false, false, false
dominationChips.Visible = false
if visible then
local rule = Rules.get(match:GetAttribute("Ruleset"))
local accent = if player:GetAttribute("ArenaTeam") == "Orange" then orange else blue
@@ -469,6 +500,26 @@ local function refreshObjective()
siegeChip.TextColor3 = if zone == "Inside" then UI.Mint else UI.Gold
end
end
if rule.id == "Domination" then
dominationChips.Visible = true
for key, slot in domSlots do
local owner = match:GetAttribute("ZoneOwner_" .. key)
local claimant = match:GetAttribute("ZoneClaim_" .. key)
local progress = (match:GetAttribute("ZoneProgress_" .. key) :: number?) or 0
local ownerTint = if owner == "Blue" then blue elseif owner == "Orange" then orange else muted
slot.text.TextColor3 = ownerTint
slot.chip.BackgroundColor3 = panelColor:Lerp(ownerTint, .28)
for i, tick in slot.ticks do
tick.Visible = typeof(claimant) == "string"
tick.BackgroundColor3 = if claimant == "Blue" then blue else orange
tick.BackgroundTransparency = if progress + 1e-7 >= i / 10 then 0 else .8
end
end
rateLabel.Text = string.format("СИНИЕ +%d/с ОРАНЖЕВЫЕ +%d/с",
(match:GetAttribute("ScoreRate_Blue") :: number?) or 0, (match:GetAttribute("ScoreRate_Orange") :: number?) or 0)
end
local modeHint = playerGui:GetAttribute("ModeHint")
if rule.id ~= "Siege" and typeof(modeHint) == "string" then text = modeHint end
local tokens = (player:GetAttribute("ArenaTokens") :: number?) or 0
if player:GetAttribute("ArenaFlag") then text = "У вас флаг · Несите его на свою базу"
elseif tokens > 0 then text = "Жетонов у вас: " .. tokens .. " · Вернитесь на базу"
@@ -477,7 +528,7 @@ local function refreshObjective()
objectiveStatus.Visible = text ~= ""
objectiveStatus.Text = text
objectiveStatus.TextColor3 = accent:Lerp(ink, .3)
local height = if siegeBar.Visible then 145 elseif objectiveStatus.Visible then 88 else 62
local height = if siegeBar.Visible then 145 elseif dominationChips.Visible then 133 elseif objectiveStatus.Visible then 88 else 62
if height ~= objective.Size.Y.Offset then
objective.Size = UDim2.fromOffset(widthOfCard, height)
needsLayout = true
@@ -1031,7 +1082,7 @@ local function updateClock()
lastSecond, lastPhase, lastTeam, lastMode, lastInArena = seconds, phase, team, arenaMode, inArena
lastStage = stage
local rule = Rules.get(activeState():GetAttribute("Ruleset"))
if rule.id == "Siege" and inArena then refreshObjective() end
if inArena and (rule.id == "Siege" or rule.id == "Domination") then refreshObjective() end
mode.Visible = true
mode.Text = if intro then RoundStrings.untilStart elseif stage == "RoleSwap" then RoundStrings.swap elseif phase == "Vote" then "ГОЛОСОВАНИЕ" elseif phase == "Reveal" then "ДО НАЧАЛА РАУНДА"
elseif phase == "Break" then (if activeState():GetAttribute("AllowModeChange") == false then "ДО НАЧАЛА РАУНДА" else "ДО ГОЛОСОВАНИЯ")
@@ -1061,11 +1112,20 @@ local function updateClock()
clockMotion:Play()
refreshControls()
end
local domConnections: {RBXScriptConnection} = {}
for _, key in {"A", "B", "C"} do
for _, attr in {"ZoneProgress_", "ZoneOwner_", "ZoneClaim_"} do
table.insert(domConnections, activeState():GetAttributeChangedSignal(attr .. key):Connect(refreshObjective))
end
end
local modeHintConnection = playerGui:GetAttributeChangedSignal("ModeHint"):Connect(refreshObjective)
local siegeHintConnection = playerGui:GetAttributeChangedSignal("SiegeHint"):Connect(refreshObjective)
local timerConnection = RunService.Heartbeat:Connect(updateClock)
script.Destroying:Once(function()
timerConnection:Disconnect()
siegeHintConnection:Disconnect()
modeHintConnection:Disconnect()
for _, connection in domConnections do connection:Disconnect() end
if finalClockPulse then finalClockPulse:Cancel() end
votingChanged:Disconnect()
scoreboardFocus:Disconnect()