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
@@ -1,4 +1,5 @@
|
||||
--!strict
|
||||
local Diagnostics = require(script.Parent.ZoneDiagnostics)
|
||||
local Types = require(script.Parent.Types)
|
||||
local HotPoint = require(script.Parent.Parent.HotPoint)
|
||||
local Sites = require(script.Parent.Parent.ArenaObjectiveSites)
|
||||
@@ -11,7 +12,7 @@ local sides: {Side} = {"Blue", "Orange"}
|
||||
local blue = Color3.fromRGB(67, 216, 255)
|
||||
local orange = Color3.fromRGB(255, 150, 68)
|
||||
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
|
||||
return if side == "Blue" then "Orange" else "Blue"
|
||||
end
|
||||
@@ -88,7 +89,7 @@ local function paint(mark: Marker, tint: Color3)
|
||||
if aura then aura.Color = tint end
|
||||
end
|
||||
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
|
||||
local function makeZone(folder: Folder, geometry: RaycastParams, site: Sites.Site, name: string, radius: number?, tint: Color3?): Zone
|
||||
local r = radius or HotPoint.Radius
|
||||
|
||||
@@ -7,9 +7,11 @@ local remote = if existing and existing:IsA("RemoteEvent") then existing else In
|
||||
remote.Name = "ArenaObjectiveEvent"
|
||||
remote.Parent = ReplicatedStorage
|
||||
local Events = {}
|
||||
local Diagnostics = require(script.Parent.ZoneDiagnostics)
|
||||
|
||||
function Events.new(members: () -> {Player}): Types.Events
|
||||
return {fire = function(kind, payload, audience)
|
||||
Diagnostics.event()
|
||||
local packet = table.clone(payload or {}) :: {[string]: any}
|
||||
packet.t = workspace:GetServerTimeNow()
|
||||
for _, player in members() do
|
||||
|
||||
@@ -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})
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,109 +1,19 @@
|
||||
--!strict
|
||||
local TweenService = game:GetService("TweenService")
|
||||
local Runtime = script.Parent
|
||||
local Common = require(Runtime.Common)
|
||||
local Types = require(Runtime.Types)
|
||||
local Config = require(game.ReplicatedStorage.CitadelAssaultConfig)
|
||||
export type Rig = {show: () -> (), hide: () -> (), update: (Color3, string, number, boolean) -> (), capture: (Color3) -> ()}
|
||||
|
||||
local function newPart(name: string, parent: Instance): Part
|
||||
local p = Instance.new("Part")
|
||||
p.Name, p.Shape, p.Material = name, Enum.PartType.Cylinder, Enum.Material.Neon
|
||||
p.CanCollide, p.CanQuery, p.CanTouch, p.Anchored, p.CastShadow = false, false, false, true, false
|
||||
p.Transparency = 1
|
||||
p.Parent = parent
|
||||
return p
|
||||
end
|
||||
|
||||
local Common = require(script.Parent.Common)
|
||||
export type Rig = {show: () -> (), hide: () -> (), capture: () -> ()}
|
||||
local Effects = {}
|
||||
function Effects.new(mark: Common.Marker, folder: Folder, janitor: Types.Janitor): Rig
|
||||
local root = Instance.new("Folder")
|
||||
root.Name = "SiegeLight"
|
||||
root.Parent = folder
|
||||
local column = newPart("Column", root)
|
||||
local wave = newPart("Shockwave", root)
|
||||
local anchor = Instance.new("Attachment")
|
||||
anchor.Parent = wave
|
||||
local sparks = Instance.new("ParticleEmitter")
|
||||
sparks.Texture = "rbxasset://textures/particles/sparkles_main.dds"
|
||||
sparks.Speed, sparks.Lifetime, sparks.Rate = NumberRange.new(12, 25), NumberRange.new(.45, 1.2), 0
|
||||
sparks.SpreadAngle = Vector2.new(145, 145)
|
||||
sparks.LightEmission = 1
|
||||
sparks.Parent = anchor
|
||||
local diameter = Config.CAPTURE_RADIUS * 2
|
||||
local rotation = CFrame.Angles(0, 0, math.pi / 2)
|
||||
local floor = CFrame.new(mark.origin + Vector3.yAxis * .21) * rotation
|
||||
wave.CFrame = floor
|
||||
local width = 3.5
|
||||
local fullColumn = CFrame.new(mark.origin + Vector3.yAxis * (Config.LIGHT_HEIGHT / 2)) * rotation
|
||||
local motion: Tween? = nil
|
||||
local lightMotion: Tween? = nil
|
||||
local effect: Tween? = nil
|
||||
local run = 0
|
||||
local function cancel()
|
||||
run += 1
|
||||
if motion then motion:Cancel() end
|
||||
if lightMotion then lightMotion:Cancel() end
|
||||
if effect then effect:Cancel() end
|
||||
end
|
||||
function Effects.new(mark: Common.Marker): Rig
|
||||
local function hide()
|
||||
cancel()
|
||||
column.Transparency, wave.Transparency = 1, 1
|
||||
sparks:Clear()
|
||||
mark.body:SetAttribute("ObjectiveArrowHidden", true)
|
||||
mark.body.Parent = nil
|
||||
end
|
||||
janitor.give(hide)
|
||||
|
||||
return {
|
||||
hide = hide,
|
||||
show = function()
|
||||
hide()
|
||||
mark.body:SetAttribute("ObjectiveArrowHidden", nil)
|
||||
mark.label.Visible = true
|
||||
mark.body.Size = Vector3.new(.16, diameter * .15, diameter * .15)
|
||||
mark.body.Transparency = .92
|
||||
Common.paint(mark, Common.gold)
|
||||
column.Color = Common.gold
|
||||
column.Size, column.CFrame = Vector3.new(.2, width, width), floor
|
||||
column.Transparency = .85
|
||||
local t = TweenInfo.new(Config.MATERIALIZE_SECONDS, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
|
||||
motion = TweenService:Create(mark.body, t, {Size = Vector3.new(.16, diameter, diameter)})
|
||||
lightMotion = TweenService:Create(column, t, {CFrame = fullColumn, Size = Vector3.new(Config.LIGHT_HEIGHT, width, width)})
|
||||
motion:Play()
|
||||
lightMotion:Play()
|
||||
end,
|
||||
update = function(tint, phase, progress, changed)
|
||||
column.Color = tint
|
||||
column.Transparency = if phase == "Capturing" then 1 - (.55 + .45 * progress) * .25
|
||||
elseif phase == "Decaying" then .94 else .86
|
||||
if phase == "Contested" and changed then
|
||||
wave.Color, wave.Transparency = tint, .68
|
||||
wave.Size = Vector3.new(.12, diameter, diameter)
|
||||
if effect then effect:Cancel() end
|
||||
effect = TweenService:Create(wave, TweenInfo.new(.25), {Transparency = 1})
|
||||
effect:Play()
|
||||
end
|
||||
end,
|
||||
capture = function(tint)
|
||||
cancel()
|
||||
local token = run
|
||||
Common.paint(mark, Color3.new(1, 1, 1))
|
||||
mark.body:SetAttribute("ObjectiveArrowHidden", true)
|
||||
mark.label.Visible = false
|
||||
wave.Size = Vector3.new(.11, diameter, diameter)
|
||||
wave.Color, wave.Transparency = tint, .55
|
||||
sparks.Color = ColorSequence.new(tint)
|
||||
sparks:Emit(Config.CONFETTI_COUNT)
|
||||
local t = TweenInfo.new(Config.CAPTURE_EFFECT_SECONDS, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
|
||||
motion = TweenService:Create(mark.body, t, {Size = Vector3.new(.16, .1, .1), Transparency = 1})
|
||||
lightMotion = TweenService:Create(column, t, {Size = Vector3.new(.2, width, width), CFrame = floor, Transparency = 1})
|
||||
effect = TweenService:Create(wave, t, {Size = Vector3.new(.11, diameter * 1.6, diameter * 1.6), Transparency = 1})
|
||||
motion:Play()
|
||||
lightMotion:Play()
|
||||
effect:Play()
|
||||
task.delay(Config.CAPTURE_EFFECT_SECONDS, function()
|
||||
if token == run and mark.body.Parent == folder then mark.body.Parent = nil end
|
||||
end)
|
||||
end,
|
||||
capture = hide,
|
||||
}
|
||||
end
|
||||
return Effects
|
||||
@@ -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
|
||||
@@ -1,4 +1,5 @@
|
||||
--!strict
|
||||
local Diagnostics = require(script.Parent.ZoneDiagnostics)
|
||||
export type Spec = {radius: number, height: number, sightHeight: number, exclusiveHeight: boolean?}
|
||||
export type Reason = "Outside" | "Height" | "Blocked" | "Inside"
|
||||
local Zones = {}
|
||||
@@ -14,6 +15,6 @@ function Zones.classify(position: Vector3, center: Vector3, spec: Spec, geometry
|
||||
local candidate = Zones.reason(position - center, spec, false)
|
||||
if candidate ~= "Inside" then return candidate end
|
||||
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
|
||||
return Zones
|
||||
Reference in new issue
Block a user