Polish Hot Point progress and guidance
This commit is contained in:
1 parent
d3648c485b
commit
522344e34b
9 files changed
+87
-15
No files matched your search
BIN
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
--!strict
|
||||
local rs = game:GetService("ReplicatedStorage")
|
||||
local Hints = require(rs.Hunter.Hints)
|
||||
local S = require(rs.Hunter.Strings).hotHints
|
||||
local taught = setmetatable({}, {__mode = "k"})
|
||||
local Provider = {}
|
||||
function Provider.candidates(match: Instance, player: Player): {Hints.Hint}
|
||||
local out: {Hints.Hint} = {}
|
||||
local function add(key: string, text: string, priority: number, ttl: number?)
|
||||
table.insert(out,{key=key,text=text,priority=priority,ttl=ttl or .4})
|
||||
end
|
||||
local phase = match:GetAttribute("HotPointPhase")
|
||||
local point = match:GetAttribute("HotPointPosition")
|
||||
local movesAt = match:GetAttribute("HotPointMovesAt")
|
||||
local left = if typeof(movesAt) == "number" then math.ceil(movesAt - workspace:GetServerTimeNow()) else 0
|
||||
if phase == "Captured" then add("hp_capture", string.format(S.captured,math.max(0,left)),90)
|
||||
elseif left > 0 and left <= 5 then add("hp_next",string.format(S.next,left),85)
|
||||
elseif phase == "UnderFire" and match:GetAttribute("HotPointTeam") == player:GetAttribute("ArenaTeam") then add("hp_fire",S.fire,60)
|
||||
elseif typeof(point) == "Vector3" and not phase then add("hp_enter",S.enter,40)
|
||||
elseif phase == "Capturing" and not taught[player] and match:GetAttribute("HotPointTeam") == player:GetAttribute("ArenaTeam") then
|
||||
taught[player] = true
|
||||
add("hp_team",S.team,20,4)
|
||||
end
|
||||
return out
|
||||
end
|
||||
return Provider
|
||||
@@ -253,7 +253,7 @@ countdown.Visible = false
|
||||
local allyCapture = Color3.fromRGB(90, 247, 170)
|
||||
local enemyCapture = Color3.fromRGB(255, 79, 105)
|
||||
local captureHud = UI.plate(hudLayout, "HotPointCapture", UDim2.new(.5, 0, 0, 10), UDim2.fromOffset(384, 52), UI.Outline)
|
||||
captureHud.AnchorPoint, captureHud.Visible = Vector2.new(.5, 0), false
|
||||
captureHud.AnchorPoint, captureHud.Visible = Vector2.new(.5, 1), false
|
||||
local captureArc = UI.contour(captureHud, allyCapture)
|
||||
local captureLabel = UI.label(captureHud, "Status", "", UDim2.fromOffset(14, 5), UDim2.new(1, -77, 0, 24), 15, ink)
|
||||
captureLabel.FontFace = UI.Display
|
||||
@@ -265,7 +265,17 @@ local captureTrack = UI.element("ProgressBar", captureHud, UDim2.fromOffset(14,
|
||||
captureTrack.Name = "CaptureProgress"
|
||||
local captureFill = captureTrack:WaitForChild("Fill") :: Frame
|
||||
captureFill.Size = UDim2.fromScale(0, 1)
|
||||
UI.sheen(captureFill)
|
||||
captureFill.Visible = false
|
||||
local hotSegments: {Frame} = {}
|
||||
for i = 1, 10 do
|
||||
local segment = Instance.new("Frame")
|
||||
segment.Name = "CaptureSegment"
|
||||
segment.Position = UDim2.fromScale((i-1)/10, 0)
|
||||
segment.Size = UDim2.new(.1, -2, 1, 0)
|
||||
segment.BorderSizePixel = 0
|
||||
segment.Parent = captureTrack
|
||||
table.insert(hotSegments, segment)
|
||||
end
|
||||
local captureTween: Tween? = nil
|
||||
local captureTeam: string? = nil
|
||||
local capturePercent = 0
|
||||
@@ -388,9 +398,7 @@ local function fitHud()
|
||||
badge.killSize.MaxTextSize = if packed then 17 else 23
|
||||
end
|
||||
local bottom = top + (if rowCount > 0 then height * scoreScale.Scale else 0)
|
||||
local minimumTop = if countdown.Visible then 119 else 10
|
||||
local captureTop = if width >= 1200 then minimumTop else math.max(minimumTop, bottom + 8)
|
||||
captureHud.Position = UDim2.new(.5, 0, 0, captureTop)
|
||||
captureHud.Position = UDim2.new(.5, 0, 1, -83)
|
||||
captureHud.Size = UDim2.fromOffset(math.floor(math.min(384, width - 24)), 52)
|
||||
gui:SetAttribute("ContentBottom", if width >= 700 then 4 else bottom)
|
||||
end
|
||||
@@ -420,13 +428,17 @@ local function refreshCapture()
|
||||
local accent = if not side then UI.Gold elseif allied then allyCapture else enemyCapture
|
||||
captureHud.Visible = true
|
||||
captureLabel.Text = if phase == "Captured" then "ТОЧКА ЗАХВАЧЕНА · +1"
|
||||
elseif phase == "Contested" then "ТОЧКА ОСПАРИВАЕТСЯ"
|
||||
elseif phase == "UnderFire" then (if allied then "ВАШ ЗАХВАТ ТЕРЯЕТСЯ" else "ЗАХВАТ СОПЕРНИКОВ ПАДАЕТ")
|
||||
elseif allied then "ВАША КОМАНДА ЗАХВАТЫВАЕТ" else "СОПЕРНИКИ ЗАХВАТЫВАЮТ"
|
||||
elseif phase == "Contested" then HunterStrings.hotHints.contest
|
||||
elseif phase == "UnderFire" then HunterStrings.hotHints.underFire
|
||||
elseif allied then HunterStrings.hotHints.taking else "СОПЕРНИКИ ЗАХВАТЫВАЮТ"
|
||||
local percent = math.clamp((match:GetAttribute("HotPointProgress") :: number?) or 0, 0, 100)
|
||||
captureValue.Text, captureValue.TextColor3 = string.format("%d%%", percent), accent
|
||||
captureArc:SetAttribute("Accent", accent)
|
||||
captureFill.BackgroundColor3 = accent
|
||||
for i, segment in hotSegments do
|
||||
segment.BackgroundColor3 = accent
|
||||
segment.BackgroundTransparency = if percent >= i * 10 then 0 else .85
|
||||
end
|
||||
if percent == capturePercent and side == captureTeam then return end
|
||||
if captureTween then captureTween:Cancel() end
|
||||
local size = UDim2.fromScale(percent / 100, 1)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
--!strict
|
||||
local TweenService = game:GetService("TweenService")
|
||||
local Credit = require(script.Parent.ModeRuntime.HotPointCredit)
|
||||
local Sites = require(script.Parent:WaitForChild("ArenaObjectiveSites") :: ModuleScript)
|
||||
|
||||
type Side = "Blue" | "Orange"
|
||||
@@ -248,11 +249,8 @@ function HotPoint.start(config: Config): Capture
|
||||
end
|
||||
local underFire = now < hitUntil
|
||||
local damageTime = math.max(0, math.min(now, hitUntil) - math.max(now - dt, hitSince))
|
||||
if damageTime > 0 then credit = math.max(0, credit - damageTime * HIT_DECAY) end
|
||||
if not isContested then
|
||||
local count = if side == "Blue" then blue else orange
|
||||
credit += (dt - damageTime) * (if count >= 2 then TEAM_SPEED else 1)
|
||||
end
|
||||
credit = Credit.advance(credit, dt, damageTime, HIT_DECAY, if count >= 2 then TEAM_SPEED else 1, isContested)
|
||||
if credit >= CAPTURE_SECONDS then
|
||||
capturedSide, capturedAt = side, now
|
||||
movesAt = now + COLLAPSE_SECONDS + CAPTURE_NOTICE_SECONDS + NEXT_POINT_WARNING_SECONDS
|
||||
|
||||
@@ -19,7 +19,7 @@ gui.DisplayOrder = 25
|
||||
gui.Enabled = false
|
||||
gui.Parent = playerGui
|
||||
|
||||
local panel = UI.plate(gui, "Direction", UDim2.fromScale(.5, .78), UDim2.new(.85, 0, 0, 60), UI.Outline)
|
||||
local panel = UI.plate(gui, "Direction", UDim2.fromScale(.5, .68), UDim2.new(.85, 0, 0, 60), UI.Outline)
|
||||
panel.AnchorPoint = Vector2.new(.5, .5)
|
||||
local sizeLimit = Instance.new("UISizeConstraint")
|
||||
sizeLimit.MaxSize = Vector2.new(326, 60)
|
||||
|
||||
@@ -48,6 +48,14 @@ local domination = table.freeze({
|
||||
hold = function(n: number) return string.format("Держите точки — +%d очков в секунду.", n) end,
|
||||
control = "ПОЛНЫЙ КОНТРОЛЬ",
|
||||
})
|
||||
local hotHints = table.freeze({
|
||||
enter = "Зайдите в круг — захват занимает 10 секунд.",
|
||||
team = "С союзником захват быстрее в 1,5 раза.",
|
||||
fire = "Вас обстреливают — прогресс откатывается.",
|
||||
next = "Новая точка через %d с — приготовьтесь.",
|
||||
captured = "Точка захвачена — следующая через %d с.",
|
||||
contest = "ОСПАРИВАЕТСЯ", underFire = "ПОД ОГНЁМ", taking = "ЗАХВАТ · С СОЮЗНИКОМ ×1,5",
|
||||
})
|
||||
local function flagCarrier(name: string): string return name .. " несёт флаг" end
|
||||
local round = table.freeze({
|
||||
mode = "РЕЖИМ", fight = "В БОЙ!", final = "ФИНАЛЬНЫЙ РЫВОК", swap = "СМЕНА РОЛЕЙ",
|
||||
@@ -80,6 +88,7 @@ return table.freeze({
|
||||
round = round,
|
||||
studs = studs,
|
||||
domination = domination,
|
||||
hotHints = hotHints,
|
||||
hint = table.freeze({Siege = siegeHints}),
|
||||
team = team, clock = clock,
|
||||
bases = table.freeze({Blue = "БАЗА СИНИХ", Orange = "БАЗА ОРАНЖЕВЫХ"}),
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
--!strict
|
||||
local Credit = {}
|
||||
function Credit.advance(value: number, elapsed: number, underFire: number, decay: number, speed: number, contested: boolean): number
|
||||
if underFire > 0 then value = math.max(0, value - underFire * decay) end
|
||||
if not contested then value += (elapsed - underFire) * speed end
|
||||
return value
|
||||
end
|
||||
return table.freeze(Credit)
|
||||
@@ -9,6 +9,8 @@ local Sites = require(Runtime.Parent.ArenaObjectiveSites)
|
||||
|
||||
local function start(ctx: Types.ModeContext): Types.ModeInstance
|
||||
local path = Sites.hotPath(ctx.arena, assert(ctx.map), HotPoint.Radius)
|
||||
local nowAt = ctx.liveAt
|
||||
local wasContested = false
|
||||
local capture = HotPoint.start({
|
||||
state = ctx.state, geometry = ctx.geometry, sites = path, startedAt = ctx.liveAt,
|
||||
marker = function(site)
|
||||
@@ -17,12 +19,21 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
|
||||
end,
|
||||
score = function(side, points)
|
||||
ctx.scoring.add(side, points, Kinds.ZoneCaptured)
|
||||
ctx.events.fire(Kinds.ZoneCaptured, {side = side, text = Strings.hotPoint})
|
||||
ctx.events.fire(Kinds.ZoneCaptured, {side = side, text = Strings.hotPoint, value = nowAt - ctx.liveAt})
|
||||
end,
|
||||
status = ctx.status, contribute = ctx.contribute,
|
||||
})
|
||||
return Common.instance(ctx, {
|
||||
step = function(now, dt, fighters, elapsed) capture.step(fighters, now, elapsed or dt); return false end,
|
||||
step = function(now, dt, fighters, elapsed)
|
||||
nowAt = now
|
||||
capture.step(fighters, now, elapsed or dt)
|
||||
local contested = ctx.state:GetAttribute("HotPointPhase") == "Contested"
|
||||
if contested and not wasContested then
|
||||
ctx.events.fire(Kinds.ZoneContested, {text = Strings.hotPoint})
|
||||
end
|
||||
wasContested = contested
|
||||
return false
|
||||
end,
|
||||
hit = capture.hit, death = capture.death, leaving = capture.death, destroy = capture.destroy,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
--!strict
|
||||
return function(credit: any)
|
||||
assert(credit.advance(0, 1, 0, .8, 1, false) == 1)
|
||||
assert(credit.advance(0, 1, 0, .8, 1.5, false) == 1.5)
|
||||
assert(credit.advance(4, 2, 0, .8, 1, true) == 4)
|
||||
assert(credit.advance(.1, 1, .75, .8, 1, true) == 0)
|
||||
assert(math.abs(credit.advance(1, 1, .5, .8, 1.5, false) - 1.35) < 1e-6)
|
||||
end
|
||||
Reference in new issue
Block a user