13
This commit is contained in:
1 parent
d0f85a5fa8
commit
38e4e1c302
5 files changed
+156
-3
No files matched your search
@@ -1,4 +1,6 @@
|
||||
--!strict
|
||||
local Debris = game:GetService("Debris")
|
||||
local TweenService = game:GetService("TweenService")
|
||||
local Sites = require(script.Parent:WaitForChild("ArenaObjectiveSites") :: ModuleScript)
|
||||
|
||||
type Side = "Blue" | "Orange"
|
||||
@@ -104,6 +106,40 @@ function HotPoint.attachRing(mark: Marker): (Color3) -> ()
|
||||
end
|
||||
end
|
||||
|
||||
local function captureWave(mark: Marker)
|
||||
local motion = TweenInfo.new(.55, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
|
||||
local center = mark.body.CFrame:PointToObjectSpace(mark.origin + Vector3.yAxis * .29)
|
||||
local tips: {[Attachment]: Attachment} = {}
|
||||
local function waveTip(original: Attachment): Attachment
|
||||
local existing = tips[original]
|
||||
if existing then return existing end
|
||||
local tip = original:Clone()
|
||||
tip:ClearAllChildren()
|
||||
local offset = original.Position - center
|
||||
tip.Position = center + offset * .78
|
||||
tip.Parent = mark.body
|
||||
tips[original] = tip
|
||||
TweenService:Create(tip, motion, {Position = center + offset * 1.25}):Play()
|
||||
Debris:AddItem(tip, .6)
|
||||
return tip
|
||||
end
|
||||
for _, child in mark.body:GetChildren() do
|
||||
if not child:IsA("Beam") or child.Name ~= "FloorRing" then continue end
|
||||
local a, b = child.Attachment0, child.Attachment1
|
||||
if not a or not b then continue end
|
||||
local wave = child:Clone()
|
||||
wave.Name = "CaptureWave"
|
||||
wave.Attachment0, wave.Attachment1 = waveTip(a), waveTip(b)
|
||||
wave.CurveSize0, wave.CurveSize1 = child.CurveSize0 * .78, child.CurveSize1 * .78
|
||||
wave.Width0, wave.Width1 = 1.25, 1.25
|
||||
wave.Parent = mark.body
|
||||
TweenService:Create(wave, motion, {
|
||||
CurveSize0 = child.CurveSize0 * 1.25, CurveSize1 = child.CurveSize1 * 1.25, Width0 = 0, Width1 = 0,
|
||||
}):Play()
|
||||
Debris:AddItem(wave, .6)
|
||||
end
|
||||
end
|
||||
|
||||
function HotPoint.start(config: Config): Capture
|
||||
local state = config.state
|
||||
local index, credit, hitSince, hitUntil, flashUntil = 0, 0, 0, 0, 0
|
||||
@@ -149,6 +185,10 @@ function HotPoint.start(config: Config): Capture
|
||||
if mark then mark.body:Destroy() end
|
||||
local fresh = config.marker(site)
|
||||
index, mark, paint = slot, fresh, HotPoint.attachRing(fresh)
|
||||
state:SetAttribute("HotPointPosition", site.position)
|
||||
local nextSite = config.sites[slot % #config.sites + 1]
|
||||
state:SetAttribute("HotPointNextPosition", if #config.sites > 1 then nextSite.position else nil)
|
||||
state:SetAttribute("HotPointMovesAt", config.startedAt + (math.floor(elapsed / ROTATION_SECONDS) + 1) * ROTATION_SECONDS)
|
||||
owner, flashUntil, lastTint = nil, 0, nil
|
||||
clearCapture()
|
||||
end
|
||||
@@ -193,6 +233,7 @@ function HotPoint.start(config: Config): Capture
|
||||
clearCapture()
|
||||
publish(side, 100, "Captured")
|
||||
paintRing(teamColor[side])
|
||||
if mark then captureWave(mark) end
|
||||
else
|
||||
local phase = if isContested then "Contested" elseif underFire then "UnderFire" else "Capturing"
|
||||
publish(side, math.floor(100 * credit / CAPTURE_SECONDS), phase)
|
||||
@@ -224,6 +265,9 @@ function HotPoint.start(config: Config): Capture
|
||||
death = death,
|
||||
destroy = function()
|
||||
publish(nil, 0, nil)
|
||||
state:SetAttribute("HotPointPosition", nil)
|
||||
state:SetAttribute("HotPointNextPosition", nil)
|
||||
state:SetAttribute("HotPointMovesAt", nil)
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user