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

+6 -96
View File
@@ -1,109 +1,19 @@
--!strict
local TweenService = game:GetService("TweenService")
local Runtime = script.Parent
local Common = require(Runtime.Common)
local Types = require(Runtime.Types)
local Config = require(game.ReplicatedStorage.CitadelAssaultConfig)
export type Rig = {show: () -> (), hide: () -> (), update: (Color3, string, number, boolean) -> (), capture: (Color3) -> ()}
local function newPart(name: string, parent: Instance): Part
local p = Instance.new("Part")
p.Name, p.Shape, p.Material = name, Enum.PartType.Cylinder, Enum.Material.Neon
p.CanCollide, p.CanQuery, p.CanTouch, p.Anchored, p.CastShadow = false, false, false, true, false
p.Transparency = 1
p.Parent = parent
return p
end
local Common = require(script.Parent.Common)
export type Rig = {show: () -> (), hide: () -> (), capture: () -> ()}
local Effects = {}
function Effects.new(mark: Common.Marker, folder: Folder, janitor: Types.Janitor): Rig
local root = Instance.new("Folder")
root.Name = "SiegeLight"
root.Parent = folder
local column = newPart("Column", root)
local wave = newPart("Shockwave", root)
local anchor = Instance.new("Attachment")
anchor.Parent = wave
local sparks = Instance.new("ParticleEmitter")
sparks.Texture = "rbxasset://textures/particles/sparkles_main.dds"
sparks.Speed, sparks.Lifetime, sparks.Rate = NumberRange.new(12, 25), NumberRange.new(.45, 1.2), 0
sparks.SpreadAngle = Vector2.new(145, 145)
sparks.LightEmission = 1
sparks.Parent = anchor
local diameter = Config.CAPTURE_RADIUS * 2
local rotation = CFrame.Angles(0, 0, math.pi / 2)
local floor = CFrame.new(mark.origin + Vector3.yAxis * .21) * rotation
wave.CFrame = floor
local width = 3.5
local fullColumn = CFrame.new(mark.origin + Vector3.yAxis * (Config.LIGHT_HEIGHT / 2)) * rotation
local motion: Tween? = nil
local lightMotion: Tween? = nil
local effect: Tween? = nil
local run = 0
local function cancel()
run += 1
if motion then motion:Cancel() end
if lightMotion then lightMotion:Cancel() end
if effect then effect:Cancel() end
end
function Effects.new(mark: Common.Marker): Rig
local function hide()
cancel()
column.Transparency, wave.Transparency = 1, 1
sparks:Clear()
mark.body:SetAttribute("ObjectiveArrowHidden", true)
mark.body.Parent = nil
end
janitor.give(hide)
return {
hide = hide,
show = function()
hide()
mark.body:SetAttribute("ObjectiveArrowHidden", nil)
mark.label.Visible = true
mark.body.Size = Vector3.new(.16, diameter * .15, diameter * .15)
mark.body.Transparency = .92
Common.paint(mark, Common.gold)
column.Color = Common.gold
column.Size, column.CFrame = Vector3.new(.2, width, width), floor
column.Transparency = .85
local t = TweenInfo.new(Config.MATERIALIZE_SECONDS, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
motion = TweenService:Create(mark.body, t, {Size = Vector3.new(.16, diameter, diameter)})
lightMotion = TweenService:Create(column, t, {CFrame = fullColumn, Size = Vector3.new(Config.LIGHT_HEIGHT, width, width)})
motion:Play()
lightMotion:Play()
end,
update = function(tint, phase, progress, changed)
column.Color = tint
column.Transparency = if phase == "Capturing" then 1 - (.55 + .45 * progress) * .25
elseif phase == "Decaying" then .94 else .86
if phase == "Contested" and changed then
wave.Color, wave.Transparency = tint, .68
wave.Size = Vector3.new(.12, diameter, diameter)
if effect then effect:Cancel() end
effect = TweenService:Create(wave, TweenInfo.new(.25), {Transparency = 1})
effect:Play()
end
end,
capture = function(tint)
cancel()
local token = run
Common.paint(mark, Color3.new(1, 1, 1))
mark.body:SetAttribute("ObjectiveArrowHidden", true)
mark.label.Visible = false
wave.Size = Vector3.new(.11, diameter, diameter)
wave.Color, wave.Transparency = tint, .55
sparks.Color = ColorSequence.new(tint)
sparks:Emit(Config.CONFETTI_COUNT)
local t = TweenInfo.new(Config.CAPTURE_EFFECT_SECONDS, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
motion = TweenService:Create(mark.body, t, {Size = Vector3.new(.16, .1, .1), Transparency = 1})
lightMotion = TweenService:Create(column, t, {Size = Vector3.new(.2, width, width), CFrame = floor, Transparency = 1})
effect = TweenService:Create(wave, t, {Size = Vector3.new(.11, diameter * 1.6, diameter * 1.6), Transparency = 1})
motion:Play()
lightMotion:Play()
effect:Play()
task.delay(Config.CAPTURE_EFFECT_SECONDS, function()
if token == run and mark.body.Parent == folder then mark.body.Parent = nil end
end)
end,
capture = hide,
}
end
return Effects