333
This commit is contained in:
1 parent
82eecfda06
commit
bdf5eca81f
10 files changed
+287
-94
No files matched your search
+80
-52
@@ -1,5 +1,4 @@
|
||||
--!strict
|
||||
local Debris = game:GetService("Debris")
|
||||
local TweenService = game:GetService("TweenService")
|
||||
local Sites = require(script.Parent:WaitForChild("ArenaObjectiveSites") :: ModuleScript)
|
||||
|
||||
@@ -18,6 +17,9 @@ type Capture = {
|
||||
local HotPoint = {Radius = 18}
|
||||
local CAPTURE_SECONDS = 10
|
||||
local ROTATION_SECONDS = 40
|
||||
local COLLAPSE_SECONDS = .55
|
||||
local CAPTURE_NOTICE_SECONDS = 2
|
||||
local NEXT_POINT_WARNING_SECONDS = 5
|
||||
local TEAM_SPEED = 1.5
|
||||
local HIT_WINDOW = 1.2
|
||||
local HIT_DECAY = .8
|
||||
@@ -106,44 +108,54 @@ 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)
|
||||
local function collapse(mark: Marker)
|
||||
local body = mark.body
|
||||
local motion = TweenInfo.new(COLLAPSE_SECONDS, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
|
||||
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
|
||||
|
||||
function HotPoint.start(config: Config): Capture
|
||||
local state = config.state
|
||||
local index, credit, hitSince, hitUntil, flashUntil = 0, 0, 0, 0, 0
|
||||
local owner: Side? = nil
|
||||
local index, credit, hitSince, hitUntil = 0, 0, 0, 0
|
||||
local movesAt = config.startedAt
|
||||
local capturedAt = 0
|
||||
local capturedSide: Side? = nil
|
||||
local claiming: Side? = nil
|
||||
local capturers: {[Player]: boolean} = {}
|
||||
local mark: Marker? = nil
|
||||
@@ -178,20 +190,31 @@ function HotPoint.start(config: Config): Capture
|
||||
end
|
||||
|
||||
local function step(fighters: {Fighter}, now: number, dt: number)
|
||||
local elapsed = math.max(0, now - config.startedAt)
|
||||
local slot = math.floor(elapsed / ROTATION_SECONDS) % #config.sites + 1
|
||||
local site = config.sites[slot]
|
||||
if index ~= slot then
|
||||
if index == 0 or now >= movesAt then
|
||||
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
|
||||
index = index % #config.sites + 1
|
||||
local activeSite = config.sites[index]
|
||||
local fresh = config.marker(activeSite)
|
||||
mark, paint, lastTint = fresh, HotPoint.attachRing(fresh), nil
|
||||
capturedSide = nil
|
||||
movesAt = now + ROTATION_SECONDS
|
||||
clearCapture()
|
||||
publish(nil, 0, nil)
|
||||
state:SetAttribute("HotPointPosition", activeSite.position)
|
||||
state:SetAttribute("HotPointNextPosition", config.sites[index % #config.sites + 1].position)
|
||||
state:SetAttribute("HotPointMovesAt", movesAt)
|
||||
elseif capturedSide then
|
||||
local since = now - capturedAt
|
||||
if since >= COLLAPSE_SECONDS + CAPTURE_NOTICE_SECONDS then
|
||||
publish(nil, 0, nil)
|
||||
config.status("Скоро появится новая точка")
|
||||
elseif since >= COLLAPSE_SECONDS then
|
||||
publish(capturedSide, 100, "Captured")
|
||||
config.status("Точка захвачена")
|
||||
end
|
||||
return
|
||||
end
|
||||
local site = config.sites[index]
|
||||
|
||||
local blue, orange = 0, 0
|
||||
local inside: {Fighter} = {}
|
||||
@@ -200,11 +223,11 @@ function HotPoint.start(config: Config): Capture
|
||||
table.insert(inside, fighter)
|
||||
if fighter.side == "Blue" then blue += 1 else orange += 1 end
|
||||
end
|
||||
local remaining = math.ceil(ROTATION_SECONDS - elapsed % ROTATION_SECONDS)
|
||||
local remaining = math.ceil(movesAt - now)
|
||||
config.status(site.name .. " · Смена точки через " .. remaining .. " с")
|
||||
local soleSide: Side? = if blue > 0 and orange == 0 then "Blue" elseif orange > 0 and blue == 0 then "Orange" else nil
|
||||
local isContested = blue > 0 and orange > 0
|
||||
if soleSide and soleSide ~= owner then
|
||||
if soleSide then
|
||||
if claiming ~= soleSide then
|
||||
clearCapture()
|
||||
claiming = soleSide
|
||||
@@ -228,12 +251,16 @@ function HotPoint.start(config: Config): Capture
|
||||
credit += (dt - damageTime) * (if count >= 2 then TEAM_SPEED else 1)
|
||||
end
|
||||
if credit >= CAPTURE_SECONDS then
|
||||
owner, flashUntil = side, now + 1.25
|
||||
capturedSide, capturedAt = side, now
|
||||
movesAt = now + COLLAPSE_SECONDS + CAPTURE_NOTICE_SECONDS + NEXT_POINT_WARNING_SECONDS
|
||||
config.score(side, 1)
|
||||
clearCapture()
|
||||
publish(side, 100, "Captured")
|
||||
publish(nil, 0, nil)
|
||||
config.status("")
|
||||
state:SetAttribute("HotPointPosition", nil)
|
||||
state:SetAttribute("HotPointMovesAt", movesAt)
|
||||
paintRing(teamColor[side])
|
||||
if mark then captureWave(mark) end
|
||||
if mark then collapse(mark) end
|
||||
else
|
||||
local phase = if isContested then "Contested" elseif underFire then "UnderFire" else "Capturing"
|
||||
publish(side, math.floor(100 * credit / CAPTURE_SECONDS), phase)
|
||||
@@ -243,8 +270,8 @@ function HotPoint.start(config: Config): Capture
|
||||
publish(nil, 0, "Contested")
|
||||
paintRing(contested)
|
||||
else
|
||||
if owner and now < flashUntil then publish(owner, 100, "Captured") else publish(nil, 0, nil) end
|
||||
paintRing(if owner then teamColor[owner] else neutral)
|
||||
publish(nil, 0, nil)
|
||||
paintRing(neutral)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -264,6 +291,7 @@ function HotPoint.start(config: Config): Capture
|
||||
end,
|
||||
death = death,
|
||||
destroy = function()
|
||||
if mark then mark.body:Destroy() end
|
||||
publish(nil, 0, nil)
|
||||
state:SetAttribute("HotPointPosition", nil)
|
||||
state:SetAttribute("HotPointNextPosition", nil)
|
||||
|
||||
Reference in new issue
Block a user