Files
Hunter/scripts/ArenaClient/HintProviders/HotPoint.luau
T

27 lines
1.3 KiB
Luau

--!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