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

+7 -35
View File
@@ -4,12 +4,13 @@ local Types = require(Runtime.Types)
local Common = require(Runtime.Common)
local Kinds = require(game.ReplicatedStorage.Hunter.EventKinds)
local Strings = require(game.ReplicatedStorage.Hunter.Strings)
local Diagnostics = require(Runtime.ZoneDiagnostics)
local Context = require(Runtime.Context)
local Rules = require(Runtime.FlagRules)
local HotPoint = require(Runtime.Parent.HotPoint)
type Fighter = Types.Fighter
type Flag = {
marker: Common.Marker, stars: ParticleEmitter, mist: ParticleEmitter, light: PointLight, banner: BasePart,
marker: Common.Marker, light: PointLight, banner: BasePart,
carrier: Player?, tether: WeldConstraint?, droppedUntil: number,
}
local function makeFlag(parent: Instance, roof: Vector3): Flag
@@ -35,33 +36,7 @@ local function makeFlag(parent: Instance, roof: Vector3): Flag
local banner = attach("Banner", Vector3.new(2.65, 1.48, .15), Vector3.new(1.35, 1.45, 0), Common.gold)
attach("CrownLight", Vector3.new(.33, .33, .33), Vector3.yAxis * 2.34, Common.neutral).Shape = Enum.PartType.Ball
local aura = Instance.new("Attachment")
aura.Name = "FlagAura"
aura.Position = -Vector3.yAxis * 1.75
aura.Parent = body
local stars = Instance.new("ParticleEmitter")
stars.Name = "Stars"
stars.Texture = "rbxasset://textures/particles/sparkles_main.dds"
stars.Color = ColorSequence.new(Common.neutral, Common.gold)
stars.LightEmission, stars.LightInfluence = 1, 0
stars.Rate, stars.Speed, stars.Lifetime = 24, NumberRange.new(3, 6), NumberRange.new(.7, 1.4)
stars.SpreadAngle = Vector2.new(65, 65)
stars.Rotation, stars.RotSpeed = NumberRange.new(-180, 180), NumberRange.new(-90, 90)
stars.Size = NumberSequence.new({NumberSequenceKeypoint.new(0, .22), NumberSequenceKeypoint.new(.4, .52), NumberSequenceKeypoint.new(1, 0)})
stars.Parent = aura
local mist = Instance.new("ParticleEmitter")
mist.Name = "ColoredMist"
mist.Texture = "rbxasset://textures/particles/smoke_main.dds"
mist.Color = ColorSequence.new(Common.neutral, Common.gold)
mist.LightEmission, mist.LightInfluence = .55, 0
mist.Rate, mist.Speed, mist.Lifetime = 9, NumberRange.new(1, 4), NumberRange.new(.7, 1.2)
mist.SpreadAngle = Vector2.new(110, 110)
mist.Size = NumberSequence.new(1.4, 4)
mist.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0, .72), NumberSequenceKeypoint.new(.45, .79), NumberSequenceKeypoint.new(1, 1)})
mist.Parent = aura
return {marker = mark, stars = stars, mist = mist, light = light, banner = banner,
return {marker = mark, light = light, banner = banner,
carrier = nil, tether = nil, droppedUntil = 0}
end
@@ -88,8 +63,7 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
mark.body.CFrame = CFrame.new(at + Vector3.yAxis * 2.4)
mark.label.Text = if droppedUntil > 0 then Strings.flagDropLabel else Strings.flagRoofLabel
mark.label.TextColor3, object.banner.Color = Common.gold, Common.gold
object.stars.Enabled, object.mist.Enabled, object.light.Enabled = true, true, true
object.stars:Emit(16)
object.light.Enabled = true
end
local function pickUpFlag(object: Flag, fighter: Fighter)
@@ -108,14 +82,12 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
local tint = Common.color(fighter.side)
object.marker.label.Text = Strings.flagCarrierLabel(fighter.player.DisplayName)
object.marker.label.TextColor3, object.banner.Color = tint, tint
object.stars.Enabled, object.mist.Enabled, object.light.Enabled = false, false, false
object.stars:Clear()
object.mist:Clear()
object.light.Enabled = false
end
local function dropCarried(player: Player, at: Vector3?, now: number, fighters: {Fighter}?)
if flag.carrier == player then
if at then
local floor = workspace:Raycast(at + Vector3.yAxis * .3, -Vector3.yAxis * 50, geometry)
local floor = Diagnostics.raycast(at + Vector3.yAxis * .3, -Vector3.yAxis * 50, geometry)
if floor then
putFlag(flag, floor.Position, now + Rules.RETURN_SECONDS)
for _, fighter in (fighters or Context.collect(ctx.members())) do ctx.legacy(fighter.player, "FlagDropped") end
@@ -140,7 +112,7 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
if Common.boundsAt(fighter.root.Position, base, HotPoint.Radius, 7) then
ctx.scoring.add(fighter.side, 1, Kinds.FlagScored, fighter.player)
ctx.contribute(fighter.player, "deliveries", 1)
ctx.events.fire(Kinds.FlagScored, {side = fighter.side, userId = fighter.player.UserId})
ctx.events.fire(Kinds.FlagScored, {side = fighter.side, userId = fighter.player.UserId, at = base})
ctx.cue(fighters, true, nil)
putFlag(flag, flag.marker.origin, 0)
ctx.events.fire(Kinds.FlagReturned, {at = flag.marker.origin})
+2 -2
View File
@@ -19,7 +19,7 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
end,
score = function(side, points)
ctx.scoring.add(side, points, Kinds.ZoneCaptured)
ctx.events.fire(Kinds.ZoneCaptured, {side = side, text = Strings.hotPoint, value = nowAt - ctx.liveAt})
ctx.events.fire(Kinds.ZoneCaptured, {side = side, text = Strings.hotPoint, value = nowAt - ctx.liveAt, at = ctx.state:GetAttribute("HotPointPosition") :: Vector3?})
end,
status = ctx.status, contribute = ctx.contribute,
})
@@ -29,7 +29,7 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
capture.step(fighters, now, elapsed or dt)
local contested = ctx.state:GetAttribute("HotPointPhase") == "Contested"
if contested and not wasContested then
ctx.events.fire(Kinds.ZoneContested, {text = Strings.hotPoint})
ctx.events.fire(Kinds.ZoneContested, {text = Strings.hotPoint, at = ctx.state:GetAttribute("HotPointPosition") :: Vector3?})
end
wasContested = contested
return false
+3 -4
View File
@@ -42,7 +42,7 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
zone.marker.body.Parent = nil
ctx.janitor.give(zone.marker.body)
table.insert(zones, zone)
table.insert(visuals, Effects.new(zone.marker, folder, ctx.janitor))
table.insert(visuals, Effects.new(zone.marker))
end
data:SetAttribute("Total", #zones)
local siegeTimes: Score.Ledger = {Blue = {}, Orange = {}}
@@ -156,7 +156,6 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
local tint = if phase == "Idle" then Common.gold elseif phase == "Contested" then SiegeConfig.CONTESTED_COLOR
elseif phase == "Decaying" then teamTint:Lerp(Color3.fromRGB(150, 162, 182), .45) else teamTint
Common.paint(zone.marker, tint)
visual.update(tint, phase, progress, phase ~= lastStatus)
if phase == "Contested" and lastStatus ~= phase then
ctx.events.fire(Kinds.ZoneContested, {side = siegeSide, index = siegeIndex, at = zone.site.position})
end
@@ -164,11 +163,11 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
if phase ~= "Captured" or not Score.record(siegeTimes, siegeSide, siegeIndex, elapsed - attackStart) then return false end
ctx.scoring.add(siegeSide, SiegeConfig.POINTS_PER_OBJECTIVE, Kinds.ZoneCaptured)
for _, player in attackers do ctx.contribute(player, "captures", 1) end
ctx.events.fire(Kinds.ZoneCaptured, {side = siegeSide, index = siegeIndex, text = zone.site.name, value = elapsed - attackStart})
ctx.events.fire(Kinds.ZoneCaptured, {side = siegeSide, index = siegeIndex, text = zone.site.name, value = elapsed - attackStart, at = zone.site.position})
ctx.cue(fighters, true, nil)
siegeCaptureStarted = false
data:SetAttribute(siegeSide .. "Time" .. siegeIndex, elapsed - attackStart)
visual.capture(teamTint)
visual.capture()
siegeIndex += 1
siegeProgress = 0
if siegeIndex > #zones then
+10 -15
View File
@@ -7,8 +7,8 @@ local Strings = require(game.ReplicatedStorage.Hunter.Strings)
type Fighter = Types.Fighter
local HotPoint = require(Runtime.Parent.HotPoint)
local Rules = require(Runtime.TrophyRules)
local TweenService = game:GetService("TweenService")
type Drop = {marker: Common.Marker, amount: number, expires: number, fade: Tween?}
local Diagnostics = require(Runtime.ZoneDiagnostics)
type Drop = {marker: Common.Marker, amount: number, expires: number}
local function start(ctx: Types.ModeContext): Types.ModeInstance
local map, geometry, folder = assert(ctx.map), ctx.geometry, ctx.folder
@@ -16,7 +16,7 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
local tokens: {Drop} = {}
local carried: {[Player]: number} = {}
local function floorAt(at: Vector3): Vector3
local hit = workspace:Raycast(at + Vector3.yAxis * .3, -Vector3.yAxis * 50, geometry)
local hit = Diagnostics.raycast(at + Vector3.yAxis * .3, -Vector3.yAxis * 50, geometry)
return if hit then hit.Position else map.ground.position
end
local function tokenDrop(at: Vector3, amount: number, now: number)
@@ -26,38 +26,34 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
if Rules.canMerge(existing.marker.origin, floor) then
existing.amount += amount
existing.expires = now + Rules.LIFETIME
if existing.fade then existing.fade:Cancel(); existing.fade = nil end
existing.marker.body.Transparency = .04
existing.marker.body:SetAttribute("TokenExpiresAt", existing.expires)
existing.marker.label.Text = Strings.tokens(existing.amount)
return
end
end
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 + Rules.LIFETIME})
local mark = Common.marker(folder, "Tokens", Strings.tokens(amount), floor, Common.gold, 1.55, true)
mark.body:SetAttribute("TokenExpiresAt", now + Rules.LIFETIME)
mark.body:SetAttribute("TokenFlashSeconds", Rules.FLASH_SECONDS)
table.insert(tokens, {marker = mark, 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
if not collector then continue end
local p = collector.player
if not carried[p] then ctx.cue(fighters, false, collector.side) end
if not carried[p] then ctx.events.fire(Kinds.TokenPicked, {userId = p.UserId}, {p}) end
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
@@ -66,7 +62,7 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
if amount and Common.boundsAt(f.root.Position, if f.side == "Blue" then map.blue else map.orange, HotPoint.Radius, 7) then
ctx.scoring.add(f.side, amount, Kinds.TokensBanked, f.player)
ctx.contribute(f.player, "tokensBanked", amount)
ctx.events.fire(Kinds.TokensBanked, {side = f.side, userId = f.player.UserId, value = amount})
ctx.events.fire(Kinds.TokensBanked, {side = f.side, userId = f.player.UserId, value = amount, at = if f.side == "Blue" then map.blue else map.orange})
ctx.cue(fighters, true, nil)
carried[f.player] = nil
f.player:SetAttribute("ArenaTokens", nil)
@@ -92,7 +88,6 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
death = drop, leaving = drop,
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