Polish arena effects, audio and diagnostics

This commit is contained in:
Leshyi committed 2026-11-30 01:26:42 +05:00
1 parent 2774e625c1
commit 16a359d4af
28 files changed
+512 -257

No files matched your search

+68 -19
View File
@@ -9,6 +9,10 @@ local S = require(rs.Hunter.Strings)
local Hints = require(rs.Hunter.Hints)
local Kinds = require(rs.Hunter.EventKinds)
local Router = require(script.Parent.EventRouter)
local Vfx = require(script.Parent.ArenaVfx)
local Config = require(rs.Hunter.EffectsConfig)
local Input = game:GetService("UserInputService")
local mobile = Input.TouchEnabled and not Input.KeyboardEnabled
local player = Players.LocalPlayer
local pg = player:WaitForChild("PlayerGui")
@@ -25,13 +29,6 @@ local title = UI.label(banner,"Title","",UDim2.fromScale(.02,0),UDim2.fromScale(
title.FontFace = UI.Display
banner.Visible = false
local wave = Instance.new("Part")
wave.Name = "LocalObjectiveWave"
wave.Shape, wave.Material = Enum.PartType.Cylinder, Enum.Material.Neon
wave.Anchored, wave.CanCollide, wave.CanTouch, wave.CanQuery = true, false, false, false
wave.Transparency = 1
wave.Parent = workspace
local effect: Tween? = nil
local pending: Hints.Hint? = nil
local activeMode: string? = nil
local provider: any = nil
@@ -43,19 +40,53 @@ local function tint(side: string?): Color3
end
local function showWave(at: Vector3, color: Color3)
if effect then effect:Cancel() end
wave.CFrame = CFrame.new(at + Vector3.yAxis*.3) * CFrame.Angles(0, 0, math.pi/2)
wave.Size = Vector3.new(.1,12,12)
wave.Color, wave.Transparency = color, .64
effect = TweenService:Create(wave,TweenInfo.new(.5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),
{Size=Vector3.new(.1,42,42),Transparency=1})
effect:Play()
Vfx.ring(at, 18, color, Config.FeedbackSeconds)
end
local lastFlagAura = 0
local roleColumnAt = 0
local bannerScale = Instance.new("UIScale", banner)
local bannerTween: Tween? = nil
local function adjustScale() bannerScale.Scale = UI.combatScale(gui) end
local resize = gui:GetPropertyChangedSignal("AbsoluteSize"):Connect(adjustScale)
adjustScale()
banner:GetPropertyChangedSignal("Visible"):Connect(function()
if bannerTween then bannerTween:Cancel() end
if not banner.Visible then return end
banner.Position = UDim2.fromScale(.5, .365)
bannerTween = TweenService:Create(banner, TweenInfo.new(Config.BannerMotionSeconds, Enum.EasingStyle.Quart), {Position = UDim2.fromScale(.5, .34)})
bannerTween:Play()
end)
local function event(kind: string, p: any)
if player:GetAttribute("InArena") ~= true or match:GetAttribute("Phase") ~= "Round" then return end
local id = match:GetAttribute("Ruleset")
local tone = tint(p.side)
local at = p.at
if typeof(at) == "Vector3" then
if kind == Kinds.ZoneCaptured and id == "HotPoint" then
Vfx.ring(at, 18, tone, Config.FeedbackSeconds, true)
Vfx.burst(at, tone, 30, true)
elseif kind == Kinds.ZoneCaptured and id == "Siege" then
Vfx.ring(at, 11, tone, Config.FeedbackSeconds)
Vfx.burst(at, tone, 24)
Vfx.flash(UI.Ink)
elseif kind == Kinds.ZoneStarted and id == "Siege" then
Vfx.column(at, UI.Gold)
elseif kind == Kinds.ZoneContested then
Vfx.ring(at, if id == "Siege" then 11 else 18, Config.Danger, .35)
elseif kind == Kinds.FlagDropped or kind == Kinds.FlagReturned or kind == Kinds.FlagScored or kind == Kinds.TokensBanked then
Vfx.burst(at, tone, 16)
elseif kind == Kinds.TokenDropped then
Vfx.burst(at, UI.Gold, 12)
end
end
if kind == Kinds.AllObjectivesTaken then Sounds.sound("AllTaken") end
if kind == Kinds.RoleSwap then Sounds.sound("RoleSwap") end
if kind == Kinds.FlagPicked then Sounds.sound("FlagPicked") end
if kind == Kinds.TokenPicked then Sounds.sound("TokenPick") end
if kind == Kinds.FlagScored then Sounds.sound("FlagScored") end
if kind == Kinds.TokensBanked and p.userId == player.UserId then Sounds.sound("TokensBanked") end
if id == "CaptureFlag" and (kind == Kinds.FlagPicked or kind == Kinds.FlagScored) then
contour:SetAttribute("Accent", tone)
title.Text = if kind == Kinds.FlagScored then S.flagHints.scored
@@ -76,7 +107,7 @@ local function event(kind: string, p: any)
bannerUntil=now+2.5
end
if kind==Kinds.LeaderDown then
Sounds.sound("HotPointCaptured")
Sounds.sound("LeaderDown")
if typeof(p.at)=="Vector3" then showWave(p.at,tone) end
end
end
@@ -87,7 +118,7 @@ local function event(kind: string, p: any)
title.Text=if kind == Kinds.MiniRoundStarted then string.format(copy.begin,p.index or 1,blue,orange)
elseif not p.side then copy.draw else string.format(copy.win,S.team(p.side),math.max(blue,orange),math.min(blue,orange))
bannerUntil=workspace:GetServerTimeNow()+2.8
Sounds.sound(if kind==Kinds.MiniRoundStarted then "RoundStart" else "HotPointCaptured")
Sounds.sound(if kind==Kinds.MiniRoundStarted then "MiniRoundStart" else "ZoneCaptured")
end
if id == "TrophyHunt" and p.userId == player.UserId then
if kind == Kinds.TokensBanked then
@@ -121,6 +152,24 @@ local heartbeat = RunService.Heartbeat:Connect(function(dt)
local now = workspace:GetServerTimeNow()
local mode = match:GetAttribute("Ruleset")
local playing = player:GetAttribute("InArena") == true and match:GetAttribute("Phase")=="Round"
if playing and mode == "CaptureFlag" and now - lastFlagAura >= .8 and match:GetAttribute("FlagCarrierSide") == nil then
local at = match:GetAttribute("FlagPosition")
if typeof(at) == "Vector3" then
Vfx.burst(at, UI.Gold, 14)
lastFlagAura = now
end
end
if playing and mode == "Siege" and now - roleColumnAt >= .75 then
local data = match:FindFirstChild("CitadelMatchState")
local at = data and data:GetAttribute("Point")
if data and typeof(at) == "Vector3" and data:GetAttribute("Phase") ~= "RoleSwap" then
local status = data:GetAttribute("Status")
local hue = if status == "Contested" then Config.Danger elseif status == "Idle" then UI.Gold
elseif status == "Decaying" then UI.Muted else tint(data:GetAttribute("Attacker"))
Vfx.column(at, hue)
roleColumnAt = now
end
end
if not playing or typeof(mode)~="string" or mode=="Siege" then
activeMode, provider, pending, bannerUntil = nil,nil,nil,0
pg:SetAttribute("ModeHint",nil)
@@ -135,14 +184,14 @@ local heartbeat = RunService.Heartbeat:Connect(function(dt)
local candidates = if provider then provider.candidates(match,player) else {}
if pending then table.insert(candidates,pending);pending=nil end
local hint = Hints.pick(selection,candidates,now)
pg:SetAttribute("ModeHint",if hint then hint.text else nil)
pg:SetAttribute("ModeHint",if hint then (if mobile then Hints.compact(hint.text) else hint.text) else nil)
local results = pg:FindFirstChild("ArenaResults")
banner.Visible = now<bannerUntil and pg:GetAttribute("HunterVoting")~=true and (not results or results:GetAttribute("LiveScoreboardOpen")~=true)
end)
script.Destroying:Once(function()
heartbeat:Disconnect()
for _, remove in subscriptions do remove() end
if effect then effect:Cancel() end
wave:Destroy()
resize:Disconnect()
if bannerTween then bannerTween:Cancel() end
gui:Destroy()
end)