Files

36 lines
1.8 KiB
Luau

--!strict
local rs=game:GetService("ReplicatedStorage")
local H=require(rs.Hunter.Hints)
local S=require(rs.Hunter.Strings).leaderHints
local Provider={}
local function sides(player: Player): (string,string)
if player:GetAttribute("ArenaTeam")=="Orange" then return "Orange","Blue" end
return "Blue","Orange"
end
function Provider.candidates(match: Instance, player: Player): {H.Hint}
if player:GetAttribute("ArenaLeader")==true then return {{key="hl_self",text=S.self,priority=80,ttl=.4}} end
local own,enemy=sides(player)
local ally=match:GetAttribute("LeaderName_"..own)
local opponent=match:GetAttribute("LeaderName_"..enemy)
local root=player.Character and player.Character.PrimaryPart
local target=match:GetAttribute("LeaderPosition_"..enemy)
local nearby=root and typeof(target)=="Vector3" and (root.Position-target).Magnitude<95
if typeof(opponent)=="string" and (nearby or typeof(ally)~="string") then
return {{key="hl_enemy",text=string.format(S.enemy,opponent),priority=60,ttl=.4}}
end
if typeof(ally)=="string" then return {{key="hl_ally",text=string.format(S.ally,ally),priority=50,ttl=.4}} end
return {}
end
function Provider.target(match: Instance, player: Player): (Vector3?,string?,string?)
if player:GetAttribute("ArenaLeader")==true then return nil end
local own=sides(player)
local point=match:GetAttribute("LeaderPosition_"..own)
local name=match:GetAttribute("LeaderName_"..own)
return if typeof(point)=="Vector3" then point else nil, if typeof(name)=="string" then string.format(S.ally,name) else nil, own
end
function Provider.highlight(_match: Instance, viewer: Player, member: Player): boolean
return member:GetAttribute("InArena")==true and member:GetAttribute("ArenaLeader")==true
and member:GetAttribute("ArenaTeam")~=viewer:GetAttribute("ArenaTeam")
end
return Provider