diff --git a/Hunter.rbxl b/Hunter.rbxl index 7faefc0..1b2c669 100644 Binary files a/Hunter.rbxl and b/Hunter.rbxl differ diff --git a/scripts/ArenaObjectiveSites.luau b/scripts/ArenaObjectiveSites.luau index 8c6a058..e5a0e9c 100644 --- a/scripts/ArenaObjectiveSites.luau +++ b/scripts/ArenaObjectiveSites.luau @@ -42,32 +42,49 @@ function Sites.resolve(id: string): Map } end +local function fits(center: Vector3, geometry: RaycastParams, radius: number): boolean + for index = 0, 15 do + local angle = index * math.pi / 8 + local offset = Vector3.new(math.cos(angle), 0, math.sin(angle)) * (radius + .4) + for _, distance in {0.5, 1} do + local at = center + offset * distance + local floor = workspace:Raycast(at + Vector3.yAxis * 1.2, -Vector3.yAxis * 2.4, geometry) + if not floor or floor.Normal.Y < .95 or math.abs(floor.Position.Y - center.Y) > .35 then return false end + if workspace:Raycast(at + Vector3.yAxis * .25, Vector3.yAxis * 9, geometry) then return false end + end + for _, height in {1, 4, 8} do + if workspace:Raycast(center + Vector3.yAxis * height, offset, geometry) then return false end + end + end + return workspace:Raycast(center + Vector3.yAxis * .25, Vector3.yAxis * 9, geometry) == nil +end + +function Sites.clearCircle(center: Vector3, geometry: RaycastParams, radius: number): Vector3 + if fits(center, geometry, radius) then return center end + for distance = 3, 48, 3 do + for index = 0, 15 do + local angle = index * math.pi / 8 + local at = center + Vector3.new(math.cos(angle), 0, math.sin(angle)) * distance + local floor = workspace:Raycast(at + Vector3.yAxis * 1.2, -Vector3.yAxis * 2.4, geometry) + if floor and floor.Normal.Y >= .95 and math.abs(floor.Position.Y - center.Y) <= .35 + and fits(floor.Position, geometry, radius) then + return floor.Position + end + end + end + return center +end + function Sites.hotPath(id: string, map: Map, radius: number): {Site} local origin = Modes.geometry(id):GetPivot().Position local geometry = Modes.collision(id) - local function fits(center: Vector3): boolean - for index = 0, 15 do - local angle = index * math.pi / 8 - local offset = Vector3.new(math.cos(angle), 0, math.sin(angle)) * (radius + .4) - for _, distance in {0.5, 1} do - local at = center + offset * distance - local floor = workspace:Raycast(at + Vector3.yAxis * 1.2, -Vector3.yAxis * 2.4, geometry) - if not floor or floor.Normal.Y < .95 or math.abs(floor.Position.Y - center.Y) > .35 then return false end - if workspace:Raycast(at + Vector3.yAxis * .25, Vector3.yAxis * 9, geometry) then return false end - end - for _, height in {1, 4, 8} do - if workspace:Raycast(center + Vector3.yAxis * height, offset, geometry) then return false end - end - end - return workspace:Raycast(center + Vector3.yAxis * .25, Vector3.yAxis * 9, geometry) == nil - end local path: {Site} = {} local function insert(site: Site, alternatives: {Vector3}) local candidates = {site.position} for _, offset in alternatives do table.insert(candidates, origin + offset) end for _, candidate in candidates do local floor = workspace:Raycast(candidate + Vector3.yAxis * 1.2, -Vector3.yAxis * 2.4, geometry) - if floor and floor.Normal.Y >= .95 and math.abs(floor.Position.Y - candidate.Y) <= .35 and fits(floor.Position) then + if floor and floor.Normal.Y >= .95 and math.abs(floor.Position.Y - candidate.Y) <= .35 and fits(floor.Position, geometry, radius) then table.insert(path, {name = site.name, position = floor.Position}) return end diff --git a/scripts/ArenaObjectives.luau b/scripts/ArenaObjectives.luau index de76f8b..24b05c5 100644 --- a/scripts/ArenaObjectives.luau +++ b/scripts/ArenaObjectives.luau @@ -11,7 +11,7 @@ local CollectionService = game:GetService("CollectionService") type Side = "Blue" | "Orange" type Fighter = HotPoint.Fighter -type Marker = HotPoint.Marker +type Marker = HotPoint.Marker & {recolor: ((Color3) -> ())?} type Zone = {site: Sites.Site, marker: Marker, owner: Side?, claiming: Side?, progress: number} type Flag = {side: Side, marker: Marker, carrier: Player?, droppedUntil: number} type Drop = {marker: Marker, amount: number, expires: number} @@ -26,6 +26,9 @@ export type Match = { local active: {[string]: Match} = {} local Objectives = {} +local objectiveCue = Instance.new("RemoteEvent") +objectiveCue.Name = "ArenaObjectiveCue" +objectiveCue.Parent = ReplicatedStorage local sides: {Side} = {"Blue", "Orange"} local blue = Color3.fromRGB(67, 216, 255) local orange = Color3.fromRGB(255, 150, 68) @@ -87,8 +90,20 @@ local function marker(parent: Instance, id: string, name: string, at: Vector3, t return {body = part, label = label(part, name, tint, if tall then 2.1 else 4, id ~= "Tokens"), origin = at} end +local function ring(parent: Instance, id: string, name: string, at: Vector3, tint: Color3): Marker + local mark = marker(parent, id, name, at, tint, HotPoint.Radius * 2) + local recolor = HotPoint.attachRing(mark) + mark.recolor = recolor + recolor(tint) + return mark +end + local function paint(mark: Marker, tint: Color3) if mark.body.Color == tint then return end + if mark.recolor then + mark.recolor(tint) + return + end mark.body.Color = tint mark.label.TextColor3 = tint local aura = mark.body:FindFirstChildOfClass("PointLight") @@ -103,7 +118,7 @@ local function presence(fighters: {Fighter}, zone: Zone, geometry: RaycastParams local b, o = false, false -- Separate vertically stacked objectives by avatar foot height. for _, fighter in fighters do - if boundsAt(fighter.root.Position, zone.site.position, 11, 8) + if boundsAt(fighter.root.Position, zone.site.position, HotPoint.Radius, 8) and visibleAt(fighter, zone.site.position + Vector3.yAxis * 2.7, geometry) then if fighter.side == "Blue" then b = true else o = true end end @@ -148,8 +163,14 @@ function Objectives.start(config: Config): Match end return found end + local function cue(fighters: {Fighter}, captured: boolean, side: Side?) + for _, fighter in fighters do + if captured or fighter.side == side then objectiveCue:FireClient(fighter.player, captured) end + end + end local function makeZone(site: Sites.Site, name: string): Zone - return {site = site, marker = marker(folder, name, site.name, site.position, neutral, 22), owner = nil, claiming = nil, progress = 0} + site = {name = site.name, position = Sites.clearCircle(site.position, geometry, HotPoint.Radius)} + return {site = site, marker = ring(folder, name, site.name, site.position, neutral), owner = nil, claiming = nil, progress = 0} end local zones: {Zone} = {} local hotPoint = if hotPath then HotPoint.start({ @@ -168,6 +189,7 @@ function Objectives.start(config: Config): Match local siegeTimes: Score.Ledger = {Blue = {}, Orange = {}} local siegeSide: Side = if SiegeConfig.FIRST_ATTACKER == "Orange" then "Orange" else "Blue" local siegeIndex, siegeProgress = 1, 0 + local siegeCaptureStarted = false local hadSiegeSwap = false local siegeState: Folder? = nil local lifeActive, miniNumber = false, 0 @@ -184,10 +206,12 @@ function Objectives.start(config: Config): Match table.insert(zones, zone) end elseif rule == "CaptureFlag" or rule == "TrophyHunt" then + map.blue = Sites.clearCircle(map.blue, geometry, HotPoint.Radius) + map.orange = Sites.clearCircle(map.orange, geometry, HotPoint.Radius) for _, side in sides do local at = if side == "Blue" then map.blue else map.orange local name = if side == "Blue" then "БАЗА СИНИХ" else "БАЗА ОРАНЖЕВЫХ" - marker(folder, side .. "Base", name, at, color(side), 15) + ring(folder, side .. "Base", name, at, color(side)) if rule == "CaptureFlag" then local flag = marker(folder, side .. "Flag", "ФЛАГ", at, color(side), 2.6, true) flag.body.Transparency = 1 @@ -328,6 +352,7 @@ function Objectives.start(config: Config): Match flag.carrier = f.player flag.droppedUntil = 0 f.player:SetAttribute("ArenaFlag", side) + cue(fighters, false, f.side) break end end @@ -335,8 +360,9 @@ function Objectives.start(config: Config): Match for _, fighter in fighters do local own, enemy = flags[fighter.side], flags[opposite(fighter.side)] if enemy.carrier == fighter.player and not own.carrier and own.droppedUntil == 0 - and boundsAt(fighter.root.Position, own.marker.origin, 7, 7) then + and boundsAt(fighter.root.Position, own.marker.origin, HotPoint.Radius, 7) then add(fighter.side, 1) + cue(fighters, true, nil) sendHome(enemy) end end @@ -356,6 +382,7 @@ function Objectives.start(config: Config): Match end if not collector then continue end local p = collector.player + if not carried[p] then cue(fighters, false, collector.side) end carried[p] = (carried[p] or 0) + token.amount p:SetAttribute("ArenaTokens", carried[p]) end @@ -364,8 +391,9 @@ function Objectives.start(config: Config): Match end for _, f in fighters do local amount = carried[f.player] - if amount and boundsAt(f.root.Position, if f.side == "Blue" then map.blue else map.orange, 8, 7) then + if amount and boundsAt(f.root.Position, if f.side == "Blue" then map.blue else map.orange, HotPoint.Radius, 7) then add(f.side, amount) + cue(fighters, true, nil) carried[f.player] = nil f.player:SetAttribute("ArenaTokens", nil) end @@ -380,6 +408,7 @@ function Objectives.start(config: Config): Match hadSiegeSwap = true for _, z in zones do z.marker.body.Parent = nil end siegeSide, siegeIndex, siegeProgress = opposite(siegeSide), 1, 0 + siegeCaptureStarted = false local arenaSites = assert(map) local ordinals = {Blue = 0, Orange = 0} for _, p in members do @@ -417,7 +446,7 @@ function Objectives.start(config: Config): Match for _, fighter in fighters do local delta = fighter.root.Position - zone.site.position local reason = "Outside" - if delta.X * delta.X + delta.Z * delta.Z <= SiegeConfig.CAPTURE_RADIUS ^ 2 then + if delta.X * delta.X + delta.Z * delta.Z <= HotPoint.Radius ^ 2 then if math.abs(delta.Y) > SiegeConfig.HEIGHT_TOLERANCE then reason = "Height" elseif not visibleAt(fighter, zone.site.position + Vector3.yAxis * SiegeConfig.SIGHT_HEIGHT, geometry) then reason = "Blocked" else @@ -429,6 +458,12 @@ function Objectives.start(config: Config): Match end local progress, phase = Capture.advance(siegeProgress, math.min(dt, math.max(0, elapsed - attackStart)), attack, defense, SiegeConfig.CAPTURE_TIME, SiegeConfig.DECAY_MULTIPLIER) + if phase == "Capturing" and not siegeCaptureStarted then + cue(fighters, false, siegeSide) + siegeCaptureStarted = true + elseif progress == 0 and phase ~= "Capturing" then + siegeCaptureStarted = false + end siegeProgress = progress data:SetAttribute("Progress", progress) data:SetAttribute("Status", phase) @@ -443,6 +478,8 @@ function Objectives.start(config: Config): Match paint(zone.marker, if phase == "Contested" then orange else blue) if phase ~= "Captured" or not Score.record(siegeTimes, siegeSide, siegeIndex, elapsed - attackStart) then return false end add(siegeSide, SiegeConfig.POINTS_PER_OBJECTIVE) + cue(fighters, true, nil) + siegeCaptureStarted = false data:SetAttribute(siegeSide .. "Time" .. siegeIndex, elapsed - attackStart) zone.marker.body.Parent = nil siegeIndex += 1 @@ -505,9 +542,15 @@ function Objectives.start(config: Config): Match local b, o = presence(fighters, zone, geometry) local side: Side? = if b == o then nil elseif b then "Blue" else "Orange" if side and side ~= zone.owner then - if zone.claiming ~= side then zone.claiming, zone.progress = side, 0 end + if zone.claiming ~= side then + zone.claiming, zone.progress = side, 0 + cue(fighters, false, side) + end zone.progress += dt - if zone.progress >= 3 then zone.owner, zone.progress = side, 0 end + if zone.progress >= 3 then + zone.owner, zone.progress = side, 0 + cue(fighters, true, nil) + end else zone.claiming, zone.progress = nil, 0 end diff --git a/scripts/ArenaRoundHud.client.luau b/scripts/ArenaRoundHud.client.luau index 329c508..e573567 100644 --- a/scripts/ArenaRoundHud.client.luau +++ b/scripts/ArenaRoundHud.client.luau @@ -16,6 +16,10 @@ local playerGui = player:WaitForChild("PlayerGui") local state = ReplicatedStorage:WaitForChild("ArenaRound") local results = state:WaitForChild("RoundResults") :: RemoteEvent local leaveArena = state:WaitForChild("LeaveArena") :: RemoteEvent +local objectiveCue = ReplicatedStorage:WaitForChild("ArenaObjectiveCue") :: RemoteEvent +local objectiveCueConnection = objectiveCue.OnClientEvent:Connect(function(captured: boolean) + Sounds.sound(if captured then "HotPointCaptured" else "HotPointStart") +end) local limit = state:GetAttribute("TeamLimit") :: number local modeIds = {Modes.Procedural} local function currentMode(): string @@ -964,6 +968,7 @@ script.Destroying:Once(function() ContextActionService:UnbindAction(scoreboardAction) StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, nativePlayerList) for _, connection in scoreConnections do connection:Disconnect() end + objectiveCueConnection:Disconnect() if captureTween then captureTween:Cancel() end clearCountdownBeat() hideResults() diff --git a/scripts/CitadelAssaultConfig.luau b/scripts/CitadelAssaultConfig.luau index 7a1f2d1..0b233a8 100644 --- a/scripts/CitadelAssaultConfig.luau +++ b/scripts/CitadelAssaultConfig.luau @@ -3,7 +3,6 @@ return table.freeze({ MATCH_DURATION = 300, ATTACK_DURATION = 150, CAPTURE_TIME = 4, - CAPTURE_RADIUS = 11, DECAY_MULTIPLIER = 0.5, HEIGHT_TOLERANCE = 7, POINTS_PER_OBJECTIVE = 1, diff --git a/scripts/HotPoint.luau b/scripts/HotPoint.luau index 6d8b88f..d6b5099 100644 --- a/scripts/HotPoint.luau +++ b/scripts/HotPoint.luau @@ -24,7 +24,7 @@ local neutral = Color3.fromRGB(183, 132, 255) local contested = Color3.fromRGB(255, 211, 124) local teamColor: {[Side]: Color3} = {Blue = Color3.fromRGB(76, 228, 255), Orange = Color3.fromRGB(255, 81, 105)} -local function magicRing(mark: Marker): (Color3) -> () +function HotPoint.attachRing(mark: Marker): (Color3) -> () local body = mark.body body.Transparency = .92 local beams: {Beam} = {} @@ -148,7 +148,7 @@ function HotPoint.start(config: Config): Capture if index ~= slot then if mark then mark.body:Destroy() end local fresh = config.marker(site) - index, mark, paint = slot, fresh, magicRing(fresh) + index, mark, paint = slot, fresh, HotPoint.attachRing(fresh) owner, flashUntil, lastTint = nil, 0, nil clearCapture() end