Polish Capture the Flag navigation and feedback
This commit is contained in:
1 parent
522344e34b
commit
9fb926537c
8 files changed
+203
-5
No files matched your search
@@ -0,0 +1,36 @@
|
||||
--!strict
|
||||
local rs = game:GetService("ReplicatedStorage")
|
||||
local S = require(rs.Hunter.Strings).flagHints
|
||||
local H = require(rs.Hunter.Hints)
|
||||
local Provider = {}
|
||||
|
||||
function Provider.candidates(match: Instance, player: Player): {H.Hint}
|
||||
local side = match:GetAttribute("FlagCarrierSide")
|
||||
local at = match:GetAttribute("FlagReturnAt")
|
||||
local own = player:GetAttribute("ArenaTeam")
|
||||
local key, text, priority = "flag_roof", S.roof, 30
|
||||
if player:GetAttribute("ArenaFlag") == true then key,text,priority = "flag_deliver",S.deliver,90
|
||||
elseif typeof(side) == "string" and side ~= own then key,text,priority = "flag_enemy",S.enemy,80
|
||||
elseif side == own and typeof(side) == "string" then key,text,priority = "flag_escort",S.escort,60
|
||||
elseif typeof(at) == "number" then
|
||||
key,text,priority = "flag_drop",string.format(S.dropped,math.max(0,math.ceil(at-workspace:GetServerTimeNow()))),70
|
||||
end
|
||||
return {{key=key,text=text,priority=priority,ttl=.4}}
|
||||
end
|
||||
|
||||
function Provider.target(match: Instance, player: Player): (Vector3?, string?, string?)
|
||||
local own = player:GetAttribute("ArenaTeam")
|
||||
if player:GetAttribute("ArenaFlag") == true and typeof(own) == "string" then
|
||||
local base = match:GetAttribute("FlagBase_" .. own)
|
||||
return if typeof(base) == "Vector3" then base else nil, S.base, own
|
||||
end
|
||||
local point = match:GetAttribute("FlagPosition")
|
||||
local carrierSide = match:GetAttribute("FlagCarrierSide")
|
||||
local name = if carrierSide == own and typeof(carrierSide) == "string" then S.escortTitle else S.title
|
||||
return if typeof(point) == "Vector3" then point else nil, name, if typeof(carrierSide) == "string" then carrierSide else nil
|
||||
end
|
||||
|
||||
function Provider.highlight(_match: Instance, _viewer: Player, member: Player): boolean
|
||||
return member:GetAttribute("ArenaFlag") == true
|
||||
end
|
||||
return Provider
|
||||
Reference in new issue
Block a user