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

BIN
View File
Binary file not shown.
+1
View File
@@ -28,6 +28,7 @@
"$ignoreUnknownInstances": true, "$ignoreUnknownInstances": true,
"ArenaRoundHud": { "$path": "scripts/ArenaRoundHud.client.luau" }, "ArenaRoundHud": { "$path": "scripts/ArenaRoundHud.client.luau" },
"HealthBar": { "$path": "scripts/HealthBar.client.luau" }, "HealthBar": { "$path": "scripts/HealthBar.client.luau" },
"ObjectiveArrows": { "$path": "scripts/ObjectiveArrows.client.luau" },
"OwnMovementAudio": { "$path": "scripts/OwnMovementAudio.client.luau" }, "OwnMovementAudio": { "$path": "scripts/OwnMovementAudio.client.luau" },
"ArenaClient": { "$path": "scripts/ArenaClient" } "ArenaClient": { "$path": "scripts/ArenaClient" }
} }
+45
View File
@@ -0,0 +1,45 @@
# Режимы Hunter
Синие играют против оранжевых на процедурной арене. Общий профиль задаёт 5 секунд на брифинг, 3 на отсчёт, 300 на матч и 30 на финальный рывок. Обычное возрождение и защита после него занимают по 2 секунды. Индивидуальные настройки приведены ниже. Сервер рассчитывает счёт и состояние целей, клиент показывает события и воспроизводит сигналы.
| Режим и профиль | Цель и правила | События и подсказки | Статистика |
| --- | --- | --- | --- |
| Командный бой · `TeamDeathmatch` | Больше устранений за матч. Устранение даёт очко, при равном счёте объявляется ничья. | Лента серий и подсказка о задаче в брифинге. | Командный счёт, убийства и смерти. |
| Горячая точка · `HotPoint` | Захватить текущую зону. Одному нужно 10 секунд, с союзником захват в 1,5 раза быстрее. Соперник оспаривает захват. После захвата цель перемещается. | Начало и оспаривание захвата, схлопывание кольца с дымом, уведомления о захвате и смене точки, указатель направления. | Очки команды и вклад в захват. |
| Три точки · `Domination` | Взять точку за 3 секунды без противника. Каждая удерживаемая точка даёт очко в секунду. | Захват, оспаривание, потеря и полный контроль. Подсказка сообщает состояние зоны. | Командные очки и вклад в контроль. |
| Захват флага · `CaptureFlag` | Забрать флаг с крыши и донести до своей базы. После смерти носителя флаг падает, через 20 секунд возвращается. Доставка даёт очко и возвращает флаг на крышу. | Подбор, падение, возврат и доставка. Маркер носителя и аура свободного флага. | Командный счёт и доставки флага. |
| Охота за жетонами · `TrophyHunt` | Собирать жетоны после устранений и сдавать на своей базе. Жетоны выпадают при гибели носителя. Сданный жетон даёт очко. | Подбор, выпадение, потеря и сдача. На панели виден запас, жетоны на земле мерцают перед исчезновением. | Командный счёт и число сданных жетонов. |
| Штурм · `Siege` | Атакующие удерживают круг 4 секунды и берут рубежи по очереди. Затем команды меняются ролями. Длительность задаёт `CitadelAssaultConfig.MATCH_DURATION`. | Захват рубежа, взятие всех рубежей, смена ролей. Указатель рубежа и подсказки о положении в зоне. | Число рубежей и времена захвата каждой стороны. |
| Одна жизнь · `OneLife` | Выиграть три мини-раунда. В каждом одна жизнь и до 45 секунд. Преимущество получает команда с большим числом живых. Финальный рывок отключён. | Начало и конец мини-раунда, подсказка об одной жизни. | Счёт мини-раундов, обычная статистика боя. |
| Охота на лидера · `HuntLeader` | Защитить своего лидера и устранить вражеского. Обычное устранение даёт одно очко, лидер даёт три. После смерти назначается новый лидер. | Назначение и гибель лидера, маркер цели. | Командные очки и устранения лидеров. |
## Как добавить новый режим
1. Добавить модуль в `scripts/ModeRuntime/Modes` с уникальным `id` и методами из `Types.Mode`. Использовать контекст режима для счёта и очистки.
2. Зарегистрировать режим в `MatchRules.All`.
3. Добавить профиль в `Hunter/ModeProfiles`. Указать цель, три правила и отклонения от общего тайминга.
4. Добавить тексты в `Hunter/Strings` и профиль режима.
5. Подключить провайдер подсказок через `Hunter/Hints` и проверить длину строки.
6. Описать события в `Hunter/EventKinds` и обработать их в `ArenaClient/ModeFeedback`. Для важных переходов использовать два канала из трёх.
7. Покрыть чистую логику тестами и прогнать полный матч, выход и вход, итоги и голосование в Studio.
## QA этапа 4
✓ означает пройденную проверку, ☐ означает отсутствие прогона, — обозначает неприменимый сценарий.
| Сценарий | TDM | HotPoint | Domination | CTF | Trophy | Siege | OneLife | Leader |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Матч 2×2 до итогов и голосования | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Выход среди раунда | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Вход среди раунда | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Смерть во время выполнения цели | — | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Команда опустела | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Брифинг блокирует стрельбу и движение | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Начало и конец финального рывка | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | — | ☐ |
| Читаемость HUD и FPS в мобильном эмуляторе | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Десять полных раундов и проверка соединений и Tween | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Десять серверных циклов запуска, первого шага и очистки без игроков | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
В одиночной сессии Play проверены модульные тесты бюджетов и подсказок. После 100 повторов кольца, столба и частиц число эмиттеров осталось 20. При 30 запросах одного звукового эффекта осталось 6 активных экземпляров. Проверка очистки на сервере подтверждает удаление папки целей и записи активного матча.
Для завершения приёмки нужны четыре игрока, мобильный эмулятор с измерением FPS и полный прогон раундов. В исходниках остаются старые видимые строки, которые ещё предстоит перенести в `Strings` и профили.
+112
View File
@@ -0,0 +1,112 @@
--!strict
local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Input = game:GetService("UserInputService")
local Config = require(RS.Hunter.EffectsConfig)
local Budget = require(RS.Hunter.EffectsBudget)
local profile = Budget.profile(Input.TouchEnabled, Input.KeyboardEnabled)
local localPlayer = Players.LocalPlayer
local root = Instance.new("Folder")
root.Name = "HunterClientVfx"
root.Parent = workspace
type Slot = {part: Part, tween: Tween?, effect: ParticleEmitter?}
local rotation = CFrame.Angles(0, 0, math.pi / 2)
local function pool(name: string, size: number, particles: boolean): () -> Slot
local slots: {Slot} = {}
local cursor = 0
for i = 1, size do
local part = Instance.new("Part")
part.Name = name
part.Anchored, part.CanCollide, part.CanQuery, part.CanTouch = true, false, false, false
part.CastShadow = false
part.Shape, part.Material, part.Transparency = Enum.PartType.Cylinder, Enum.Material.Neon, 1
part.Size = Vector3.one
part.Parent = root
local emitter: ParticleEmitter? = nil
if particles then
emitter = Instance.new("ParticleEmitter")
emitter.Texture = "rbxasset://textures/particles/sparkles_main.dds"
emitter.Rate = 0
emitter.Lifetime = NumberRange.new(.3, .65)
emitter.Speed = NumberRange.new(9, 24)
emitter.SpreadAngle = Vector2.new(145, 145)
emitter.Size = NumberSequence.new(.42, 0)
emitter.LightEmission, emitter.LightInfluence = 1, 0
emitter.Parent = part
end
slots[i] = {part = part, effect = emitter, tween = nil}
end
return function()
cursor = cursor % size + 1
local slot = slots[cursor]
if slot.tween then slot.tween:Cancel(); slot.tween = nil end
if slot.effect then slot.effect:Clear() end
slot.part.Transparency = 1
return slot
end
end
local rings = pool("Ring", profile.worldSlots, false)
local columns = pool("Column", profile.worldSlots, false)
local bursts = pool("Burst", math.min(profile.burstSlots, profile.maxEmitters), true)
local gui = Instance.new("ScreenGui")
gui.Name = "ArenaScreenVfx"
gui.DisplayOrder = 7
gui.ResetOnSpawn = false
gui.Parent = localPlayer:WaitForChild("PlayerGui")
local flash = Instance.new("Frame")
flash.BorderSizePixel = 0
flash.Size = UDim2.fromScale(1, 1)
flash.BackgroundTransparency = 1
flash.Parent = gui
local flashTween: Tween? = nil
local ArenaVfx = {}
local function animate(slot: Slot, seconds: number, props: {[string]: any})
local tween = TweenService:Create(slot.part, TweenInfo.new(math.clamp(seconds, .05, .6), Enum.EasingStyle.Quad, Enum.EasingDirection.Out), props)
slot.tween = tween
tween:Play()
end
function ArenaVfx.ring(at: Vector3, radius: number, color: Color3, seconds: number, inward: boolean?)
local slot = rings()
slot.part.CFrame = CFrame.new(at + Vector3.yAxis * .24) * rotation
local diameter = radius * 2
local start = if inward then diameter else diameter * .55
local finish = if inward then .1 else diameter * 1.6
slot.part.Size = Vector3.new(.1, start, start)
slot.part.Color, slot.part.Transparency = color, .7
animate(slot, seconds, {Size = Vector3.new(.1, finish, finish), Transparency = 1})
end
function ArenaVfx.burst(at: Vector3, color: Color3, count: number, smoke: boolean?)
local amount = Budget.particles(count, profile.scale)
if amount == 0 then return end
local slot = bursts()
slot.part.CFrame = CFrame.new(at + Vector3.yAxis)
local emitter = assert(slot.effect)
emitter.Texture = if smoke then "rbxasset://textures/particles/smoke_main.dds" else "rbxasset://textures/particles/sparkles_main.dds"
emitter.Size = if smoke then NumberSequence.new(2, 8) else NumberSequence.new(.42, 0)
emitter.Transparency = if smoke then NumberSequence.new(.35, 1) else NumberSequence.new(.06, 1)
emitter.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
emitter:Emit(amount)
end
function ArenaVfx.column(at: Vector3, color: Color3)
local slot = columns()
slot.part.CFrame = CFrame.new(at + Vector3.yAxis) * rotation
slot.part.Size = Vector3.new(1, 3, 3)
slot.part.Color, slot.part.Transparency = color, .72
animate(slot, Config.FeedbackSeconds, {CFrame = CFrame.new(at + Vector3.yAxis * 22) * rotation,
Size = Vector3.new(44, 4, 4), Transparency = 1})
end
function ArenaVfx.flash(color: Color3)
if flashTween then flashTween:Cancel() end
flash.BackgroundColor3, flash.BackgroundTransparency = color, .93
flashTween = TweenService:Create(flash, TweenInfo.new(.32), {BackgroundTransparency = 1})
flashTween:Play()
end
return ArenaVfx
@@ -189,6 +189,7 @@ local function update()
elseif stage == "Live" or stage == "FinalPush" then elseif stage == "Live" or stage == "FinalPush" then
if final then if final then
showBanner(Strings.round.final, Strings.round.finalPush[id] or "", now + Config.finalBannerSeconds) showBanner(Strings.round.final, Strings.round.finalPush[id] or "", now + Config.finalBannerSeconds)
Sounds.sound("FinalPush")
elseif oldStage == "Countdown" and wasInArena then elseif oldStage == "Countdown" and wasInArena then
showBanner(Strings.round.fight, "", now + Config.startBannerSeconds) showBanner(Strings.round.fight, "", now + Config.startBannerSeconds)
Sounds.sound("RoundStart") Sounds.sound("RoundStart")
+3 -1
View File
@@ -4,6 +4,8 @@ local rs = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService") local RunService = game:GetService("RunService")
local UI = require(rs:WaitForChild("HunterUI") :: ModuleScript) local UI = require(rs:WaitForChild("HunterUI") :: ModuleScript)
local Sounds = require(rs:WaitForChild("SniperEffects") :: ModuleScript) local Sounds = require(rs:WaitForChild("SniperEffects") :: ModuleScript)
local Input = game:GetService("UserInputService")
local mobile = Input.TouchEnabled and not Input.KeyboardEnabled
local Config = require(rs.CitadelAssaultConfig) local Config = require(rs.CitadelAssaultConfig)
local Strings = require(rs.Hunter.Strings) local Strings = require(rs.Hunter.Strings)
local Hints = require(rs.Hunter.Hints) local Hints = require(rs.Hunter.Hints)
@@ -114,7 +116,7 @@ local function update()
}) })
if pending then table.insert(candidates, pending); pending = nil end if pending then table.insert(candidates, pending); pending = nil end
local chosen = if Config.HintsEnabled then Hints.pick(hints, candidates, workspace:GetServerTimeNow()) else nil local chosen = if Config.HintsEnabled then Hints.pick(hints, candidates, workspace:GetServerTimeNow()) else nil
pg:SetAttribute("SiegeHint", if chosen then chosen.text else nil) pg:SetAttribute("SiegeHint", if chosen then (if mobile then Hints.compact(chosen.text) else chosen.text) else nil)
if zone == "Inside" and previousZone ~= zone then Sounds.sound("SiegeEnter") end if zone == "Inside" and previousZone ~= zone then Sounds.sound("SiegeEnter") end
if zone == "Inside" and status == "Capturing" and attacking then if zone == "Inside" and status == "Capturing" and attacking then
+68 -19
View File
@@ -9,6 +9,10 @@ local S = require(rs.Hunter.Strings)
local Hints = require(rs.Hunter.Hints) local Hints = require(rs.Hunter.Hints)
local Kinds = require(rs.Hunter.EventKinds) local Kinds = require(rs.Hunter.EventKinds)
local Router = require(script.Parent.EventRouter) 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 player = Players.LocalPlayer
local pg = player:WaitForChild("PlayerGui") 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 title.FontFace = UI.Display
banner.Visible = false 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 pending: Hints.Hint? = nil
local activeMode: string? = nil local activeMode: string? = nil
local provider: any = nil local provider: any = nil
@@ -43,19 +40,53 @@ local function tint(side: string?): Color3
end end
local function showWave(at: Vector3, color: Color3) local function showWave(at: Vector3, color: Color3)
if effect then effect:Cancel() end Vfx.ring(at, 18, color, Config.FeedbackSeconds)
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()
end 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) local function event(kind: string, p: any)
if player:GetAttribute("InArena") ~= true or match:GetAttribute("Phase") ~= "Round" then return end if player:GetAttribute("InArena") ~= true or match:GetAttribute("Phase") ~= "Round" then return end
local id = match:GetAttribute("Ruleset") local id = match:GetAttribute("Ruleset")
local tone = tint(p.side) 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 if id == "CaptureFlag" and (kind == Kinds.FlagPicked or kind == Kinds.FlagScored) then
contour:SetAttribute("Accent", tone) contour:SetAttribute("Accent", tone)
title.Text = if kind == Kinds.FlagScored then S.flagHints.scored 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 bannerUntil=now+2.5
end end
if kind==Kinds.LeaderDown then if kind==Kinds.LeaderDown then
Sounds.sound("HotPointCaptured") Sounds.sound("LeaderDown")
if typeof(p.at)=="Vector3" then showWave(p.at,tone) end if typeof(p.at)=="Vector3" then showWave(p.at,tone) end
end 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) 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)) 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 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 end
if id == "TrophyHunt" and p.userId == player.UserId then if id == "TrophyHunt" and p.userId == player.UserId then
if kind == Kinds.TokensBanked then if kind == Kinds.TokensBanked then
@@ -121,6 +152,24 @@ local heartbeat = RunService.Heartbeat:Connect(function(dt)
local now = workspace:GetServerTimeNow() local now = workspace:GetServerTimeNow()
local mode = match:GetAttribute("Ruleset") local mode = match:GetAttribute("Ruleset")
local playing = player:GetAttribute("InArena") == true and match:GetAttribute("Phase")=="Round" 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 if not playing or typeof(mode)~="string" or mode=="Siege" then
activeMode, provider, pending, bannerUntil = nil,nil,nil,0 activeMode, provider, pending, bannerUntil = nil,nil,nil,0
pg:SetAttribute("ModeHint",nil) 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 {} local candidates = if provider then provider.candidates(match,player) else {}
if pending then table.insert(candidates,pending);pending=nil end if pending then table.insert(candidates,pending);pending=nil end
local hint = Hints.pick(selection,candidates,now) 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") local results = pg:FindFirstChild("ArenaResults")
banner.Visible = now<bannerUntil and pg:GetAttribute("HunterVoting")~=true and (not results or results:GetAttribute("LiveScoreboardOpen")~=true) banner.Visible = now<bannerUntil and pg:GetAttribute("HunterVoting")~=true and (not results or results:GetAttribute("LiveScoreboardOpen")~=true)
end) end)
script.Destroying:Once(function() script.Destroying:Once(function()
heartbeat:Disconnect() heartbeat:Disconnect()
for _, remove in subscriptions do remove() end for _, remove in subscriptions do remove() end
if effect then effect:Cancel() end resize:Disconnect()
wave:Destroy() if bannerTween then bannerTween:Cancel() end
gui:Destroy() gui:Destroy()
end) end)
+22 -2
View File
@@ -11,8 +11,8 @@ local match=rs:WaitForChild("ArenaRound"):WaitForChild("Procedural")
local gui=Instance.new("ScreenGui") local gui=Instance.new("ScreenGui")
gui.Name,gui.DisplayOrder,gui.ResetOnSpawn="TrophyCounter",23,false gui.Name,gui.DisplayOrder,gui.ResetOnSpawn="TrophyCounter",23,false
gui.Parent=player:WaitForChild("PlayerGui") gui.Parent=player:WaitForChild("PlayerGui")
local plate=UI.plate(gui,"Coins",UDim2.new(1,-16,1,-80),UDim2.fromOffset(106,48),UI.Gold) local plate=UI.plate(gui,"Coins",UDim2.new(.5,0,1,-85),UDim2.fromOffset(106,48),UI.Gold)
plate.AnchorPoint=Vector2.new(1,1) plate.AnchorPoint=Vector2.new(.5,1)
local art=UI.element("GoldCoin",plate,UDim2.fromOffset(6,4),UDim2.fromOffset(40,40)) :: Frame local art=UI.element("GoldCoin",plate,UDim2.fromOffset(6,4),UDim2.fromOffset(40,40)) :: Frame
local rig=UI.bindCoin(art) local rig=UI.bindCoin(art)
local label=UI.label(plate,"Count","×0",UDim2.fromOffset(47,0),UDim2.fromOffset(52,48),24,UI.Gold) local label=UI.label(plate,"Count","×0",UDim2.fromOffset(47,0),UDim2.fromOffset(52,48),24,UI.Gold)
@@ -35,7 +35,24 @@ local function update()
end end
local connections={player:GetAttributeChangedSignal("ArenaTokens"):Connect(update),player:GetAttributeChangedSignal("InArena"):Connect(update), local connections={player:GetAttributeChangedSignal("ArenaTokens"):Connect(update),player:GetAttributeChangedSignal("InArena"):Connect(update),
match:GetAttributeChangedSignal("Ruleset"):Connect(update),match:GetAttributeChangedSignal("Phase"):Connect(update)} match:GetAttributeChangedSignal("Ruleset"):Connect(update),match:GetAttributeChangedSignal("Phase"):Connect(update)}
local tokens: {[BasePart]: boolean} = {}
local arena = workspace:WaitForChild("ProceduralArena")
local function add(item: Instance)
if item:IsA("BasePart") and item.Name == "Tokens" then tokens[item] = true end
end
for _, item in arena:GetDescendants() do add(item) end
local created = arena.DescendantAdded:Connect(add)
local removed = arena.DescendantRemoving:Connect(function(item)
if item:IsA("BasePart") then tokens[item] = nil end
end)
local draw=RunService.RenderStepped:Connect(function() local draw=RunService.RenderStepped:Connect(function()
local now = workspace:GetServerTimeNow()
for token in tokens do
local deadline = token:GetAttribute("TokenExpiresAt")
local flashSeconds = token:GetAttribute("TokenFlashSeconds")
local flashing = typeof(deadline) == "number" and typeof(flashSeconds) == "number" and deadline - now <= flashSeconds
token.LocalTransparencyModifier = if flashing then .32 + .26 * math.sin(now * math.pi * 2 / .76) else 0
end
if not gui.Enabled then return end if not gui.Enabled then return end
local t=os.clock() local t=os.clock()
UI.spinCoin(rig,t*2,math.max(0,math.cos(t*2))*.55,t%1) UI.spinCoin(rig,t*2,math.max(0,math.cos(t*2))*.55,t%1)
@@ -70,6 +87,9 @@ end)
update() update()
script.Destroying:Once(function() script.Destroying:Once(function()
draw:Disconnect() draw:Disconnect()
created:Disconnect()
removed:Disconnect()
for token in tokens do token.LocalTransparencyModifier = 0 end
for _, cn in connections do cn:Disconnect() end for _, cn in connections do cn:Disconnect() end
off() off()
for _, coin in pool do for _, coin in pool do
+53
View File
@@ -0,0 +1,53 @@
--!strict
local RS = game:GetService("ReplicatedStorage")
local Config = require(RS.Hunter.EffectsConfig)
if not Config.Debug then return end
local Players = game:GetService("Players")
local UI = require(RS:WaitForChild("HunterUI") :: ModuleScript)
local player = Players.LocalPlayer
local match = RS:WaitForChild("ArenaRound"):WaitForChild("Procedural")
local gui = Instance.new("ScreenGui")
gui.Name = "ArenaZoneDebug"
gui.ResetOnSpawn = false
gui.Parent = player:WaitForChild("PlayerGui")
local label = UI.label(gui, "Metrics", "", UDim2.new(.5, -180, 0, 10), UDim2.fromOffset(360, 25), 15, UI.Gold)
local function part(name: string): Part
local p = Instance.new("Part")
p.Name = name
p.Transparency = 1
p.Anchored, p.CanCollide, p.CanTouch, p.CanQuery = true, false, false, false
p.Parent = workspace
return p
end
local line, bounds = part("DebugSight"), part("DebugRadius")
bounds.Shape = Enum.PartType.Cylinder
local running = true
task.spawn(function()
while running do
local siege = match:FindFirstChild("CitadelMatchState")
local position = if siege then siege:GetAttribute("Point") else match:GetAttribute("HotPointPosition")
local root = player.Character and player.Character.PrimaryPart
label.Text = string.format("Ray %d / %d · Events/s %d · %s", match:GetAttribute("DebugRays") or 0,
match:GetAttribute("DebugFighters") or 0, match:GetAttribute("DebugEvents") or 0, player:GetAttribute("CitadelZone") or "—")
if root and typeof(position) == "Vector3" then
local r = if siege then siege:GetAttribute("Radius") or 11 else 18
bounds.Size = Vector3.new(.12,r*2,r*2)
bounds.CFrame = CFrame.new(position + Vector3.yAxis * .1) * CFrame.Angles(0,0,math.pi/2)
bounds.Color, bounds.Transparency = UI.Gold, .82
local target = position + Vector3.yAxis * 2
line.CFrame = CFrame.lookAt((root.Position + target) / 2,target)
line.Size = Vector3.new(.07,.07,(root.Position-target).Magnitude)
line.Color = if player:GetAttribute("CitadelZone") == "Blocked" then Config.Danger else UI.Mint
line.Transparency = .3
else
bounds.Transparency, line.Transparency = 1, 1
end
task.wait(.2)
end
end)
script.Destroying:Once(function()
running = false
line:Destroy()
bounds:Destroy()
gui:Destroy()
end)
+12 -1
View File
@@ -4,6 +4,8 @@ local Runtime = script.Parent:WaitForChild("ModeRuntime")
local Types = require(Runtime:WaitForChild("Types") :: ModuleScript) local Types = require(Runtime:WaitForChild("Types") :: ModuleScript)
local Context = require(Runtime:WaitForChild("Context") :: ModuleScript) local Context = require(Runtime:WaitForChild("Context") :: ModuleScript)
local Diagnostics = require(Runtime:WaitForChild("ZoneDiagnostics") :: ModuleScript)
export type Match = { export type Match = {
step: (number) -> boolean, kill: (Player, Player, Vector3, number) -> (), step: (number) -> boolean, kill: (Player, Player, Vector3, number) -> (),
hit: ((Player, number, boolean) -> ())?, hit: ((Player, number, boolean) -> ())?,
@@ -41,6 +43,7 @@ function Objectives.start(config: Types.Config): Match
end end
local instance = result :: Types.ModeInstance local instance = result :: Types.ModeInstance
local lastStep = ctx.liveAt local lastStep = ctx.liveAt
local profileLabel = "Mode." .. mode.id .. ".step"
local destroyed = false local destroyed = false
local match: Match local match: Match
match = { match = {
@@ -48,7 +51,14 @@ function Objectives.start(config: Types.Config): Match
if destroyed then return false end if destroyed then return false end
local elapsed = math.max(0, now - lastStep) local elapsed = math.max(0, now - lastStep)
lastStep = now lastStep = now
return instance.step(now, math.min(elapsed, .5), Context.collect(ctx.members()), elapsed) debug.profilebegin(profileLabel)
Diagnostics.begin()
local fighters = Context.collect(ctx.members())
local ok, ended = pcall(instance.step, now, math.min(elapsed, .5), fighters, elapsed)
Diagnostics.finish(ctx.state, #fighters, now)
debug.profileend()
if not ok then error(ended, 0) end
return ended
end, end,
kill = instance.kill, hit = instance.hit, death = instance.death, leaving = instance.leaving, kill = instance.kill, hit = instance.hit, death = instance.death, leaving = instance.leaving,
winner = function() winner = function()
@@ -65,6 +75,7 @@ function Objectives.start(config: Types.Config): Match
ctx.folder:Destroy() ctx.folder:Destroy()
ctx.status("") ctx.status("")
ctx.state:SetAttribute("RoundStage", nil) ctx.state:SetAttribute("RoundStage", nil)
for _, attr in {"DebugRays", "DebugFighters", "DebugEvents"} do ctx.state:SetAttribute(attr, nil) end
if not ok then warn(issue) end if not ok then warn(issue) end
end, end,
} }
+2 -1
View File
@@ -332,7 +332,7 @@ local function showCountdownBeat(seconds: number)
digitMotion:Play() digitMotion:Play()
echoMotion:Play() echoMotion:Play()
echoFade:Play() echoFade:Play()
countdownSound = Sounds.sound("RoundCountdown") countdownSound = Sounds.sound("Countdown")
end end
local teamStats = UI.plate(hudLayout, "TeamKillStats", UDim2.fromOffset(15, 74), UDim2.fromOffset(widthOfCard, 55), UI.Outline) local teamStats = UI.plate(hudLayout, "TeamKillStats", UDim2.fromOffset(15, 74), UDim2.fromOffset(widthOfCard, 55), UI.Outline)
@@ -952,6 +952,7 @@ results.OnClientEvent:Connect(function(result: RoundResult, participantSide: str
if left <= 0 then return end if left <= 0 then return end
if resultsShade.Visible then hideResults() end if resultsShade.Visible then hideResults() end
startSummary("Final", result.ruleset) startSummary("Final", result.ruleset)
Sounds.sound("Results")
if result.ruleset == "Siege" and result.siegeTimes then if result.ruleset == "Siege" and result.siegeTimes then
local lines = SiegeResults.rows(result.siegeTimes, SiegeConfig.MAX_OBJECTIVES) local lines = SiegeResults.rows(result.siegeTimes, SiegeConfig.MAX_OBJECTIVES)
table.insert(lines, SiegeResults.tiebreak) table.insert(lines, SiegeResults.tiebreak)
+8 -63
View File
@@ -1,5 +1,5 @@
--!strict --!strict
local TweenService = game:GetService("TweenService") local Diagnostics = require(script.Parent.ModeRuntime.ZoneDiagnostics)
local Credit = require(script.Parent.ModeRuntime.HotPointCredit) local Credit = require(script.Parent.ModeRuntime.HotPointCredit)
local Sites = require(script.Parent:WaitForChild("ArenaObjectiveSites") :: ModuleScript) local Sites = require(script.Parent:WaitForChild("ArenaObjectiveSites") :: ModuleScript)
@@ -26,7 +26,7 @@ local TEAM_SPEED = 1.5
local HIT_WINDOW = 1.2 local HIT_WINDOW = 1.2
local HIT_DECAY = .8 local HIT_DECAY = .8
local neutral = Color3.fromRGB(183, 132, 255) local neutral = Color3.fromRGB(255, 220, 96)
local contested = Color3.fromRGB(255, 211, 124) local contested = Color3.fromRGB(255, 211, 124)
local teamColor: {[Side]: Color3} = {Blue = Color3.fromRGB(76, 228, 255), Orange = Color3.fromRGB(255, 81, 105)} local teamColor: {[Side]: Color3} = {Blue = Color3.fromRGB(76, 228, 255), Orange = Color3.fromRGB(255, 81, 105)}
@@ -35,7 +35,6 @@ function HotPoint.attachRing(mark: Marker, radius: number?): (Color3) -> ()
local body = mark.body local body = mark.body
body.Transparency = .92 body.Transparency = .92
local beams: {Beam} = {} local beams: {Beam} = {}
local sparks: {ParticleEmitter} = {}
local function anchor(angle: number, height: number): Attachment local function anchor(angle: number, height: number): Attachment
local radial = Vector3.new(math.cos(angle), 0, math.sin(angle)) local radial = Vector3.new(math.cos(angle), 0, math.sin(angle))
local tangent = Vector3.new(-radial.Z, 0, radial.X) local tangent = Vector3.new(-radial.Z, 0, radial.X)
@@ -81,22 +80,6 @@ function HotPoint.attachRing(mark: Marker, radius: number?): (Color3) -> ()
veil.Parent = body veil.Parent = body
table.insert(beams, veil) table.insert(beams, veil)
end end
local emitter = Instance.new("ParticleEmitter")
emitter.Name = "RisingSparks"
emitter.Texture = "rbxasset://textures/particles/sparkles_main.dds"
emitter.EmissionDirection = Enum.NormalId.Top
emitter.Rate, emitter.Speed = 12, NumberRange.new(16.5, 27)
emitter.Lifetime, emitter.SpreadAngle = NumberRange.new(.6, 1.08), Vector2.new(8, 8)
emitter.Rotation, emitter.RotSpeed = NumberRange.new(-180, 180), NumberRange.new(-95, 95)
emitter.LightEmission, emitter.LightInfluence, emitter.Brightness = 1, 0, 2
emitter.Size = NumberSequence.new({
NumberSequenceKeypoint.new(0, .16), NumberSequenceKeypoint.new(.25, .55), NumberSequenceKeypoint.new(1, .08),
})
emitter.Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(.22, .12), NumberSequenceKeypoint.new(1, 1),
})
emitter.Parent = source
table.insert(sparks, emitter)
end end
return function(tint: Color3) return function(tint: Color3)
body.Color, mark.label.TextColor3 = tint, tint body.Color, mark.label.TextColor3 = tint, tint
@@ -107,50 +90,12 @@ function HotPoint.attachRing(mark: Marker, radius: number?): (Color3) -> ()
ColorSequenceKeypoint.new(1, tint), ColorSequenceKeypoint.new(1, tint),
}) })
for _, beam in beams do beam.Color = spectrum end for _, beam in beams do beam.Color = spectrum end
for _, emitter in sparks do emitter.Color = spectrum end
end end
end end
local function collapse(mark: Marker) local function closeMarker(mark: Marker)
local body = mark.body mark.body:SetAttribute("ObjectiveArrowHidden", true)
local motion = TweenInfo.new(COLLAPSE_SECONDS, Enum.EasingStyle.Quad, Enum.EasingDirection.In) mark.body.Parent = nil
local center = body.CFrame:PointToObjectSpace(mark.origin + Vector3.yAxis * .29)
body:SetAttribute("ObjectiveArrowHidden", true)
mark.label.Visible = false
TweenService:Create(body, motion, {Size = Vector3.new(body.Size.X, .1, .1), Transparency = 1}):Play()
for _, item in body:GetDescendants() do
if item:IsA("Attachment") then
TweenService:Create(item, motion, {Position = center}):Play()
elseif item:IsA("Beam") then
TweenService:Create(item, motion, {Width0 = 0, Width1 = 0, CurveSize0 = 0, CurveSize1 = 0}):Play()
elseif item:IsA("ParticleEmitter") then
item.Enabled = false
elseif item:IsA("PointLight") then
TweenService:Create(item, motion, {Brightness = 0, Range = 0}):Play()
end
end
local source = Instance.new("Attachment")
source.CFrame = body.CFrame:ToObjectSpace(CFrame.new(mark.origin + Vector3.yAxis * .65))
source.Parent = body
local smoke = Instance.new("ParticleEmitter")
smoke.Name = "CaptureSmoke"
smoke.Texture = "rbxasset://textures/particles/smoke_main.dds"
smoke.Rate = 0
smoke.Lifetime = NumberRange.new(.8, 1.45)
smoke.Speed = NumberRange.new(7, 16)
smoke.SpreadAngle = Vector2.new(68, 68)
smoke.Rotation = NumberRange.new(-180, 180)
smoke.Acceleration = Vector3.yAxis * 6
smoke.Color = ColorSequence.new(body.Color:Lerp(Color3.fromRGB(215, 222, 236), .65))
smoke.Size = NumberSequence.new({
NumberSequenceKeypoint.new(0, 2), NumberSequenceKeypoint.new(.5, 6), NumberSequenceKeypoint.new(1, 10),
})
smoke.Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0, .28), NumberSequenceKeypoint.new(.42, .46), NumberSequenceKeypoint.new(1, 1),
})
smoke.Parent = source
smoke:Emit(32)
end end
function HotPoint.start(config: Config): Capture function HotPoint.start(config: Config): Capture
@@ -185,11 +130,11 @@ function HotPoint.start(config: Config): Capture
if delta.Y < -.5 or delta.Y > 60 or delta.X * delta.X + delta.Z * delta.Z > HotPoint.Radius ^ 2 then return false end if delta.Y < -.5 or delta.Y > 60 or delta.X * delta.X + delta.Z * delta.Z > HotPoint.Radius ^ 2 then return false end
if delta.Y > 8 then if delta.Y > 8 then
-- A jump over the point still counts when the first floor below is the capture floor. -- A jump over the point still counts when the first floor below is the capture floor.
local floor = workspace:Raycast(fighter.root.Position, -Vector3.yAxis * (delta.Y + .8), config.geometry) local floor = Diagnostics.raycast(fighter.root.Position, -Vector3.yAxis * (delta.Y + .8), config.geometry)
return floor ~= nil and math.abs(floor.Position.Y - origin.Y) < .65 return floor ~= nil and math.abs(floor.Position.Y - origin.Y) < .65
end end
local to = origin + Vector3.yAxis * 2.7 - fighter.root.Position local to = origin + Vector3.yAxis * 2.7 - fighter.root.Position
return workspace:Raycast(fighter.root.Position, to, config.geometry) == nil return Diagnostics.raycast(fighter.root.Position, to, config.geometry) == nil
end end
local function step(fighters: {Fighter}, now: number, dt: number) local function step(fighters: {Fighter}, now: number, dt: number)
@@ -264,7 +209,7 @@ function HotPoint.start(config: Config): Capture
state:SetAttribute("HotPointPosition", nil) state:SetAttribute("HotPointPosition", nil)
state:SetAttribute("HotPointMovesAt", movesAt) state:SetAttribute("HotPointMovesAt", movesAt)
paintRing(teamColor[side]) paintRing(teamColor[side])
if mark then collapse(mark) end if mark then closeMarker(mark) end
else else
local phase = if isContested then "Contested" elseif underFire then "UnderFire" else "Capturing" local phase = if isContested then "Contested" elseif underFire then "UnderFire" else "Capturing"
publish(side, math.floor(100 * credit / CAPTURE_SECONDS), phase) publish(side, math.floor(100 * credit / CAPTURE_SECONDS), phase)
+10
View File
@@ -0,0 +1,10 @@
--!strict
local Config = require(script.Parent.EffectsConfig)
local Budget = {}
function Budget.profile(touch: boolean, keyboard: boolean)
return if touch and not keyboard then Config.Mobile else Config.Desktop
end
function Budget.particles(requested: number, scale: number): number
return if requested <= 0 then 0 else math.max(1, math.floor(requested * scale))
end
return table.freeze(Budget)
+29
View File
@@ -0,0 +1,29 @@
--!strict
local tick = "rbxassetid://113416294133952"
local ready = "rbxassetid://2789428506"
local success = "rbxassetid://4612374036"
export type Cue = {id: string, volume: number, speed: number}
local function cue(id: string, volume: number, speed: number): Cue
return table.freeze({id = id, volume = volume, speed = speed})
end
return table.freeze({
Debug = false, SoundLimit = 6, HintLimit = 60,
Danger = Color3.fromRGB(255, 81, 105),
FeedbackSeconds = .55, BannerMotionSeconds = .22,
Desktop = table.freeze({scale = 1, maxEmitters = 200, burstSlots = 10, worldSlots = 8}),
Mobile = table.freeze({scale = .4, maxEmitters = 80, burstSlots = 4, worldSlots = 4}),
Cues = table.freeze({
RoundStart = cue(success,.27,1.15), Countdown = cue(tick,.25,1), Tick = cue(tick,.22,1.12),
FinalPush = cue(ready,.25,.9), ZoneEnter = cue(tick,.23,1.30), ZoneCharge = cue(ready,.22,1),
ZoneBlocked = cue(ready,.25,.70), ZoneDecay = cue(ready,.20,.58), ZoneCaptured = cue(success,.28,1),
AllTaken = cue(success,.27,1.18), FlagPicked = cue(ready,.25,1), FlagDropped = cue(ready,.23,.72),
FlagScored = cue(success,.28,1.06), TokenPick = cue(tick,.22,1.21), TokensBanked = cue(success,.27,1.2),
LeaderDown = cue(success,.28,.94), RoleSwap = cue(ready,.25,1.18),
MiniRoundStart = cue(success,.26,1.24), Results = cue(success,.25,.92),
}),
Aliases = table.freeze({
RoundCountdown = "Countdown", SiegeEnter = "ZoneEnter", SiegeCharge = "ZoneCharge",
SiegeTick = "Tick", SiegeBlocked = "ZoneBlocked", SiegeDecay = "ZoneDecay",
HotPointStart = "ZoneCharge", HotPointCaptured = "ZoneCaptured", HotPointMove = "Countdown",
}),
})
+1 -1
View File
@@ -2,7 +2,7 @@
return table.freeze({ return table.freeze({
ZoneStarted = "ZoneStarted", ZoneCaptured = "ZoneCaptured", ZoneContested = "ZoneContested", ZoneLost = "ZoneLost", ZoneStarted = "ZoneStarted", ZoneCaptured = "ZoneCaptured", ZoneContested = "ZoneContested", ZoneLost = "ZoneLost",
FullControl = "FullControl", AllObjectivesTaken = "AllObjectivesTaken", FlagPicked = "FlagPicked", FlagDropped = "FlagDropped", FullControl = "FullControl", AllObjectivesTaken = "AllObjectivesTaken", FlagPicked = "FlagPicked", FlagDropped = "FlagDropped",
FlagReturned = "FlagReturned", FlagScored = "FlagScored", TokenDropped = "TokenDropped", TokensBanked = "TokensBanked", TokensLost = "TokensLost", FlagReturned = "FlagReturned", FlagScored = "FlagScored", TokenPicked = "TokenPicked", TokenDropped = "TokenDropped", TokensBanked = "TokensBanked", TokensLost = "TokensLost",
LeaderAssigned = "LeaderAssigned", LeaderDown = "LeaderDown", MiniRoundStarted = "MiniRoundStarted", LeaderAssigned = "LeaderAssigned", LeaderDown = "LeaderDown", MiniRoundStarted = "MiniRoundStarted",
MiniRoundEnded = "MiniRoundEnded", RoleSwap = "RoleSwap", Streak = "Streak", MiniRoundEnded = "MiniRoundEnded", RoleSwap = "RoleSwap", Streak = "Streak",
}) })
+7
View File
@@ -1,6 +1,7 @@
--!strict --!strict
export type Hint = {key: string, text: string, priority: number, cooldown: number?, ttl: number?} export type Hint = {key: string, text: string, priority: number, cooldown: number?, ttl: number?}
export type State = {shownAt: {[string]: number}, current: Hint?, currentUntil: number} export type State = {shownAt: {[string]: number}, current: Hint?, currentUntil: number}
local Config = require(script.Parent.EffectsConfig)
local Hints = {DEFAULT_COOLDOWN = 3, DEFAULT_TTL = 3} local Hints = {DEFAULT_COOLDOWN = 3, DEFAULT_TTL = 3}
function Hints.new(): State return {shownAt = {}, current = nil, currentUntil = 0} end function Hints.new(): State return {shownAt = {}, current = nil, currentUntil = 0} end
function Hints.pick(state: State, candidates: {Hint}, now: number): Hint? function Hints.pick(state: State, candidates: {Hint}, now: number): Hint?
@@ -21,4 +22,10 @@ function Hints.pick(state: State, candidates: {Hint}, now: number): Hint?
end end
return current return current
end end
function Hints.compact(text: string): string
local line = text:gsub("[\r\n]+", " ")
local cut = utf8.offset(line, Config.HintLimit)
if cut and utf8.offset(line, Config.HintLimit + 1) then return line:sub(1, cut - 1) .. "…" end
return line
end
return Hints return Hints
+3 -2
View File
@@ -1,4 +1,5 @@
--!strict --!strict
local Diagnostics = require(script.Parent.ZoneDiagnostics)
local Types = require(script.Parent.Types) local Types = require(script.Parent.Types)
local HotPoint = require(script.Parent.Parent.HotPoint) local HotPoint = require(script.Parent.Parent.HotPoint)
local Sites = require(script.Parent.Parent.ArenaObjectiveSites) local Sites = require(script.Parent.Parent.ArenaObjectiveSites)
@@ -11,7 +12,7 @@ local sides: {Side} = {"Blue", "Orange"}
local blue = Color3.fromRGB(67, 216, 255) local blue = Color3.fromRGB(67, 216, 255)
local orange = Color3.fromRGB(255, 150, 68) local orange = Color3.fromRGB(255, 150, 68)
local gold = Color3.fromRGB(255, 220, 96) local gold = Color3.fromRGB(255, 220, 96)
local neutral = Color3.fromRGB(188, 150, 255) local neutral = Color3.fromRGB(255, 220, 96)
local function opposite(side: Side): Side local function opposite(side: Side): Side
return if side == "Blue" then "Orange" else "Blue" return if side == "Blue" then "Orange" else "Blue"
end end
@@ -88,7 +89,7 @@ local function paint(mark: Marker, tint: Color3)
if aura then aura.Color = tint end if aura then aura.Color = tint end
end end
local function visibleAt(fighter: Fighter, at: Vector3, geometry: RaycastParams): boolean local function visibleAt(fighter: Fighter, at: Vector3, geometry: RaycastParams): boolean
return workspace:Raycast(fighter.root.Position, at - fighter.root.Position, geometry) == nil return Diagnostics.raycast(fighter.root.Position, at - fighter.root.Position, geometry) == nil
end end
local function makeZone(folder: Folder, geometry: RaycastParams, site: Sites.Site, name: string, radius: number?, tint: Color3?): Zone local function makeZone(folder: Folder, geometry: RaycastParams, site: Sites.Site, name: string, radius: number?, tint: Color3?): Zone
local r = radius or HotPoint.Radius local r = radius or HotPoint.Radius
+2
View File
@@ -7,9 +7,11 @@ local remote = if existing and existing:IsA("RemoteEvent") then existing else In
remote.Name = "ArenaObjectiveEvent" remote.Name = "ArenaObjectiveEvent"
remote.Parent = ReplicatedStorage remote.Parent = ReplicatedStorage
local Events = {} local Events = {}
local Diagnostics = require(script.Parent.ZoneDiagnostics)
function Events.new(members: () -> {Player}): Types.Events function Events.new(members: () -> {Player}): Types.Events
return {fire = function(kind, payload, audience) return {fire = function(kind, payload, audience)
Diagnostics.event()
local packet = table.clone(payload or {}) :: {[string]: any} local packet = table.clone(payload or {}) :: {[string]: any}
packet.t = workspace:GetServerTimeNow() packet.t = workspace:GetServerTimeNow()
for _, player in members() do for _, player in members() do
+7 -35
View File
@@ -4,12 +4,13 @@ local Types = require(Runtime.Types)
local Common = require(Runtime.Common) local Common = require(Runtime.Common)
local Kinds = require(game.ReplicatedStorage.Hunter.EventKinds) local Kinds = require(game.ReplicatedStorage.Hunter.EventKinds)
local Strings = require(game.ReplicatedStorage.Hunter.Strings) local Strings = require(game.ReplicatedStorage.Hunter.Strings)
local Diagnostics = require(Runtime.ZoneDiagnostics)
local Context = require(Runtime.Context) local Context = require(Runtime.Context)
local Rules = require(Runtime.FlagRules) local Rules = require(Runtime.FlagRules)
local HotPoint = require(Runtime.Parent.HotPoint) local HotPoint = require(Runtime.Parent.HotPoint)
type Fighter = Types.Fighter type Fighter = Types.Fighter
type Flag = { 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, carrier: Player?, tether: WeldConstraint?, droppedUntil: number,
} }
local function makeFlag(parent: Instance, roof: Vector3): Flag 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) 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 attach("CrownLight", Vector3.new(.33, .33, .33), Vector3.yAxis * 2.34, Common.neutral).Shape = Enum.PartType.Ball
local aura = Instance.new("Attachment") return {marker = mark, light = light, banner = banner,
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,
carrier = nil, tether = nil, droppedUntil = 0} carrier = nil, tether = nil, droppedUntil = 0}
end end
@@ -88,8 +63,7 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
mark.body.CFrame = CFrame.new(at + Vector3.yAxis * 2.4) mark.body.CFrame = CFrame.new(at + Vector3.yAxis * 2.4)
mark.label.Text = if droppedUntil > 0 then Strings.flagDropLabel else Strings.flagRoofLabel mark.label.Text = if droppedUntil > 0 then Strings.flagDropLabel else Strings.flagRoofLabel
mark.label.TextColor3, object.banner.Color = Common.gold, Common.gold mark.label.TextColor3, object.banner.Color = Common.gold, Common.gold
object.stars.Enabled, object.mist.Enabled, object.light.Enabled = true, true, true object.light.Enabled = true
object.stars:Emit(16)
end end
local function pickUpFlag(object: Flag, fighter: Fighter) 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) local tint = Common.color(fighter.side)
object.marker.label.Text = Strings.flagCarrierLabel(fighter.player.DisplayName) object.marker.label.Text = Strings.flagCarrierLabel(fighter.player.DisplayName)
object.marker.label.TextColor3, object.banner.Color = tint, tint object.marker.label.TextColor3, object.banner.Color = tint, tint
object.stars.Enabled, object.mist.Enabled, object.light.Enabled = false, false, false object.light.Enabled = false
object.stars:Clear()
object.mist:Clear()
end end
local function dropCarried(player: Player, at: Vector3?, now: number, fighters: {Fighter}?) local function dropCarried(player: Player, at: Vector3?, now: number, fighters: {Fighter}?)
if flag.carrier == player then if flag.carrier == player then
if at 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 if floor then
putFlag(flag, floor.Position, now + Rules.RETURN_SECONDS) putFlag(flag, floor.Position, now + Rules.RETURN_SECONDS)
for _, fighter in (fighters or Context.collect(ctx.members())) do ctx.legacy(fighter.player, "FlagDropped") end 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 if Common.boundsAt(fighter.root.Position, base, HotPoint.Radius, 7) then
ctx.scoring.add(fighter.side, 1, Kinds.FlagScored, fighter.player) ctx.scoring.add(fighter.side, 1, Kinds.FlagScored, fighter.player)
ctx.contribute(fighter.player, "deliveries", 1) 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) ctx.cue(fighters, true, nil)
putFlag(flag, flag.marker.origin, 0) putFlag(flag, flag.marker.origin, 0)
ctx.events.fire(Kinds.FlagReturned, {at = flag.marker.origin}) 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, end,
score = function(side, points) score = function(side, points)
ctx.scoring.add(side, points, Kinds.ZoneCaptured) 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, end,
status = ctx.status, contribute = ctx.contribute, 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) capture.step(fighters, now, elapsed or dt)
local contested = ctx.state:GetAttribute("HotPointPhase") == "Contested" local contested = ctx.state:GetAttribute("HotPointPhase") == "Contested"
if contested and not wasContested then 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 end
wasContested = contested wasContested = contested
return false return false
+3 -4
View File
@@ -42,7 +42,7 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
zone.marker.body.Parent = nil zone.marker.body.Parent = nil
ctx.janitor.give(zone.marker.body) ctx.janitor.give(zone.marker.body)
table.insert(zones, zone) table.insert(zones, zone)
table.insert(visuals, Effects.new(zone.marker, folder, ctx.janitor)) table.insert(visuals, Effects.new(zone.marker))
end end
data:SetAttribute("Total", #zones) data:SetAttribute("Total", #zones)
local siegeTimes: Score.Ledger = {Blue = {}, Orange = {}} 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 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 elseif phase == "Decaying" then teamTint:Lerp(Color3.fromRGB(150, 162, 182), .45) else teamTint
Common.paint(zone.marker, tint) Common.paint(zone.marker, tint)
visual.update(tint, phase, progress, phase ~= lastStatus)
if phase == "Contested" and lastStatus ~= phase then if phase == "Contested" and lastStatus ~= phase then
ctx.events.fire(Kinds.ZoneContested, {side = siegeSide, index = siegeIndex, at = zone.site.position}) ctx.events.fire(Kinds.ZoneContested, {side = siegeSide, index = siegeIndex, at = zone.site.position})
end 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 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) ctx.scoring.add(siegeSide, SiegeConfig.POINTS_PER_OBJECTIVE, Kinds.ZoneCaptured)
for _, player in attackers do ctx.contribute(player, "captures", 1) end 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) ctx.cue(fighters, true, nil)
siegeCaptureStarted = false siegeCaptureStarted = false
data:SetAttribute(siegeSide .. "Time" .. siegeIndex, elapsed - attackStart) data:SetAttribute(siegeSide .. "Time" .. siegeIndex, elapsed - attackStart)
visual.capture(teamTint) visual.capture()
siegeIndex += 1 siegeIndex += 1
siegeProgress = 0 siegeProgress = 0
if siegeIndex > #zones then if siegeIndex > #zones then
+10 -15
View File
@@ -7,8 +7,8 @@ local Strings = require(game.ReplicatedStorage.Hunter.Strings)
type Fighter = Types.Fighter type Fighter = Types.Fighter
local HotPoint = require(Runtime.Parent.HotPoint) local HotPoint = require(Runtime.Parent.HotPoint)
local Rules = require(Runtime.TrophyRules) local Rules = require(Runtime.TrophyRules)
local TweenService = game:GetService("TweenService") local Diagnostics = require(Runtime.ZoneDiagnostics)
type Drop = {marker: Common.Marker, amount: number, expires: number, fade: Tween?} type Drop = {marker: Common.Marker, amount: number, expires: number}
local function start(ctx: Types.ModeContext): Types.ModeInstance local function start(ctx: Types.ModeContext): Types.ModeInstance
local map, geometry, folder = assert(ctx.map), ctx.geometry, ctx.folder 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 tokens: {Drop} = {}
local carried: {[Player]: number} = {} local carried: {[Player]: number} = {}
local function floorAt(at: Vector3): Vector3 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 return if hit then hit.Position else map.ground.position
end end
local function tokenDrop(at: Vector3, amount: number, now: number) 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 if Rules.canMerge(existing.marker.origin, floor) then
existing.amount += amount existing.amount += amount
existing.expires = now + Rules.LIFETIME existing.expires = now + Rules.LIFETIME
if existing.fade then existing.fade:Cancel(); existing.fade = nil end existing.marker.body:SetAttribute("TokenExpiresAt", existing.expires)
existing.marker.body.Transparency = .04
existing.marker.label.Text = Strings.tokens(existing.amount) existing.marker.label.Text = Strings.tokens(existing.amount)
return return
end end
end end
if #tokens >= Rules.MAX_DROPS then if #tokens >= Rules.MAX_DROPS then
local old = table.remove(tokens, 1) local old = table.remove(tokens, 1)
if old.fade then old.fade:Cancel() end
old.marker.body:Destroy() old.marker.body:Destroy()
end 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 end
local function runTrophies(fighters: {Fighter}, now: number) local function runTrophies(fighters: {Fighter}, now: number)
for i = #tokens, 1, -1 do for i = #tokens, 1, -1 do
local token = tokens[i] local token = tokens[i]
local collector: Fighter? = nil local collector: Fighter? = nil
if now < token.expires then 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 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 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 end
if not collector then continue end if not collector then continue end
local p = collector.player 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 carried[p] = (carried[p] or 0) + token.amount
p:SetAttribute("ArenaTokens", carried[p]) p:SetAttribute("ArenaTokens", carried[p])
end end
if token.fade then token.fade:Cancel() end
token.marker.body:Destroy() token.marker.body:Destroy()
table.remove(tokens, i) table.remove(tokens, i)
end 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 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.scoring.add(f.side, amount, Kinds.TokensBanked, f.player)
ctx.contribute(f.player, "tokensBanked", amount) 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) ctx.cue(fighters, true, nil)
carried[f.player] = nil carried[f.player] = nil
f.player:SetAttribute("ArenaTokens", nil) f.player:SetAttribute("ArenaTokens", nil)
@@ -92,7 +88,6 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
death = drop, leaving = drop, death = drop, leaving = drop,
destroy = function() destroy = function()
for p in carried do p:SetAttribute("ArenaTokens", nil) end 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,
}) })
end end
+6 -96
View File
@@ -1,109 +1,19 @@
--!strict --!strict
local TweenService = game:GetService("TweenService") local Common = require(script.Parent.Common)
local Runtime = script.Parent export type Rig = {show: () -> (), hide: () -> (), capture: () -> ()}
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 Effects = {} local Effects = {}
function Effects.new(mark: Common.Marker, folder: Folder, janitor: Types.Janitor): Rig function Effects.new(mark: Common.Marker): 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
local function hide() local function hide()
cancel() mark.body:SetAttribute("ObjectiveArrowHidden", true)
column.Transparency, wave.Transparency = 1, 1 mark.body.Parent = nil
sparks:Clear()
end end
janitor.give(hide)
return { return {
hide = hide, hide = hide,
show = function() show = function()
hide()
mark.body:SetAttribute("ObjectiveArrowHidden", nil) 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) 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, end,
capture = hide,
} }
end end
return Effects return Effects
+33
View File
@@ -0,0 +1,33 @@
--!strict
local Config = require(game.ReplicatedStorage.Hunter.EffectsConfig)
local Diagnostics = {}
local stepping = false
local rays = 0
local events = 0
local window = 0
function Diagnostics.begin()
stepping = Config.Debug
rays = 0
end
function Diagnostics.raycast(origin: Vector3, direction: Vector3, geometry: RaycastParams): RaycastResult?
if stepping then rays += 1 end
return workspace:Raycast(origin, direction, geometry)
end
function Diagnostics.event()
if Config.Debug then events += 1 end
end
function Diagnostics.finish(state: Instance, fighters: number, now: number)
stepping = false
if not Config.Debug then return end
state:SetAttribute("DebugRays", rays)
state:SetAttribute("DebugFighters", fighters)
if now - window >= 1 then
state:SetAttribute("DebugEvents", events)
window, events = now, 0
end
end
return Diagnostics
+2 -1
View File
@@ -1,4 +1,5 @@
--!strict --!strict
local Diagnostics = require(script.Parent.ZoneDiagnostics)
export type Spec = {radius: number, height: number, sightHeight: number, exclusiveHeight: boolean?} export type Spec = {radius: number, height: number, sightHeight: number, exclusiveHeight: boolean?}
export type Reason = "Outside" | "Height" | "Blocked" | "Inside" export type Reason = "Outside" | "Height" | "Blocked" | "Inside"
local Zones = {} local Zones = {}
@@ -14,6 +15,6 @@ function Zones.classify(position: Vector3, center: Vector3, spec: Spec, geometry
local candidate = Zones.reason(position - center, spec, false) local candidate = Zones.reason(position - center, spec, false)
if candidate ~= "Inside" then return candidate end if candidate ~= "Inside" then return candidate end
local target = center + Vector3.yAxis * spec.sightHeight local target = center + Vector3.yAxis * spec.sightHeight
return if workspace:Raycast(position, target - position, geometry) then "Blocked" else "Inside" return if Diagnostics.raycast(position, target - position, geometry) then "Blocked" else "Inside"
end end
return Zones return Zones
+32 -1
View File
@@ -4,12 +4,15 @@ local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService") local RunService = game:GetService("RunService")
local Modes = require(ReplicatedStorage:WaitForChild("ArenaModes") :: ModuleScript) local Modes = require(ReplicatedStorage:WaitForChild("ArenaModes") :: ModuleScript)
local Input = game:GetService("UserInputService")
local mobile = Input.TouchEnabled and not Input.KeyboardEnabled
local player = Players.LocalPlayer local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui") local playerGui = player:WaitForChild("PlayerGui")
local arena = Modes.geometry(Modes.Procedural) local arena = Modes.geometry(Modes.Procedural)
type Arrow = {gui: Frame, chevrons: {Model}, faces: {BasePart}, edges: {BasePart}, glow: {BasePart}, color: Color3?, phase: number} type Arrow = {gui: Frame, chevrons: {Model}, faces: {BasePart}, edges: {BasePart}, glow: {BasePart}, color: Color3?, phase: number}
local arrows: {[BasePart]: Arrow} = {} local arrows: {[BasePart]: Arrow} = {}
local SIZE = 156 local flatArrows: {[BasePart]: {TextLabel}} = {}
local SIZE = if mobile then 125 else 156
local HEIGHT = 105 local HEIGHT = 105
local MAX_DISTANCE = 710 local MAX_DISTANCE = 710
local ANIMATION_RATE = 2 * math.pi / 4.5 local ANIMATION_RATE = 2 * math.pi / 4.5
@@ -31,6 +34,26 @@ local function build(marker: BasePart)
gui.BackgroundTransparency = 1 gui.BackgroundTransparency = 1
gui.Visible = false gui.Visible = false
if mobile then
local glyphs: {TextLabel} = {}
for index, size in {16, 25, 33} do
local glyph = Instance.new("TextLabel")
glyph.BackgroundTransparency = 1
glyph.AnchorPoint = Vector2.new(.5, .5)
glyph.Size = UDim2.fromOffset(90, 38)
glyph.Font = Enum.Font.GothamBlack
glyph.Text = "⌄"
glyph.TextSize = size
glyph.TextStrokeTransparency = .15
glyph.Parent = gui
glyphs[index] = glyph
end
flatArrows[marker] = glyphs
arrows[marker] = {gui = gui, chevrons = {}, faces = {}, edges = {}, glow = {}, color = nil, phase = marker.Position.X * .03}
gui.Parent = overlay
return
end
local viewport = Instance.new("ViewportFrame") local viewport = Instance.new("ViewportFrame")
viewport.Name = "ArrowViewport" viewport.Name = "ArrowViewport"
viewport.BackgroundTransparency = 1 viewport.BackgroundTransparency = 1
@@ -87,6 +110,7 @@ local function remove(instance: Instance)
local arrow = arrows[instance] local arrow = arrows[instance]
if not arrow then return end if not arrow then return end
arrows[instance] = nil arrows[instance] = nil
flatArrows[instance] = nil
arrow.gui:Destroy() arrow.gui:Destroy()
end end
@@ -115,6 +139,13 @@ RunService:BindToRenderStep(renderName, Enum.RenderPriority.Camera.Value + 3, fu
arrow.gui.Position = UDim2.fromOffset(projected.X, y) arrow.gui.Position = UDim2.fromOffset(projected.X, y)
local spacing = 1.15 + math.sin(phase - .9) * .16 local spacing = 1.15 + math.sin(phase - .9) * .16
local flat = flatArrows[marker]
if flat then
for i, glyph in flat do
glyph.Position = UDim2.new(.5, 0, .5, (i - 2) * 18 * spacing)
glyph.TextColor3 = marker.Color:Lerp(Color3.new(1,1,1), .25)
end
end
for index, chevron in arrow.chevrons do for index, chevron in arrow.chevrons do
chevron:PivotTo(CFrame.new(0, (2 - index) * spacing, 0)) chevron:PivotTo(CFrame.new(0, (2 - index) * spacing, 0))
end end
+29 -13
View File
@@ -18,6 +18,8 @@ local RunService = game:GetService("RunService")
local SoundService = game:GetService("SoundService") local SoundService = game:GetService("SoundService")
local SniperEffects = {} local SniperEffects = {}
local AudioConfig = require(game:GetService("ReplicatedStorage"):WaitForChild("Hunter"):WaitForChild("EffectsConfig") :: ModuleScript)
local activeCues: {Sound} = {}
-- Free Creator Store sounds. volume, plus how far the sound carries when it is in the world. -- Free Creator Store sounds. volume, plus how far the sound carries when it is in the world.
-- group: which volume setting scales it (attribute Vol<group> of the SniperViewmodel config -- group: which volume setting scales it (attribute Vol<group> of the SniperViewmodel config
@@ -40,25 +42,20 @@ local SOUNDS: { [string]: SoundDef } = {
Elimination = { id = "rbxassetid://15675043410", volume = 0.78, speed = 1.18, near = 0, far = 0, group = "Kill", cut = 0.52 }, Elimination = { id = "rbxassetid://15675043410", volume = 0.78, speed = 1.18, near = 0, far = 0, group = "Kill", cut = 0.52 },
StreakAccent = { id = "rbxassetid://3120909354", volume = 0.5, speed = 1, near = 0, far = 0, group = "Kill" }, -- Level_up StreakAccent = { id = "rbxassetid://3120909354", volume = 0.5, speed = 1, near = 0, far = 0, group = "Kill" }, -- Level_up
ReloadReady = { id = "rbxassetid://15675085146", volume = 0.24, speed = 1.15, near = 0, far = 0, group = "Reload", cut = 0.19 }, ReloadReady = { id = "rbxassetid://15675085146", volume = 0.24, speed = 1.15, near = 0, far = 0, group = "Reload", cut = 0.19 },
SiegeEnter = { id = "rbxassetid://113416294133952", volume = .23, speed = 1.30, near = 0, far = 0, group = "HUD" },
SiegeCharge = { id = "rbxassetid://2789428506", volume = .22, speed = 1, near = 0, far = 0, group = "HUD" },
SiegeTick = { id = "rbxassetid://113416294133952", volume = .22, speed = 1.48, near = 0, far = 0, group = "HUD" },
SiegeBlocked = { id = "rbxassetid://2789428506", volume = .25, speed = .70, near = 0, far = 0, group = "HUD" },
SiegeDecay = { id = "rbxassetid://2789428506", volume = .20, speed = .58, near = 0, far = 0, group = "HUD" },
RoundStart = { id = "rbxassetid://4612374036", volume = .27, speed = 1.15, near = 0, far = 0, group = "HUD" },
Tick = { id = "rbxassetid://113416294133952", volume = .22, speed = 1.12, near = 0, far = 0, group = "HUD" },
RoundCountdown = { id = "rbxassetid://113416294133952", volume = 0.25, speed = 1, near = 0, far = 0, group = "HUD" }, -- timer tick
ButtonHover = { id = "rbxassetid://84648433095796", volume = 0.22, speed = 1, near = 0, far = 0, group = "HUD" }, ButtonHover = { id = "rbxassetid://84648433095796", volume = 0.22, speed = 1, near = 0, far = 0, group = "HUD" },
ButtonPress = { id = "rbxassetid://121882355123711", volume = 0.27, speed = 1, near = 0, far = 0, group = "HUD" }, ButtonPress = { id = "rbxassetid://121882355123711", volume = 0.27, speed = 1, near = 0, far = 0, group = "HUD" },
FlagDropped = { id = "rbxassetid://2789428506", volume = 0.23, speed = .72, near = 0, far = 0, group = "HUD" },
HotPointMove = { id = "rbxassetid://113416294133952", volume = 0.23, speed = 1.18, near = 0, far = 0, group = "HUD" },
HotPointStart = { id = "rbxassetid://2789428506", volume = 0.25, speed = 1, near = 0, far = 0, group = "HUD" }, -- Unlock_phoenix
HotPointCaptured = { id = "rbxassetid://4612374036", volume = 0.28, speed = 1, near = 0, far = 0, group = "HUD" }, -- bling_big_diamond_pickup
MoneyCollect1 = { id = "rbxassetid://84894146013271", volume = 0.15, speed = 1, near = 0, far = 0, group = "Pickup", cut = 0.16 }, MoneyCollect1 = { id = "rbxassetid://84894146013271", volume = 0.15, speed = 1, near = 0, far = 0, group = "Pickup", cut = 0.16 },
CupidKnife = { id = "rbxassetid://120151468640015", volume = 0.32, speed = 1, near = 0, far = 0, group = "Pickup" }, CupidKnife = { id = "rbxassetid://120151468640015", volume = 0.32, speed = 1, near = 0, far = 0, group = "Pickup" },
-- a player / bot destroyed: the body breaks apart like blocks (heard by everyone, from the body) -- a player / bot destroyed: the body breaks apart like blocks (heard by everyone, from the body)
Break = { id = "rbxassetid://130215756597524", volume = 1, speed = 1, near = 25, far = 300, group = "Kill" }, -- blockbreak sfx Break = { id = "rbxassetid://130215756597524", volume = 1, speed = 1, near = 25, far = 300, group = "Kill" }, -- blockbreak sfx
} }
local arenaCues: {[string]: boolean} = {}
local function addCue(name: string, cue: AudioConfig.Cue)
SOUNDS[name] = {id = cue.id, volume = cue.volume, speed = cue.speed, near = 0, far = 0, group = "HUD"}
arenaCues[name] = true
end
for name, cue in AudioConfig.Cues do addCue(name, cue) end
for name, target in AudioConfig.Aliases do addCue(name, AudioConfig.Cues[target]) end
SniperEffects.SOUNDS = SOUNDS SniperEffects.SOUNDS = SOUNDS
-- the settings live as attributes on the local player's SniperViewmodel script -- the settings live as attributes on the local player's SniperViewmodel script
@@ -92,7 +89,10 @@ SniperEffects.BOLT_CUES = {
task.spawn(function() task.spawn(function()
-- Sound instances, not bare ids: a bare id string is preloaded as an image and fails -- Sound instances, not bare ids: a bare id string is preloaded as an image and fails
local preload = {} local preload = {}
local seen: {[string]: boolean} = {}
for _, def in SOUNDS do for _, def in SOUNDS do
if def.id == "" or seen[def.id] then continue end
seen[def.id] = true
local s = Instance.new("Sound") local s = Instance.new("Sound")
s.SoundId = def.id s.SoundId = def.id
table.insert(preload, s) table.insert(preload, s)
@@ -105,13 +105,28 @@ end)
function SniperEffects.sound(name: string, at: Instance?, pitch: number?): Sound? function SniperEffects.sound(name: string, at: Instance?, pitch: number?): Sound?
local def = SOUNDS[name] local def = SOUNDS[name]
if not def then if not def or def.id == "" then
return nil return nil
end end
local volume = def.volume * math.max(setting("VolMaster", 1), 0) * math.max(setting("Vol" .. def.group, 1), 0) local volume = def.volume * math.max(setting("VolMaster", 1), 0) * math.max(setting("Vol" .. def.group, 1), 0)
if volume <= 0 then if volume <= 0 then
return nil return nil
end end
local limited = arenaCues[name]
if limited then
for i = #activeCues, 1, -1 do
if not activeCues[i].Parent then table.remove(activeCues, i) end
end
if #activeCues >= AudioConfig.SoundLimit then
-- Убираем самый тихий сигнал. Если новый ещё тише, оставляем текущий микс.
local quietest = 1
for i = 2, #activeCues do
if activeCues[i].Volume < activeCues[quietest].Volume then quietest = i end
end
if activeCues[quietest].Volume > volume then return nil end
table.remove(activeCues, quietest):Destroy()
end
end
local s = Instance.new("Sound") local s = Instance.new("Sound")
s.Name = "Sniper" .. name s.Name = "Sniper" .. name
s.SoundId = def.id s.SoundId = def.id
@@ -123,6 +138,7 @@ function SniperEffects.sound(name: string, at: Instance?, pitch: number?): Sound
s.RollOffMaxDistance = def.far s.RollOffMaxDistance = def.far
end end
s.Parent = at or SoundService s.Parent = at or SoundService
if limited then table.insert(activeCues, s) end
s:Play() s:Play()
if def.cut then if def.cut then
local fade = def.cut local fade = def.cut
+9
View File
@@ -0,0 +1,9 @@
--!strict
return function(budget: any, config: any, hints: any)
assert(budget.profile(true, false) == config.Mobile)
assert(budget.profile(true, true) == config.Desktop)
assert(budget.particles(20, .4) == 8 and budget.particles(0, .4) == 0)
assert(config.Mobile.burstSlots <= config.Mobile.maxEmitters and config.Desktop.burstSlots <= config.Desktop.maxEmitters)
assert(utf8.len(hints.compact(string.rep("я", 100))) == config.HintLimit)
assert(hints.compact("Одна\nстрока") == "Одна строка")
end