333
This commit is contained in:
1 parent
82eecfda06
commit
bdf5eca81f
10 files changed
+287
-94
No files matched your search
BIN
Binary file not shown.
@@ -77,6 +77,7 @@ end
|
|||||||
local function marker(parent: Instance, id: string, name: string, at: Vector3, tint: Color3, diameter: number, tall: boolean?): Marker
|
local function marker(parent: Instance, id: string, name: string, at: Vector3, tint: Color3, diameter: number, tall: boolean?): Marker
|
||||||
local part = Instance.new("Part")
|
local part = Instance.new("Part")
|
||||||
part.Name = id
|
part.Name = id
|
||||||
|
if not tall then part:SetAttribute("ObjectiveArrow", true) end
|
||||||
part.Shape = if tall then Enum.PartType.Ball else Enum.PartType.Cylinder
|
part.Shape = if tall then Enum.PartType.Ball else Enum.PartType.Cylinder
|
||||||
part.Size = if tall then Vector3.new(diameter, diameter, diameter) else Vector3.new(.16, diameter, diameter)
|
part.Size = if tall then Vector3.new(diameter, diameter, diameter) else Vector3.new(.16, diameter, diameter)
|
||||||
part.CFrame = CFrame.new(at + Vector3.yAxis * (if tall then 2.4 else .12)) * CFrame.Angles(0, 0, math.pi / 2)
|
part.CFrame = CFrame.new(at + Vector3.yAxis * (if tall then 2.4 else .12)) * CFrame.Angles(0, 0, math.pi / 2)
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ local function refreshCapture()
|
|||||||
local match = activeState()
|
local match = activeState()
|
||||||
local phase = match:GetAttribute("HotPointPhase") :: string?
|
local phase = match:GetAttribute("HotPointPhase") :: string?
|
||||||
local team = player:GetAttribute("ArenaTeam")
|
local team = player:GetAttribute("ArenaTeam")
|
||||||
if not phase or (team ~= "Blue" and team ~= "Orange") or match:GetAttribute("Phase") ~= "Round"
|
if player:GetAttribute("InArena") ~= true or not phase or (team ~= "Blue" and team ~= "Orange") or match:GetAttribute("Phase") ~= "Round"
|
||||||
or match:GetAttribute("Ruleset") ~= "HotPoint" then
|
or match:GetAttribute("Ruleset") ~= "HotPoint" then
|
||||||
if captureTween then captureTween:Cancel(); captureTween = nil end
|
if captureTween then captureTween:Cancel(); captureTween = nil end
|
||||||
captureHud.Visible, captureTeam, capturePercent = false, nil, 0
|
captureHud.Visible, captureTeam, capturePercent = false, nil, 0
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ local function sendToLobby(player: Player)
|
|||||||
lastCountedDeath[player] = nil
|
lastCountedDeath[player] = nil
|
||||||
moveToLobby(player)
|
moveToLobby(player)
|
||||||
player:SetAttribute("ArenaWaiting", nil)
|
player:SetAttribute("ArenaWaiting", nil)
|
||||||
|
player:SetAttribute("ArenaIntermission", nil)
|
||||||
player:SetAttribute("ArenaMode", nil)
|
player:SetAttribute("ArenaMode", nil)
|
||||||
player:SetAttribute("ArenaTeam", nil)
|
player:SetAttribute("ArenaTeam", nil)
|
||||||
player:SetAttribute("RoundKills", 0)
|
player:SetAttribute("RoundKills", 0)
|
||||||
@@ -234,6 +235,17 @@ local function deploy(player: Player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function stageOnArena(player: Player)
|
||||||
|
placedCharacter[player] = nil
|
||||||
|
player:SetAttribute("InArena", true)
|
||||||
|
player.RespawnLocation = destinationFor(player)
|
||||||
|
local character = player.Character
|
||||||
|
clearTools(character)
|
||||||
|
clearTools(player:FindFirstChildOfClass("Backpack"))
|
||||||
|
clearTools(player:FindFirstChild("StarterGear"))
|
||||||
|
return character
|
||||||
|
end
|
||||||
|
|
||||||
local function enterRound(player: Player, match: Match)
|
local function enterRound(player: Player, match: Match)
|
||||||
if match.rule == "OneLife" then bench(player) else deploy(player) end
|
if match.rule == "OneLife" then bench(player) else deploy(player) end
|
||||||
end
|
end
|
||||||
@@ -265,7 +277,11 @@ local function onCharacter(player: Player, character: Model)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
if roster[player] and player:GetAttribute("InArena") == true then
|
if roster[player] and player:GetAttribute("InArena") == true then
|
||||||
enterArena(player, character, humanoid)
|
if player:GetAttribute("ArenaIntermission") == true or player:GetAttribute("ArenaWaiting") == true then
|
||||||
|
ArenaSpawns.place(character, destinationFor(player))
|
||||||
|
else
|
||||||
|
enterArena(player, character, humanoid)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
ArenaSpawns.place(character, lobbySpawn)
|
ArenaSpawns.place(character, lobbySpawn)
|
||||||
end
|
end
|
||||||
@@ -309,7 +325,7 @@ end
|
|||||||
local function broadcastVotes(match: Match)
|
local function broadcastVotes(match: Match)
|
||||||
local counts, total = voteTotals(match)
|
local counts, total = voteTotals(match)
|
||||||
for player in match.eligible do
|
for player in match.eligible do
|
||||||
if player.Parent == Players and not roster[player] then
|
if player.Parent == Players then
|
||||||
vote:FireClient(player, match.id, match.endsAt, counts, total, match.ballots[player])
|
vote:FireClient(player, match.id, match.endsAt, counts, total, match.ballots[player])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -381,6 +397,10 @@ end
|
|||||||
|
|
||||||
leave.OnServerEvent:Connect(function(player: Player)
|
leave.OnServerEvent:Connect(function(player: Player)
|
||||||
if not roster[player] or player:GetAttribute("InArena") ~= true then return end
|
if not roster[player] or player:GetAttribute("InArena") ~= true then return end
|
||||||
|
local match = matches[Modes.of(player)]
|
||||||
|
if match.phase ~= "Round" then return end
|
||||||
|
local root = player.Character and player.Character.PrimaryPart
|
||||||
|
if match.engine then match.engine.leaving(player, root and root.Position, workspace:GetServerTimeNow()) end
|
||||||
sendToLobby(player)
|
sendToLobby(player)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -467,7 +487,7 @@ end
|
|||||||
vote.OnServerEvent:Connect(function(player: Player, arena: unknown, id: unknown)
|
vote.OnServerEvent:Connect(function(player: Player, arena: unknown, id: unknown)
|
||||||
if typeof(arena) ~= "string" then return end
|
if typeof(arena) ~= "string" then return end
|
||||||
local match, rule = matches[arena], Rules.find(id)
|
local match, rule = matches[arena], Rules.find(id)
|
||||||
if not match or not rule or not match.eligible[player] or roster[player] then return end
|
if not match or not rule or not match.eligible[player] then return end
|
||||||
local now = workspace:GetServerTimeNow()
|
local now = workspace:GetServerTimeNow()
|
||||||
if not votingOpen(match, now) or now - (lastVote[player] or -math.huge) < .18 or match.ballots[player] == rule.id then return end
|
if not votingOpen(match, now) or now - (lastVote[player] or -math.huge) < .18 or match.ballots[player] == rule.id then return end
|
||||||
lastVote[player] = now
|
lastVote[player] = now
|
||||||
@@ -513,8 +533,12 @@ local function returnVoters(match: Match)
|
|||||||
local returning: {Player} = {}
|
local returning: {Player} = {}
|
||||||
for _, player in Players:GetPlayers() do
|
for _, player in Players:GetPlayers() do
|
||||||
local previousSide = match.eligible[player]
|
local previousSide = match.eligible[player]
|
||||||
if previousSide and match.ballots[player] and not roster[player] then
|
if previousSide and (not match.allowModeChange or match.ballots[player]) then
|
||||||
assignTeam(player, match, previousSide)
|
assignTeam(player, match, previousSide)
|
||||||
|
player:SetAttribute("RoundKills", 0)
|
||||||
|
player:SetAttribute("RoundDeaths", 0)
|
||||||
|
lastCountedDeath[player] = nil
|
||||||
|
resetStreak(player)
|
||||||
table.insert(returning, player)
|
table.insert(returning, player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -523,7 +547,20 @@ local function returnVoters(match: Match)
|
|||||||
if #returning == 0 then return end
|
if #returning == 0 then return end
|
||||||
|
|
||||||
balanceWaiting(match)
|
balanceWaiting(match)
|
||||||
for _, player in returning do enterRound(player, match) end
|
for _, player in returning do
|
||||||
|
if match.rule == "OneLife" then
|
||||||
|
player:SetAttribute("ArenaWaiting", true)
|
||||||
|
local character = stageOnArena(player)
|
||||||
|
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
|
||||||
|
if character and humanoid and humanoid.Health > 0 then
|
||||||
|
humanoid.Health = humanoid.MaxHealth
|
||||||
|
ArenaSpawns.place(character, destinationFor(player))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
deploy(player)
|
||||||
|
end
|
||||||
|
player:SetAttribute("ArenaIntermission", nil)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function startRound(match: Match)
|
local function startRound(match: Match)
|
||||||
@@ -627,8 +664,15 @@ local function finishRound(match: Match)
|
|||||||
publish(match)
|
publish(match)
|
||||||
for _, entry in participants do
|
for _, entry in participants do
|
||||||
local player = entry.player
|
local player = entry.player
|
||||||
sendToLobby(player)
|
|
||||||
match.eligible[player] = entry.side
|
match.eligible[player] = entry.side
|
||||||
|
player:SetAttribute("ArenaIntermission", true)
|
||||||
|
local wasInArena = player:GetAttribute("InArena") == true
|
||||||
|
player:SetAttribute("ArenaWaiting", nil)
|
||||||
|
local character = stageOnArena(player)
|
||||||
|
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
|
||||||
|
if not wasInArena and character and humanoid and humanoid.Health > 0 then
|
||||||
|
ArenaSpawns.place(character, destinationFor(player))
|
||||||
|
end
|
||||||
results:FireClient(player, snapshot, entry.side)
|
results:FireClient(player, snapshot, entry.side)
|
||||||
end
|
end
|
||||||
if engine then engine.destroy() end
|
if engine then engine.destroy() end
|
||||||
@@ -657,12 +701,13 @@ local function finishVote(match: Match, now: number)
|
|||||||
publish(match)
|
publish(match)
|
||||||
local outcome = {winner = match.rule, endsAt = match.endsAt}
|
local outcome = {winner = match.rule, endsAt = match.endsAt}
|
||||||
for player in match.eligible do
|
for player in match.eligible do
|
||||||
if player.Parent == Players and not roster[player] then
|
if player.Parent == Players then
|
||||||
vote:FireClient(player, match.id, ballotDeadline, counts, total, match.ballots[player], outcome)
|
local selection = match.ballots[player]
|
||||||
|
vote:FireClient(player, match.id, ballotDeadline, counts, total, selection, outcome)
|
||||||
|
if not selection then sendToLobby(player) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if match.phase == "Reveal" then return end
|
|
||||||
match.phase = "Setup"
|
match.phase = "Setup"
|
||||||
startRound(match)
|
startRound(match)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,26 +4,31 @@ local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
|||||||
local Sounds = require(ReplicatedStorage:WaitForChild("SniperEffects") :: ModuleScript)
|
local Sounds = require(ReplicatedStorage:WaitForChild("SniperEffects") :: ModuleScript)
|
||||||
|
|
||||||
local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
|
local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
|
||||||
local hoverDef = Sounds.SOUNDS.ButtonHover
|
local function prepareCue(name: string, startSeconds: number): () -> ()
|
||||||
-- The supplied recording has about 0.38 seconds of silence before the cue.
|
local def = Sounds.SOUNDS[name]
|
||||||
local HOVER_START_SECONDS = .38
|
local sound = Instance.new("Sound")
|
||||||
local hover = Instance.new("Sound")
|
sound.Name = "Sniper" .. name
|
||||||
hover.Name = "SniperButtonHover"
|
sound.SoundId = def.id
|
||||||
hover.SoundId = hoverDef.id
|
sound.PlaybackSpeed = def.speed
|
||||||
hover.PlaybackSpeed = hoverDef.speed
|
sound.Parent = game:GetService("SoundService")
|
||||||
hover.Parent = game:GetService("SoundService")
|
script.Destroying:Once(function() sound:Destroy() end)
|
||||||
script.Destroying:Once(function() hover:Destroy() end)
|
|
||||||
|
|
||||||
local function playHover()
|
return function()
|
||||||
if not hover.IsLoaded then return end
|
if not sound.IsLoaded then return end
|
||||||
local volume = hoverDef.volume * math.max(Sounds.setting("VolMaster", 1), 0)
|
local volume = def.volume * math.max(Sounds.setting("VolMaster", 1), 0)
|
||||||
* math.max(Sounds.setting("Vol" .. hoverDef.group, 1), 0)
|
* math.max(Sounds.setting("Vol" .. def.group, 1), 0)
|
||||||
if volume <= 0 then return end
|
if volume <= 0 then return end
|
||||||
hover:Stop()
|
sound:Stop()
|
||||||
hover.Volume = volume
|
sound.Volume = volume
|
||||||
hover.TimePosition = HOVER_START_SECONDS
|
sound.TimePosition = startSeconds
|
||||||
hover:Play()
|
sound:Play()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Start each recording just before its measured onset.
|
||||||
|
local playHover = prepareCue("ButtonHover", .38)
|
||||||
|
local playPress = prepareCue("ButtonPress", .035)
|
||||||
|
|
||||||
local bound: {[GuiButton]: boolean} = setmetatable({}, {__mode = "k"})
|
local bound: {[GuiButton]: boolean} = setmetatable({}, {__mode = "k"})
|
||||||
|
|
||||||
local function bindButton(instance: Instance)
|
local function bindButton(instance: Instance)
|
||||||
@@ -38,7 +43,7 @@ local function bindButton(instance: Instance)
|
|||||||
end)
|
end)
|
||||||
button.Activated:Connect(function()
|
button.Activated:Connect(function()
|
||||||
if button:IsDescendantOf(playerGui) then
|
if button:IsDescendantOf(playerGui) then
|
||||||
Sounds.sound("ButtonPress")
|
playPress()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -111,9 +111,10 @@ RunService:BindToRenderStep(renderName, Enum.RenderPriority.Camera.Value + 2, fu
|
|||||||
local menuShown = menu ~= nil and menu.Enabled
|
local menuShown = menu ~= nil and menu.Enabled
|
||||||
local resultsGui = playerGui:FindFirstChild("ArenaResults")
|
local resultsGui = playerGui:FindFirstChild("ArenaResults")
|
||||||
local scoreboardShown = resultsGui ~= nil and resultsGui:GetAttribute("LiveScoreboardOpen") == true
|
local scoreboardShown = resultsGui ~= nil and resultsGui:GetAttribute("LiveScoreboardOpen") == true
|
||||||
|
local votingShown = playerGui:GetAttribute("HunterVoting") == true
|
||||||
local inArena = player:GetAttribute("InArena") == true
|
local inArena = player:GetAttribute("InArena") == true
|
||||||
UserInputService.MouseIconEnabled = not inArena or tunerShown or menuShown or scoreboardShown
|
UserInputService.MouseIconEnabled = not inArena or tunerShown or menuShown or scoreboardShown or votingShown
|
||||||
if scoreboardShown or (not inArena and not UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2)) then
|
if scoreboardShown or votingShown or (not inArena and not UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2)) then
|
||||||
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
|
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
|
||||||
end
|
end
|
||||||
local character = player.Character
|
local character = player.Character
|
||||||
|
|||||||
+80
-52
@@ -1,5 +1,4 @@
|
|||||||
--!strict
|
--!strict
|
||||||
local Debris = game:GetService("Debris")
|
|
||||||
local TweenService = game:GetService("TweenService")
|
local TweenService = game:GetService("TweenService")
|
||||||
local Sites = require(script.Parent:WaitForChild("ArenaObjectiveSites") :: ModuleScript)
|
local Sites = require(script.Parent:WaitForChild("ArenaObjectiveSites") :: ModuleScript)
|
||||||
|
|
||||||
@@ -18,6 +17,9 @@ type Capture = {
|
|||||||
local HotPoint = {Radius = 18}
|
local HotPoint = {Radius = 18}
|
||||||
local CAPTURE_SECONDS = 10
|
local CAPTURE_SECONDS = 10
|
||||||
local ROTATION_SECONDS = 40
|
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 TEAM_SPEED = 1.5
|
||||||
local HIT_WINDOW = 1.2
|
local HIT_WINDOW = 1.2
|
||||||
local HIT_DECAY = .8
|
local HIT_DECAY = .8
|
||||||
@@ -106,44 +108,54 @@ function HotPoint.attachRing(mark: Marker): (Color3) -> ()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function captureWave(mark: Marker)
|
local function collapse(mark: Marker)
|
||||||
local motion = TweenInfo.new(.55, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
|
local body = mark.body
|
||||||
local center = mark.body.CFrame:PointToObjectSpace(mark.origin + Vector3.yAxis * .29)
|
local motion = TweenInfo.new(COLLAPSE_SECONDS, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
|
||||||
local tips: {[Attachment]: Attachment} = {}
|
local center = body.CFrame:PointToObjectSpace(mark.origin + Vector3.yAxis * .29)
|
||||||
local function waveTip(original: Attachment): Attachment
|
body:SetAttribute("ObjectiveArrowHidden", true)
|
||||||
local existing = tips[original]
|
mark.label.Visible = false
|
||||||
if existing then return existing end
|
TweenService:Create(body, motion, {Size = Vector3.new(body.Size.X, .1, .1), Transparency = 1}):Play()
|
||||||
local tip = original:Clone()
|
for _, item in body:GetDescendants() do
|
||||||
tip:ClearAllChildren()
|
if item:IsA("Attachment") then
|
||||||
local offset = original.Position - center
|
TweenService:Create(item, motion, {Position = center}):Play()
|
||||||
tip.Position = center + offset * .78
|
elseif item:IsA("Beam") then
|
||||||
tip.Parent = mark.body
|
TweenService:Create(item, motion, {Width0 = 0, Width1 = 0, CurveSize0 = 0, CurveSize1 = 0}):Play()
|
||||||
tips[original] = tip
|
elseif item:IsA("ParticleEmitter") then
|
||||||
TweenService:Create(tip, motion, {Position = center + offset * 1.25}):Play()
|
item.Enabled = false
|
||||||
Debris:AddItem(tip, .6)
|
elseif item:IsA("PointLight") then
|
||||||
return tip
|
TweenService:Create(item, motion, {Brightness = 0, Range = 0}):Play()
|
||||||
end
|
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
|
||||||
|
|
||||||
|
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
|
||||||
local state = config.state
|
local state = config.state
|
||||||
local index, credit, hitSince, hitUntil, flashUntil = 0, 0, 0, 0, 0
|
local index, credit, hitSince, hitUntil = 0, 0, 0, 0
|
||||||
local owner: Side? = nil
|
local movesAt = config.startedAt
|
||||||
|
local capturedAt = 0
|
||||||
|
local capturedSide: Side? = nil
|
||||||
local claiming: Side? = nil
|
local claiming: Side? = nil
|
||||||
local capturers: {[Player]: boolean} = {}
|
local capturers: {[Player]: boolean} = {}
|
||||||
local mark: Marker? = nil
|
local mark: Marker? = nil
|
||||||
@@ -178,20 +190,31 @@ function HotPoint.start(config: Config): Capture
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function step(fighters: {Fighter}, now: number, dt: number)
|
local function step(fighters: {Fighter}, now: number, dt: number)
|
||||||
local elapsed = math.max(0, now - config.startedAt)
|
if index == 0 or now >= movesAt then
|
||||||
local slot = math.floor(elapsed / ROTATION_SECONDS) % #config.sites + 1
|
|
||||||
local site = config.sites[slot]
|
|
||||||
if index ~= slot then
|
|
||||||
if mark then mark.body:Destroy() end
|
if mark then mark.body:Destroy() end
|
||||||
local fresh = config.marker(site)
|
index = index % #config.sites + 1
|
||||||
index, mark, paint = slot, fresh, HotPoint.attachRing(fresh)
|
local activeSite = config.sites[index]
|
||||||
state:SetAttribute("HotPointPosition", site.position)
|
local fresh = config.marker(activeSite)
|
||||||
local nextSite = config.sites[slot % #config.sites + 1]
|
mark, paint, lastTint = fresh, HotPoint.attachRing(fresh), nil
|
||||||
state:SetAttribute("HotPointNextPosition", if #config.sites > 1 then nextSite.position else nil)
|
capturedSide = nil
|
||||||
state:SetAttribute("HotPointMovesAt", config.startedAt + (math.floor(elapsed / ROTATION_SECONDS) + 1) * ROTATION_SECONDS)
|
movesAt = now + ROTATION_SECONDS
|
||||||
owner, flashUntil, lastTint = nil, 0, nil
|
|
||||||
clearCapture()
|
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
|
end
|
||||||
|
local site = config.sites[index]
|
||||||
|
|
||||||
local blue, orange = 0, 0
|
local blue, orange = 0, 0
|
||||||
local inside: {Fighter} = {}
|
local inside: {Fighter} = {}
|
||||||
@@ -200,11 +223,11 @@ function HotPoint.start(config: Config): Capture
|
|||||||
table.insert(inside, fighter)
|
table.insert(inside, fighter)
|
||||||
if fighter.side == "Blue" then blue += 1 else orange += 1 end
|
if fighter.side == "Blue" then blue += 1 else orange += 1 end
|
||||||
end
|
end
|
||||||
local remaining = math.ceil(ROTATION_SECONDS - elapsed % ROTATION_SECONDS)
|
local remaining = math.ceil(movesAt - now)
|
||||||
config.status(site.name .. " · Смена точки через " .. remaining .. " с")
|
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 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
|
local isContested = blue > 0 and orange > 0
|
||||||
if soleSide and soleSide ~= owner then
|
if soleSide then
|
||||||
if claiming ~= soleSide then
|
if claiming ~= soleSide then
|
||||||
clearCapture()
|
clearCapture()
|
||||||
claiming = soleSide
|
claiming = soleSide
|
||||||
@@ -228,12 +251,16 @@ function HotPoint.start(config: Config): Capture
|
|||||||
credit += (dt - damageTime) * (if count >= 2 then TEAM_SPEED else 1)
|
credit += (dt - damageTime) * (if count >= 2 then TEAM_SPEED else 1)
|
||||||
end
|
end
|
||||||
if credit >= CAPTURE_SECONDS then
|
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)
|
config.score(side, 1)
|
||||||
clearCapture()
|
clearCapture()
|
||||||
publish(side, 100, "Captured")
|
publish(nil, 0, nil)
|
||||||
|
config.status("")
|
||||||
|
state:SetAttribute("HotPointPosition", nil)
|
||||||
|
state:SetAttribute("HotPointMovesAt", movesAt)
|
||||||
paintRing(teamColor[side])
|
paintRing(teamColor[side])
|
||||||
if mark then captureWave(mark) end
|
if mark then collapse(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)
|
||||||
@@ -243,8 +270,8 @@ function HotPoint.start(config: Config): Capture
|
|||||||
publish(nil, 0, "Contested")
|
publish(nil, 0, "Contested")
|
||||||
paintRing(contested)
|
paintRing(contested)
|
||||||
else
|
else
|
||||||
if owner and now < flashUntil then publish(owner, 100, "Captured") else publish(nil, 0, nil) end
|
publish(nil, 0, nil)
|
||||||
paintRing(if owner then teamColor[owner] else neutral)
|
paintRing(neutral)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -264,6 +291,7 @@ function HotPoint.start(config: Config): Capture
|
|||||||
end,
|
end,
|
||||||
death = death,
|
death = death,
|
||||||
destroy = function()
|
destroy = function()
|
||||||
|
if mark then mark.body:Destroy() end
|
||||||
publish(nil, 0, nil)
|
publish(nil, 0, nil)
|
||||||
state:SetAttribute("HotPointPosition", nil)
|
state:SetAttribute("HotPointPosition", nil)
|
||||||
state:SetAttribute("HotPointNextPosition", nil)
|
state:SetAttribute("HotPointNextPosition", nil)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ local function update()
|
|||||||
local nextPoint = match:GetAttribute("HotPointNextPosition")
|
local nextPoint = match:GetAttribute("HotPointNextPosition")
|
||||||
local deadline = match:GetAttribute("HotPointMovesAt")
|
local deadline = match:GetAttribute("HotPointMovesAt")
|
||||||
if player:GetAttribute("InArena") ~= true or match:GetAttribute("Ruleset") ~= "HotPoint"
|
if player:GetAttribute("InArena") ~= true or match:GetAttribute("Ruleset") ~= "HotPoint"
|
||||||
or match:GetAttribute("Phase") ~= "Round" or typeof(point) ~= "Vector3"
|
or match:GetAttribute("Phase") ~= "Round"
|
||||||
or not root or not root:IsA("BasePart") or not humanoid or humanoid.Health <= 0 or not camera then
|
or not root or not root:IsA("BasePart") or not humanoid or humanoid.Health <= 0 or not camera then
|
||||||
gui.Enabled = false
|
gui.Enabled = false
|
||||||
lastPoint, lastCharacter, heardDeadline = nil, nil, nil
|
lastPoint, lastCharacter, heardDeadline = nil, nil, nil
|
||||||
@@ -53,13 +53,15 @@ local function update()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local now = workspace:GetServerTimeNow()
|
local now = workspace:GetServerTimeNow()
|
||||||
if point ~= lastPoint or character ~= lastCharacter then
|
local activePoint = if typeof(point) == "Vector3" then point else nil
|
||||||
|
if activePoint ~= lastPoint or character ~= lastCharacter then
|
||||||
guideUntil = now + GUIDE_SECONDS
|
guideUntil = now + GUIDE_SECONDS
|
||||||
lastPoint, lastCharacter = point, character
|
lastPoint, lastCharacter = activePoint, character
|
||||||
end
|
end
|
||||||
local remaining = if typeof(deadline) == "number" then deadline - now else math.huge
|
local remaining = if typeof(deadline) == "number" then deadline - now else math.huge
|
||||||
local moving = remaining > 0 and remaining <= WARNING_SECONDS and typeof(nextPoint) == "Vector3"
|
local moving = remaining > 0 and remaining <= WARNING_SECONDS and typeof(nextPoint) == "Vector3"
|
||||||
local target = if moving and typeof(nextPoint) == "Vector3" then nextPoint else point
|
local target = if moving and typeof(nextPoint) == "Vector3" then nextPoint else activePoint
|
||||||
|
if not target then gui.Enabled = false; return end
|
||||||
local delta = target - root.Position
|
local delta = target - root.Position
|
||||||
local flat = Vector3.new(delta.X, 0, delta.Z)
|
local flat = Vector3.new(delta.X, 0, delta.Z)
|
||||||
local summary = playerGui:FindFirstChild("ArenaResults")
|
local summary = playerGui:FindFirstChild("ArenaResults")
|
||||||
@@ -79,7 +81,7 @@ local function update()
|
|||||||
arrow.TextColor3 = tint
|
arrow.TextColor3 = tint
|
||||||
local localDirection = camera.CFrame:VectorToObjectSpace(flat)
|
local localDirection = camera.CFrame:VectorToObjectSpace(flat)
|
||||||
arrow.Rotation = math.deg(math.atan2(localDirection.X, -localDirection.Z))
|
arrow.Rotation = math.deg(math.atan2(localDirection.X, -localDirection.Z))
|
||||||
title.Text = if moving then ("СМЕНА ТОЧКИ · %d С"):format(math.ceil(remaining)) else "К ГОРЯЧЕЙ ТОЧКЕ"
|
title.Text = if moving then ("НОВАЯ ТОЧКА · %d С"):format(math.ceil(remaining)) else "К ГОРЯЧЕЙ ТОЧКЕ"
|
||||||
local floor = if delta.Y > 8 then " · ВЫШЕ" elseif delta.Y < -8 then " · НИЖЕ" else ""
|
local floor = if delta.Y > 8 then " · ВЫШЕ" elseif delta.Y < -8 then " · НИЖЕ" else ""
|
||||||
detail.Text = ("%d СТУДОВ%s"):format(math.floor(delta.Magnitude + .5), floor)
|
detail.Text = ("%d СТУДОВ%s"):format(math.floor(delta.Magnitude + .5), floor)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ local function reveal(outcome: Outcome, now: number)
|
|||||||
title.Text = "РЕЖИМ ВЫБРАН"
|
title.Text = "РЕЖИМ ВЫБРАН"
|
||||||
clock.Visible, line.Visible = false, false
|
clock.Visible, line.Visible = false, false
|
||||||
caption.TextXAlignment, detail.TextXAlignment = Enum.TextXAlignment.Center, Enum.TextXAlignment.Center
|
caption.TextXAlignment, detail.TextXAlignment = Enum.TextXAlignment.Center, Enum.TextXAlignment.Center
|
||||||
caption.Text = "СЛЕДУЮЩИЙ РАУНД"
|
caption.Text = if selectedRule then "СЛЕДУЮЩИЙ РАУНД" else "ВЫ ВОЗВРАЩАЕТЕСЬ В ЛОББИ"
|
||||||
detail.Text = Rules.get(outcome.winner).detail
|
detail.Text = Rules.get(outcome.winner).detail
|
||||||
local center = Vector2.new(panelWidth / 2, panelHeight / 2)
|
local center = Vector2.new(panelWidth / 2, panelHeight / 2)
|
||||||
for _, slot in cards do
|
for _, slot in cards do
|
||||||
@@ -198,7 +198,6 @@ end
|
|||||||
|
|
||||||
local received = vote.OnClientEvent:Connect(function(id: string, endsAt: number, counts: {[string]: number}, total: number,
|
local received = vote.OnClientEvent:Connect(function(id: string, endsAt: number, counts: {[string]: number}, total: number,
|
||||||
selection: string?, outcome: Outcome?)
|
selection: string?, outcome: Outcome?)
|
||||||
if player:GetAttribute("InArena") == true or player:GetAttribute("ArenaWaiting") == true then return end
|
|
||||||
local now = workspace:GetServerTimeNow()
|
local now = workspace:GetServerTimeNow()
|
||||||
local left = endsAt - now
|
local left = endsAt - now
|
||||||
if outcome then
|
if outcome then
|
||||||
@@ -227,10 +226,6 @@ end)
|
|||||||
local timer = RunService.Heartbeat:Connect(function()
|
local timer = RunService.Heartbeat:Connect(function()
|
||||||
if not gui.Enabled then return end
|
if not gui.Enabled then return end
|
||||||
local now = workspace:GetServerTimeNow()
|
local now = workspace:GetServerTimeNow()
|
||||||
if player:GetAttribute("InArena") == true or player:GetAttribute("ArenaWaiting") == true then
|
|
||||||
hide()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local dismissAt = revealEndsAt
|
local dismissAt = revealEndsAt
|
||||||
if dismissAt then
|
if dismissAt then
|
||||||
if now >= dismissAt then hide() end
|
if now >= dismissAt then hide() end
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
--!strict
|
||||||
|
local Players = game:GetService("Players")
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
local RunService = game:GetService("RunService")
|
||||||
|
local Modes = require(ReplicatedStorage:WaitForChild("ArenaModes") :: ModuleScript)
|
||||||
|
|
||||||
|
local player = Players.LocalPlayer
|
||||||
|
local playerGui = player:WaitForChild("PlayerGui")
|
||||||
|
local arena = Modes.geometry(Modes.Procedural)
|
||||||
|
type Arrow = {gui: BillboardGui, model: Model, faces: {BasePart}, edges: {BasePart}, glow: {BasePart}, color: Color3?, phase: number}
|
||||||
|
local arrows: {[BasePart]: Arrow} = {}
|
||||||
|
|
||||||
|
local function build(marker: BasePart)
|
||||||
|
if arrows[marker] then return end
|
||||||
|
local gui = Instance.new("BillboardGui")
|
||||||
|
gui.Name = "ObjectiveArrow"
|
||||||
|
gui.Adornee = marker
|
||||||
|
gui.AlwaysOnTop = true
|
||||||
|
gui.LightInfluence = 0
|
||||||
|
gui.MaxDistance = 710
|
||||||
|
gui.Size = UDim2.fromOffset(108, 108)
|
||||||
|
gui.StudsOffsetWorldSpace = Vector3.yAxis * 10
|
||||||
|
gui.Enabled = false
|
||||||
|
|
||||||
|
local viewport = Instance.new("ViewportFrame")
|
||||||
|
viewport.Name = "ArrowViewport"
|
||||||
|
viewport.BackgroundTransparency = 1
|
||||||
|
viewport.Size = UDim2.fromScale(1, 1)
|
||||||
|
viewport.Ambient = Color3.fromRGB(145, 155, 180)
|
||||||
|
viewport.LightColor = Color3.new(1, 1, 1)
|
||||||
|
viewport.LightDirection = Vector3.new(-1, -1, -2)
|
||||||
|
viewport.Parent = gui
|
||||||
|
|
||||||
|
local camera = Instance.new("Camera")
|
||||||
|
camera.FieldOfView = 29
|
||||||
|
camera.CFrame = CFrame.lookAt(Vector3.new(0, 0, 9.5), Vector3.zero)
|
||||||
|
camera.Parent = viewport
|
||||||
|
viewport.CurrentCamera = camera
|
||||||
|
|
||||||
|
local model = Instance.new("Model")
|
||||||
|
model.Name = "Arrow"
|
||||||
|
model.Parent = viewport
|
||||||
|
local arrow: Arrow = {gui = gui, model = model, faces = {}, edges = {}, glow = {}, color = nil, phase = marker.Position.X * .03}
|
||||||
|
local function piece(name: string, size: Vector3, pose: CFrame, parent: {BasePart})
|
||||||
|
local part = Instance.new("Part")
|
||||||
|
part.Name = name
|
||||||
|
part.Size = size
|
||||||
|
part.CFrame = pose
|
||||||
|
part.Anchored = true
|
||||||
|
part.CanCollide, part.CanQuery, part.CanTouch = false, false, false
|
||||||
|
part.Parent = model
|
||||||
|
table.insert(parent, part)
|
||||||
|
end
|
||||||
|
local function segment(position: Vector3, angle: number, size: Vector3)
|
||||||
|
local pose = CFrame.new(position) * CFrame.Angles(0, 0, angle)
|
||||||
|
piece("Halo", Vector3.new(size.X * 1.42, size.Y + .23, .1),
|
||||||
|
pose * CFrame.new(0, 0, -size.Z * .55), arrow.glow)
|
||||||
|
piece("LitEdge", size, pose, arrow.edges)
|
||||||
|
piece("BrightFace", Vector3.new(size.X * .54, size.Y - .13, .09),
|
||||||
|
pose * CFrame.new(0, 0, size.Z * .5), arrow.faces)
|
||||||
|
end
|
||||||
|
segment(Vector3.new(0, .38, 0), 0, Vector3.new(.64, 2.13, .68))
|
||||||
|
segment(Vector3.new(-.51, -.53, 0), math.rad(45), Vector3.new(.64, 1.56, .68))
|
||||||
|
segment(Vector3.new(.51, -.53, 0), math.rad(-45), Vector3.new(.64, 1.56, .68))
|
||||||
|
|
||||||
|
arrows[marker] = arrow
|
||||||
|
gui.Parent = playerGui
|
||||||
|
end
|
||||||
|
|
||||||
|
local function add(instance: Instance)
|
||||||
|
if instance:IsA("BasePart") and instance:GetAttribute("ObjectiveArrow") == true then build(instance) end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function remove(instance: Instance)
|
||||||
|
if not instance:IsA("BasePart") then return end
|
||||||
|
local arrow = arrows[instance]
|
||||||
|
if not arrow then return end
|
||||||
|
arrows[instance] = nil
|
||||||
|
arrow.gui:Destroy()
|
||||||
|
end
|
||||||
|
|
||||||
|
local added = arena.DescendantAdded:Connect(add)
|
||||||
|
local removing = arena.DescendantRemoving:Connect(remove)
|
||||||
|
for _, instance in arena:GetDescendants() do add(instance) end
|
||||||
|
|
||||||
|
local render = RunService.RenderStepped:Connect(function()
|
||||||
|
local camera = workspace.CurrentCamera
|
||||||
|
local active = player:GetAttribute("InArena") == true and camera ~= nil
|
||||||
|
local now = os.clock()
|
||||||
|
for marker, arrow in arrows do
|
||||||
|
arrow.gui.Enabled = active and marker:GetAttribute("ObjectiveArrowHidden") ~= true
|
||||||
|
if not arrow.gui.Enabled or not camera then continue end
|
||||||
|
local distance = (camera.CFrame.Position - marker.Position).Magnitude
|
||||||
|
if distance > arrow.gui.MaxDistance then continue end
|
||||||
|
local phase = now * 3 + arrow.phase
|
||||||
|
local size = math.clamp(math.floor(124 - distance * .08), 76, 124)
|
||||||
|
arrow.gui.Size = UDim2.fromOffset(size, size)
|
||||||
|
arrow.gui.StudsOffsetWorldSpace = Vector3.yAxis * (10.5 + math.sin(phase) * .95)
|
||||||
|
arrow.model:PivotTo(CFrame.fromOrientation(math.rad(-8), .24 + math.sin(phase * .72) * .36, math.sin(phase) * .07))
|
||||||
|
local color = marker.Color
|
||||||
|
if arrow.color ~= color then
|
||||||
|
arrow.color = color
|
||||||
|
for _, edge in arrow.edges do edge.Color = color end
|
||||||
|
for _, halo in arrow.glow do halo.Color = color end
|
||||||
|
for _, face in arrow.faces do face.Color = color:Lerp(Color3.new(1, 1, 1), .64) end
|
||||||
|
end
|
||||||
|
for _, halo in arrow.glow do halo.Transparency = .75 + math.sin(phase) * .09 end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
script.Destroying:Once(function()
|
||||||
|
added:Disconnect()
|
||||||
|
removing:Disconnect()
|
||||||
|
render:Disconnect()
|
||||||
|
for _, arrow in arrows do arrow.gui:Destroy() end
|
||||||
|
end)
|
||||||
Reference in new issue
Block a user