13
This commit is contained in:
1 parent
d0f85a5fa8
commit
38e4e1c302
5 files changed
+156
-3
No files matched your search
@@ -4,6 +4,23 @@ local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local Sounds = require(ReplicatedStorage:WaitForChild("SniperEffects") :: ModuleScript)
|
||||
|
||||
local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
|
||||
local hoverDef = Sounds.SOUNDS.ButtonHover
|
||||
local hover = Instance.new("Sound")
|
||||
hover.Name = "SniperButtonHover"
|
||||
hover.SoundId = hoverDef.id
|
||||
hover.PlaybackSpeed = hoverDef.speed
|
||||
hover.Parent = game:GetService("SoundService")
|
||||
script.Destroying:Once(function() hover:Destroy() end)
|
||||
|
||||
local function playHover()
|
||||
if not hover.IsLoaded then return end
|
||||
local volume = hoverDef.volume * math.max(Sounds.setting("VolMaster", 1), 0)
|
||||
* math.max(Sounds.setting("Vol" .. hoverDef.group, 1), 0)
|
||||
if volume <= 0 then return end
|
||||
hover:Stop()
|
||||
hover.Volume = volume
|
||||
hover:Play()
|
||||
end
|
||||
local bound: {[GuiButton]: boolean} = setmetatable({}, {__mode = "k"})
|
||||
|
||||
local function bindButton(instance: Instance)
|
||||
@@ -13,7 +30,7 @@ local function bindButton(instance: Instance)
|
||||
|
||||
button.MouseEnter:Connect(function()
|
||||
if button.Active and button.Interactable and button:IsDescendantOf(playerGui) then
|
||||
Sounds.sound("ButtonHover")
|
||||
playHover()
|
||||
end
|
||||
end)
|
||||
button.Activated:Connect(function()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
--!strict
|
||||
local Players = game:GetService("Players")
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local RunService = game:GetService("RunService")
|
||||
local Modes = require(ReplicatedStorage:WaitForChild("ArenaModes") :: ModuleScript)
|
||||
local Sounds = require(ReplicatedStorage:WaitForChild("SniperEffects") :: ModuleScript)
|
||||
local UI = require(ReplicatedStorage:WaitForChild("HunterUI") :: ModuleScript)
|
||||
|
||||
local player = Players.LocalPlayer
|
||||
local playerGui = player:WaitForChild("PlayerGui")
|
||||
local match = Modes.state(ReplicatedStorage:WaitForChild("ArenaRound"), Modes.Procedural)
|
||||
local WARNING_SECONDS = 5
|
||||
local GUIDE_SECONDS = 7
|
||||
|
||||
local gui = Instance.new("ScreenGui")
|
||||
gui.Name = "HotPointGuide"
|
||||
gui.ResetOnSpawn = false
|
||||
gui.DisplayOrder = 25
|
||||
gui.Enabled = false
|
||||
gui.Parent = playerGui
|
||||
|
||||
local panel = UI.plate(gui, "Direction", UDim2.fromScale(.5, .78), UDim2.new(.85, 0, 0, 60), UI.Outline)
|
||||
panel.AnchorPoint = Vector2.new(.5, .5)
|
||||
local sizeLimit = Instance.new("UISizeConstraint")
|
||||
sizeLimit.MaxSize = Vector2.new(326, 60)
|
||||
sizeLimit.Parent = panel
|
||||
local contour = UI.contour(panel, UI.Blue)
|
||||
local arrow = UI.label(panel, "Arrow", "▲", UDim2.fromOffset(12, 8), UDim2.fromOffset(44, 44), 29, UI.Blue)
|
||||
local title = UI.label(panel, "Title", "К ГОРЯЧЕЙ ТОЧКЕ", UDim2.fromOffset(63, 7), UDim2.new(1, -72, 0, 23), 18, UI.Ink)
|
||||
title.TextXAlignment = Enum.TextXAlignment.Left
|
||||
local detail = UI.label(panel, "Detail", "", UDim2.fromOffset(63, 31), UDim2.new(1, -72, 0, 20), 15, UI.Muted)
|
||||
detail.TextXAlignment = Enum.TextXAlignment.Left
|
||||
|
||||
local guideUntil = 0
|
||||
local lastPoint: Vector3? = nil
|
||||
local lastCharacter: Model? = nil
|
||||
local heardDeadline: number? = nil
|
||||
|
||||
local function update()
|
||||
local character = player.Character
|
||||
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
|
||||
local root = character and character:FindFirstChild("HumanoidRootPart")
|
||||
local camera = workspace.CurrentCamera
|
||||
local point = match:GetAttribute("HotPointPosition")
|
||||
local nextPoint = match:GetAttribute("HotPointNextPosition")
|
||||
local deadline = match:GetAttribute("HotPointMovesAt")
|
||||
if player:GetAttribute("InArena") ~= true or match:GetAttribute("Ruleset") ~= "HotPoint"
|
||||
or match:GetAttribute("Phase") ~= "Round" or typeof(point) ~= "Vector3"
|
||||
or not root or not root:IsA("BasePart") or not humanoid or humanoid.Health <= 0 or not camera then
|
||||
gui.Enabled = false
|
||||
lastPoint, lastCharacter, heardDeadline = nil, nil, nil
|
||||
return
|
||||
end
|
||||
|
||||
local now = workspace:GetServerTimeNow()
|
||||
if point ~= lastPoint or character ~= lastCharacter then
|
||||
guideUntil = now + GUIDE_SECONDS
|
||||
lastPoint, lastCharacter = point, character
|
||||
end
|
||||
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 target = if moving and typeof(nextPoint) == "Vector3" then nextPoint else point
|
||||
local delta = target - root.Position
|
||||
local flat = Vector3.new(delta.X, 0, delta.Z)
|
||||
local summary = playerGui:FindFirstChild("ArenaResults")
|
||||
local menu = playerGui:FindFirstChild("MainMenu")
|
||||
local menusOpen = (summary and summary:GetAttribute("LiveScoreboardOpen") == true)
|
||||
or (menu and menu:IsA("ScreenGui") and menu.Enabled)
|
||||
local show = not menusOpen and (moving or (now < guideUntil and (flat.Magnitude > 18 or math.abs(delta.Y) > 8)))
|
||||
gui.Enabled = show
|
||||
if not show then return end
|
||||
|
||||
if moving and heardDeadline ~= deadline then
|
||||
heardDeadline = deadline :: number
|
||||
Sounds.sound("HotPointMove")
|
||||
end
|
||||
local tint = if moving then UI.Gold else UI.Blue
|
||||
contour:SetAttribute("Accent", tint)
|
||||
arrow.TextColor3 = tint
|
||||
local localDirection = camera.CFrame:VectorToObjectSpace(flat)
|
||||
arrow.Rotation = math.deg(math.atan2(localDirection.X, -localDirection.Z))
|
||||
title.Text = if moving then ("СМЕНА ТОЧКИ · %d С"):format(math.ceil(remaining)) 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)
|
||||
end
|
||||
|
||||
local connection = RunService.RenderStepped:Connect(update)
|
||||
script.Destroying:Once(function()
|
||||
connection:Disconnect()
|
||||
gui:Destroy()
|
||||
end)
|
||||
@@ -43,8 +43,9 @@ local SOUNDS: { [string]: SoundDef } = {
|
||||
RoundCountdown = { id = "rbxassetid://113416294133952", volume = 0.48, speed = 1, near = 0, far = 0, group = "HUD" }, -- timer tick
|
||||
ButtonHover = { id = "rbxassetid://84648433095796", volume = 0.22, speed = 1, near = 0, far = 0, group = "HUD" },
|
||||
ButtonPress = { id = "rbxassetid://121882355123711", volume = 0.27, speed = 1, near = 0, far = 0, group = "HUD" },
|
||||
HotPointStart = { id = "rbxassetid://2789428506", volume = 0.35, speed = 1, near = 0, far = 0, group = "HUD" }, -- Unlock_phoenix
|
||||
HotPointCaptured = { id = "rbxassetid://4612374036", volume = 0.4, speed = 1, near = 0, far = 0, group = "HUD" }, -- bling_big_diamond_pickup
|
||||
HotPointMove = { id = "rbxassetid://113416294133952", volume = 0.23, speed = 1.18, near = 0, far = 0, group = "HUD" },
|
||||
HotPointStart = { id = "rbxassetid://2789428506", volume = 0.25, speed = 1, near = 0, far = 0, group = "HUD" }, -- Unlock_phoenix
|
||||
HotPointCaptured = { id = "rbxassetid://4612374036", volume = 0.28, speed = 1, near = 0, far = 0, group = "HUD" }, -- bling_big_diamond_pickup
|
||||
MoneyCollect1 = { id = "rbxassetid://84894146013271", volume = 0.15, speed = 1, near = 0, far = 0, group = "Pickup", cut = 0.16 },
|
||||
CupidKnife = { id = "rbxassetid://120151468640015", volume = 0.32, speed = 1, near = 0, far = 0, group = "Pickup" },
|
||||
-- a player / bot destroyed: the body breaks apart like blocks (heard by everyone, from the body)
|
||||
|
||||
Reference in new issue
Block a user