Polish Trophy Hunt pickups and feedback

This commit is contained in:
Leshyi committed 2026-11-30 00:01:06 +05:00
1 parent 9fb926537c
commit 0c949fadf0
10 files changed
+156 -11

No files matched your search

+23 -7
View File
@@ -6,7 +6,9 @@ local Kinds = require(game.ReplicatedStorage.Hunter.EventKinds)
local Strings = require(game.ReplicatedStorage.Hunter.Strings)
type Fighter = Types.Fighter
local HotPoint = require(Runtime.Parent.HotPoint)
type Drop = {marker: Common.Marker, amount: number, expires: number}
local Rules = require(Runtime.TrophyRules)
local TweenService = game:GetService("TweenService")
type Drop = {marker: Common.Marker, amount: number, expires: number, fade: Tween?}
local function start(ctx: Types.ModeContext): Types.ModeInstance
local map, geometry, folder = assert(ctx.map), ctx.geometry, ctx.folder
@@ -21,24 +23,31 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
local floor = floorAt(at)
ctx.events.fire(Kinds.TokenDropped, {at = floor, value = amount})
for _, existing in tokens do
if Common.boundsAt(existing.marker.origin, floor, 3.5, 3) then
if Rules.canMerge(existing.marker.origin, floor) then
existing.amount += amount
existing.expires = now + 42
existing.expires = now + Rules.LIFETIME
if existing.fade then existing.fade:Cancel(); existing.fade = nil end
existing.marker.body.Transparency = .04
existing.marker.label.Text = Strings.tokens(existing.amount)
return
end
end
if #tokens >= 60 then
if #tokens >= Rules.MAX_DROPS then
local old = table.remove(tokens, 1)
if old.fade then old.fade:Cancel() end
old.marker.body:Destroy()
end
table.insert(tokens, {marker = Common.marker(folder, "Tokens", Strings.tokens(amount), floor, Common.gold, 1.55, true), amount = amount, expires = now + 42})
table.insert(tokens, {marker = Common.marker(folder, "Tokens", Strings.tokens(amount), floor, Common.gold, 1.55, true), amount = amount, expires = now + Rules.LIFETIME})
end
local function runTrophies(fighters: {Fighter}, now: number)
for i = #tokens, 1, -1 do
local token = tokens[i]
local collector: Fighter? = nil
if now < token.expires then
if token.expires - now <= Rules.FLASH_SECONDS and not token.fade then
token.fade = TweenService:Create(token.marker.body,TweenInfo.new(.38,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,-1,true),{Transparency=.76})
token.fade:Play()
end
for _, f in fighters do
if Common.boundsAt(f.root.Position, token.marker.origin, 5, 6) and Common.visibleAt(f, token.marker.body.Position, geometry) then collector = f; break end
end
@@ -48,6 +57,7 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
carried[p] = (carried[p] or 0) + token.amount
p:SetAttribute("ArenaTokens", carried[p])
end
if token.fade then token.fade:Cancel() end
token.marker.body:Destroy()
table.remove(tokens, i)
end
@@ -69,7 +79,10 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
if not amount then return end
carried[player] = nil
player:SetAttribute("ArenaTokens", nil)
if at then tokenDrop(at, amount, now) end
if at then
tokenDrop(at, amount, now)
ctx.events.fire(Kinds.TokensLost, {userId=player.UserId,value=amount})
end
end
return Common.instance(ctx, {
step = function(now, _, fighters) runTrophies(fighters, now); return false end,
@@ -77,7 +90,10 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
if Common.sideOf(player) then tokenDrop(at, 1, now) end
end,
death = drop, leaving = drop,
destroy = function() for p in carried do p:SetAttribute("ArenaTokens", nil) end end,
destroy = function()
for p in carried do p:SetAttribute("ArenaTokens", nil) end
for _, token in tokens do if token.fade then token.fade:Cancel() end end
end,
})
end