This commit is contained in:
Leshyi committed 2026-11-29 18:48:34 +05:00
1 parent 1a6f73ace2
commit ce2ccfccdb
6 files changed
+81 -17

No files matched your search

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