Polish arena effects, audio and diagnostics
This commit is contained in:
1 parent
2774e625c1
commit
16a359d4af
28 files changed
+512
-257
No files matched your search
@@ -4,6 +4,8 @@ local Runtime = script.Parent:WaitForChild("ModeRuntime")
|
||||
local Types = require(Runtime:WaitForChild("Types") :: ModuleScript)
|
||||
local Context = require(Runtime:WaitForChild("Context") :: ModuleScript)
|
||||
|
||||
local Diagnostics = require(Runtime:WaitForChild("ZoneDiagnostics") :: ModuleScript)
|
||||
|
||||
export type Match = {
|
||||
step: (number) -> boolean, kill: (Player, Player, Vector3, number) -> (),
|
||||
hit: ((Player, number, boolean) -> ())?,
|
||||
@@ -41,6 +43,7 @@ function Objectives.start(config: Types.Config): Match
|
||||
end
|
||||
local instance = result :: Types.ModeInstance
|
||||
local lastStep = ctx.liveAt
|
||||
local profileLabel = "Mode." .. mode.id .. ".step"
|
||||
local destroyed = false
|
||||
local match: Match
|
||||
match = {
|
||||
@@ -48,7 +51,14 @@ function Objectives.start(config: Types.Config): Match
|
||||
if destroyed then return false end
|
||||
local elapsed = math.max(0, now - lastStep)
|
||||
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,
|
||||
kill = instance.kill, hit = instance.hit, death = instance.death, leaving = instance.leaving,
|
||||
winner = function()
|
||||
@@ -65,6 +75,7 @@ function Objectives.start(config: Types.Config): Match
|
||||
ctx.folder:Destroy()
|
||||
ctx.status("")
|
||||
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
|
||||
end,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user