This commit is contained in:
Leshyi committed 2026-11-02 17:36:00 +03:00
1 parent 8c01ae9657
commit cf12c5a430
9 files changed
+817 -31

No files matched your search

+83 -20
View File
@@ -150,42 +150,105 @@ Remotes:WaitForChild("WaveEvent").OnClientEvent:Connect(function(kind: string, w
end
end)
-- Надпись под прицелом: выскакивает, всплывает и гаснет.
local function toast(message: string, color: Color3, y: number?)
local label = text(gui, {
AnchorPoint = Vector2.new(0.5, 0.5),
Position = UDim2.fromScale(0.5, y or 0.62),
Size = UDim2.fromOffset(900, 44),
TextSize = 34,
TextColor3 = color,
TextStrokeColor3 = Color3.fromRGB(25, 10, 5),
TextStrokeTransparency = 0,
Text = message,
})
local scale = Instance.new("UIScale", label)
scale.Scale = 1.6
TweenService:Create(scale, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play()
TweenService:Create(label, TweenInfo.new(1.6, Enum.EasingStyle.Quad), { Position = UDim2.fromScale(0.5, (y or 0.62) - 0.06) }):Play()
task.delay(1.2, function()
TweenService:Create(label, TweenInfo.new(0.5), { TextTransparency = 1, TextStrokeTransparency = 1 }):Play()
task.wait(0.55)
label:Destroy()
end)
end
-- Подобрал буст — крупная надпись его цветом под прицелом.
Remotes:WaitForChild("BoostPicked").OnClientEvent:Connect(function(_, id: string, userId: number, _stacks: number, maxed: boolean)
local boost = Config.BoostById[id]
if userId ~= player.UserId or not boost then
return
end
local label = text(gui, {
AnchorPoint = Vector2.new(0.5, 0.5),
Position = UDim2.fromScale(0.5, 0.62),
Size = UDim2.fromOffset(700, 44),
TextSize = 34,
TextColor3 = boost.color,
TextStrokeColor3 = Color3.fromRGB(25, 10, 5),
TextStrokeTransparency = 0,
Text = if maxed
toast(if maxed
then boost.icon .. " " .. string.upper(boost.name) .. " — УЖЕ МАКСИМУМ"
elseif id == "armor" then ("%s БРОНЯ −%d%% УРОНА"):format(boost.icon, math.floor(boost.step * 100 + 0.5))
else ("%s +%d%% %s"):format(boost.icon, math.floor(boost.step * 100 + 0.5), string.upper(boost.name)),
})
local scale = Instance.new("UIScale", label)
scale.Scale = 1.6
TweenService:Create(scale, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play()
TweenService:Create(label, TweenInfo.new(1.4, Enum.EasingStyle.Quad), { Position = UDim2.fromScale(0.5, 0.56) }):Play()
task.delay(1, function()
TweenService:Create(label, TweenInfo.new(0.5), { TextTransparency = 1, TextStrokeTransparency = 1 }):Play()
task.wait(0.55)
label:Destroy()
end)
else ("%s +%d%% %s"):format(boost.icon, math.floor(boost.step * 100 + 0.5), string.upper(boost.name)), boost.color)
end)
-- ===== События на карте: аптечка и командный буст =====
local teamFrame = frame({ AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 136), Size = UDim2.fromOffset(380, 36), BackgroundColor3 = BG, BackgroundTransparency = 0.1, Visible = false })
Instance.new("UICorner", teamFrame).CornerRadius = UDim.new(0, 10)
local teamStroke = Instance.new("UIStroke", teamFrame)
teamStroke.Thickness = 2
local teamLabel = text(teamFrame, { Position = UDim2.fromOffset(12, 2), Size = UDim2.new(1, -24, 0, 20), TextSize = 14, TextXAlignment = Enum.TextXAlignment.Left })
local teamTrack = frame({ Parent = teamFrame, Position = UDim2.fromOffset(12, 24), Size = UDim2.new(1, -24, 0, 6), BackgroundColor3 = Color3.fromRGB(55, 40, 32) })
Instance.new("UICorner", teamTrack).CornerRadius = UDim.new(1, 0)
local teamFill = frame({ Parent = teamTrack, Size = UDim2.fromScale(1, 1) })
Instance.new("UICorner", teamFill).CornerRadius = UDim.new(1, 0)
Remotes:WaitForChild("MapPickup").OnClientEvent:Connect(function(kind: string, _position: Vector3, userId: number, id: string?)
local arena = player:GetAttribute("Arena") or 0
local picker = Players:GetPlayerByUserId(userId)
if arena == 0 or not picker or picker:GetAttribute("Arena") ~= arena then
return -- событие на чужой карте
end
if kind == "heal" then
if userId == player.UserId then
toast(("➕ +%d%% HP"):format(Config.MapEvents.Heal.Amount * 100), Config.MapEvents.Heal.Color)
end
elseif kind == "team" then
local boost = Config.TeamBoostById[id or ""]
if boost then
local who = if userId == player.UserId then "Ты взял" else picker.DisplayName .. " взял"
toast(("%s %s +%d%% — ВСЕЙ КОМАНДЕ на %d с"):format(who, boost.icon, boost.value * 100, boost.duration), boost.color, 0.68)
end
end
end)
-- Командный буст: таймер сверху у всей команды и обратный отсчёт над кругом, пока его не подобрали.
local function updateTeam(folder: Instance?)
local now = workspace:GetServerTimeNow()
local boost = Config.TeamBoostById[player:GetAttribute("TeamBoost") or ""]
local ends = player:GetAttribute("TeamBoostEnd") or 0
if boost and now < ends then
local left = ends - now
teamFrame.Visible = true
teamStroke.Color = boost.color
teamFill.BackgroundColor3 = boost.color
teamFill.Size = UDim2.fromScale(math.clamp(left / boost.duration, 0, 1), 1)
teamLabel.TextColor3 = boost.color
teamLabel.Text = ("%s %s +%d%% · %.1f с"):format(boost.icon, string.upper(boost.name), boost.value * 100, left)
else
teamFrame.Visible = false
end
local circle = folder and folder:FindFirstChild("TeamBoost")
local caption = circle and circle:FindFirstChild("Caption", true) :: TextLabel?
local def = circle and Config.TeamBoostById[circle:GetAttribute("Boost") or ""]
if caption and def then
local left = math.max(0, (circle:GetAttribute("ExpiresAt") or 0) - now)
caption.Text = ("+%d%% %s · %.1f"):format(def.value * 100, def.name, left)
end
end
-- ===== Состояние волны каждый кадр =====
RunService.RenderStepped:Connect(function()
local arena = player:GetAttribute("Arena") or 0
local folder = arena > 0 and workspace:FindFirstChild("Zombies" .. arena)
boostList.Visible = arena > 0
updateTeam(folder or nil)
if not folder then
waveBar.Visible = false
bossBar.Visible = false
+358
View File
@@ -0,0 +1,358 @@
-- Кинематографичный пролёт камеры перед боем (между загрузкой команды и отсчётом «3, 2, 1»).
-- Общий план сверху по дуге → низкий проход вдоль каждой багги команды (своя — последней) с табличкой
-- игрока → взлёт за свою машину и мягкая стыковка с камерой за рулём (Driving.client).
-- Камера идёт по одной непрерывной кривой (Catmull-Rom) через все точки, без остановок.
-- Эффекты: кинополосы, глубина резкости с фокусом на машине, размытие в движении, смена фокусного
-- расстояния, лёгкий крен горизонта, контраст, титры, вспышка при стыковке. Интерфейс на время скрыт.
-- Время общее с сервером (IntroStart) — у всей команды пролёт идёт одинаково, отсчёт начинается после него.
local Lighting = game:GetService("Lighting")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local Config = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("Config"))
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local IC = Config.Intro
local player = Players.LocalPlayer
local rng = Random.new()
local ORANGE = Color3.fromRGB(230, 130, 40)
local TEXT = Color3.fromRGB(245, 235, 220)
local DEFAULT_FOV = 70
-- ===== Интерфейс пролёта =====
local gui = Instance.new("ScreenGui")
gui.Name = "IntroHUD"
gui.ResetOnSpawn = false
gui.IgnoreGuiInset = true
gui.DisplayOrder = 900 -- поверх всего, кроме заставки загрузки
gui.Enabled = false
gui.Parent = player:WaitForChild("PlayerGui")
local function frame(props): Frame
local f = Instance.new("Frame")
f.BorderSizePixel = 0
for k, v in props do
f[k] = v
end
f.Parent = props.Parent or gui
return f
end
local function label(parent: Instance, props): TextLabel
local l = Instance.new("TextLabel")
l.BackgroundTransparency = 1
l.Font = Enum.Font.GothamBlack
l.TextColor3 = TEXT
l.TextStrokeColor3 = Color3.fromRGB(10, 5, 2)
l.TextStrokeTransparency = 0.3
for k, v in props do
l[k] = v
end
l.Parent = parent
return l
end
local BAR = 0.11 -- высота кинополосы, доля экрана
local topBar = frame({ Size = UDim2.fromScale(1, BAR), Position = UDim2.fromScale(0, -BAR), BackgroundColor3 = Color3.new(0, 0, 0) })
local bottomBar = frame({ Size = UDim2.fromScale(1, BAR), Position = UDim2.fromScale(0, 1), BackgroundColor3 = Color3.new(0, 0, 0) })
local flash = frame({ Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.new(1, 1, 1), BackgroundTransparency = 1 })
local fade = frame({ Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.new(0, 0, 0), BackgroundTransparency = 1 })
-- Титр карты внизу по центру
local title = label(bottomBar, { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.42), Size = UDim2.new(1, 0, 0.5, 0), TextScaled = true, TextColor3 = ORANGE, TextTransparency = 1, TextStrokeTransparency = 1 })
local subtitle = label(bottomBar, { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.8), Size = UDim2.new(1, 0, 0.26, 0), TextScaled = true, Font = Enum.Font.GothamBold, TextTransparency = 1, TextStrokeTransparency = 1 })
-- Табличка игрока: выезжает слева над нижней полосой
local plate = frame({ AnchorPoint = Vector2.new(0, 1), Position = UDim2.new(0, -520, 1 - BAR, -24), Size = UDim2.fromOffset(500, 86), BackgroundTransparency = 1 })
local plateAccent = frame({ Parent = plate, Size = UDim2.fromOffset(6, 86), BackgroundColor3 = ORANGE })
local plateName = label(plate, { Position = UDim2.fromOffset(18, 0), Size = UDim2.fromOffset(480, 50), TextSize = 42, TextXAlignment = Enum.TextXAlignment.Left })
local plateInfo = label(plate, { Position = UDim2.fromOffset(18, 50), Size = UDim2.fromOffset(480, 30), TextSize = 20, Font = Enum.Font.GothamBold, TextColor3 = ORANGE, TextXAlignment = Enum.TextXAlignment.Left })
local function tween(object: Instance, time: number, goal, style: Enum.EasingStyle?)
local t = TweenService:Create(object, TweenInfo.new(time, style or Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), goal)
t:Play()
return t
end
local function showText(l: TextLabel, visible: boolean, time: number)
tween(l, time, { TextTransparency = if visible then 0 else 1, TextStrokeTransparency = if visible then 0.3 else 1 })
end
local plateFor: Model? = nil
local function showPlate(model: Model?)
if model == plateFor then
return
end
plateFor = model
-- Старая уезжает, новая выезжает
tween(plate, 0.25, { Position = UDim2.new(0, -520, 1 - BAR, -24) })
if not model then
return
end
task.delay(0.25, function()
if plateFor ~= model then
return
end
local owner = Players:GetPlayerByUserId(model:GetAttribute("OwnerId") or 0)
local weapon = Config.PartById[model:GetAttribute("Weapon") or ""]
local front = Config.PartById[model:GetAttribute("Front") or ""]
plateName.Text = string.upper(if owner then owner.DisplayName else "Игрок")
plateInfo.Text = (if weapon then weapon.icon .. " " .. weapon.name else "")
.. (if front then " · " .. front.icon .. " " .. front.name else "")
local own = owner == player
plateAccent.BackgroundColor3 = if own then Color3.fromRGB(110, 220, 100) else ORANGE
tween(plate, 0.45, { Position = UDim2.new(0, 40, 1 - BAR, -24) }, Enum.EasingStyle.Back)
end)
end
-- ===== Эффекты =====
local effects = {}
local hiddenGuis = {}
local function startEffects()
local dof = Instance.new("DepthOfFieldEffect")
dof.FarIntensity = 0.45
dof.NearIntensity = 0.35
dof.InFocusRadius = 14
dof.FocusDistance = 30
dof.Parent = Lighting
local blur = Instance.new("BlurEffect")
blur.Size = 0
blur.Parent = Lighting
local grade = Instance.new("ColorCorrectionEffect")
grade.Contrast = 0.12
grade.Saturation = 0.12
grade.Parent = Lighting
effects = { dof = dof, blur = blur, grade = grade }
-- Прячем весь остальной интерфейс
hiddenGuis = {}
for _, other in player.PlayerGui:GetChildren() do
if other:IsA("ScreenGui") and other ~= gui and other.Enabled and other.Name ~= "LoadingScreen" then
other.Enabled = false
table.insert(hiddenGuis, other)
end
end
end
local function stopEffects()
for _, effect in effects do
effect:Destroy()
end
effects = {}
for _, other in hiddenGuis do
other.Enabled = true
end
hiddenGuis = {}
end
-- ===== Траектория =====
-- Catmull-Rom: гладкая кривая через точки p1→p2 (p0 и p3 — соседи для плавности).
local function catmull(p0: Vector3, p1: Vector3, p2: Vector3, p3: Vector3, t: number): Vector3
local t2, t3 = t * t, t * t * t
return 0.5 * ((2 * p1) + (p2 - p0) * t + (2 * p0 - 5 * p1 + 4 * p2 - p3) * t2 + (3 * p1 - p0 - 3 * p2 + p3) * t3)
end
local function smooth(t: number): number
return t * t * (3 - 2 * t)
end
-- Ключевые точки: time — когда камера в точке, get() → позиция, куда смотрит, угол обзора, крен, багги для таблички.
local function buildKeys(buggies: { Model }, live: () -> (Vector3, Vector3))
local mine, others = nil, {}
for _, model in buggies do
if model.PrimaryPart then
if model:GetAttribute("OwnerId") == player.UserId then
mine = model
else
table.insert(others, model)
end
end
end
local order = table.clone(others)
if mine then
table.insert(order, mine) -- свою — последней, сразу перед стыковкой
end
if #order == 0 then
return {}, 0 -- машин не видно (ещё не подгрузились) — без пролёта
end
local center = Vector3.zero
for _, model in order do
center += model.PrimaryPart.Position
end
center /= math.max(#order, 1)
local up = Vector3.new(0, 2, 0)
local yaw = rng:NextNumber(0, math.pi * 2)
local function around(angle: number, distance: number, height: number): Vector3
return center + Vector3.new(math.cos(angle) * distance, height, math.sin(angle) * distance)
end
local keys = {}
local t = 0
local function key(dt: number, get, caption: Model?)
t += dt
table.insert(keys, { time = t, get = get, caption = caption })
end
-- Общий план: высоко издалека, по дуге вниз к команде
key(0, function()
return around(yaw, 110, 75), center + up, 60, 0
end)
key(IC.Opening * 0.55, function()
return around(yaw + 0.9, 60, 32), center + up, 55, -3
end)
-- Проход вдоль каждой машины: низко с одного бока на другой, телевик, лёгкий крен
local first = true
for _, model in order do
local chassis = model.PrimaryPart
local side = if rng:NextNumber() < 0.5 then 1 else -1
key(if first then IC.Opening * 0.45 else IC.PerBuggy * 0.4, function()
local cf = chassis.CFrame
return (cf * CFrame.new(9 * side, 1.8, -13)).Position, cf.Position + up * 0.6, 40, 4 * side
end, model)
key(IC.PerBuggy * 0.6, function()
local cf = chassis.CFrame
return (cf * CFrame.new(-7 * side, 2.6, -4)).Position, cf.Position + up * 0.7, 44, -3 * side
end, model)
first = false
end
-- Взлёт за свою машину и стыковка с камерой за рулём
local finalChassis = (mine or order[#order]).PrimaryPart
key(IC.PerBuggy * 0.4 + IC.Final * 0.45, function()
local cf = finalChassis.CFrame
return (cf * CFrame.new(0, 10, 26)).Position, cf.Position + up * 1.5, 62, 0
end)
key(IC.Final * 0.55, function()
local position, look = live()
return position, look, DEFAULT_FOV, 0
end)
-- Подгоняем под общую длительность (как считает сервер)
local total = IC.Opening + IC.PerBuggy * #order + IC.Final
local scale = total / math.max(t, 0.01)
for _, k in keys do
k.time *= scale
end
return keys, total
end
-- ===== Проигрывание =====
local playing = 0
Remotes:WaitForChild("IntroStart").OnClientEvent:Connect(function(buggies: { Model }, startedAt: number, arena: number)
playing += 1
local id = playing
local camera = workspace.CurrentCamera
-- «Живая» камера за рулём: её ставит Driving.client раньше нас в этом же кадре — к ней и стыкуемся.
local livePosition, liveLook = camera.CFrame.Position, camera.CFrame.Position + camera.CFrame.LookVector * 20
local keys, total = buildKeys(buggies, function()
return livePosition, liveLook
end)
if #keys < 2 then
return
end
gui.Enabled = true
startEffects()
title.Text = "КАРТА КОМАНДЫ " .. arena
subtitle.Text = ("ВОЛНА 1 · %d %s В БОЙ"):format(#buggies, if #buggies == 1 then "БАГГИ ИДЁТ" else "БАГГИ ИДУТ")
-- Из темноты, кинополосы съезжаются, титр
fade.BackgroundTransparency = 0
tween(fade, 0.6, { BackgroundTransparency = 1 })
tween(topBar, 0.7, { Position = UDim2.fromScale(0, 0) })
tween(bottomBar, 0.7, { Position = UDim2.fromScale(0, 1 - BAR) })
task.delay(0.5, function()
showText(title, true, 0.6)
showText(subtitle, true, 0.6)
end)
task.delay(IC.Opening * 0.9, function()
showText(title, false, 0.4)
showText(subtitle, false, 0.4)
end)
local lastPosition: Vector3? = nil
local flashed = false
local finished = false
local function finish()
if finished then
return
end
finished = true
RunService:UnbindFromRenderStep("IntroCamera")
camera.FieldOfView = DEFAULT_FOV
showPlate(nil)
tween(topBar, 0.5, { Position = UDim2.fromScale(0, -BAR) })
tween(bottomBar, 0.5, { Position = UDim2.fromScale(0, 1) })
stopEffects()
task.delay(0.55, function()
if playing == id then
gui.Enabled = false
end
end)
end
RunService:BindToRenderStep("IntroCamera", Enum.RenderPriority.Camera.Value + 3, function(dt)
if playing ~= id then
finish()
return
end
-- Что сейчас поставила камера за рулём — финальная точка стыковки
livePosition = camera.CFrame.Position
liveLook = livePosition + camera.CFrame.LookVector * 20
local elapsed = workspace:GetServerTimeNow() - startedAt
if elapsed >= total then
finish()
return
end
local i = 1
while i < #keys - 1 and elapsed >= keys[i + 1].time do
i += 1
end
local a, b = keys[i], keys[i + 1]
local u = math.clamp((elapsed - a.time) / (b.time - a.time), 0, 1)
-- Мягкий разгон в начале и торможение у стыковки
if i == 1 or i == #keys - 1 then
u = smooth(u)
end
local prev, nextKey = keys[math.max(i - 1, 1)], keys[math.min(i + 2, #keys)]
local p0, l0, _, _ = prev.get()
local p1, l1, f1, r1 = a.get()
local p2, l2, f2, r2 = b.get()
local p3, l3, _, _ = nextKey.get()
local position = catmull(p0, p1, p2, p3, u)
local look = catmull(l0, l1, l2, l3, u)
local s = smooth(u)
camera.CFrame = CFrame.lookAt(position, look) * CFrame.Angles(0, 0, math.rad(r1 + (r2 - r1) * s))
camera.FieldOfView = f1 + (f2 - f1) * s
-- Табличка машины, к которой летим
showPlate(b.caption or a.caption)
-- Фокус на том, куда смотрим; размытие от скорости камеры
if effects.dof then
effects.dof.FocusDistance = (look - position).Magnitude
end
if effects.blur and lastPosition and dt > 0 then
local speed = (position - lastPosition).Magnitude / dt
effects.blur.Size = math.clamp((speed - 25) / 12, 0, 5)
end
lastPosition = position
-- Вспышка за мгновение до стыковки
if not flashed and elapsed > total - 0.35 then
flashed = true
flash.BackgroundTransparency = 0.6
tween(flash, 0.4, { BackgroundTransparency = 1 })
end
end)
end)
+19 -4
View File
@@ -154,11 +154,11 @@ RunService.RenderStepped:Connect(function()
end)
-- Подбор: вспышка цвета буста и расходящееся кольцо — видно всем рядом.
Remotes:WaitForChild("BoostPicked").OnClientEvent:Connect(function(position: Vector3, id: string)
local boost = Config.BoostById[id]
if not boost or (workspace.CurrentCamera.CFrame.Position - position).Magnitude > MAX_DISTANCE then
local function pickupFlash(position: Vector3, color: Color3, ringSize: number)
if (workspace.CurrentCamera.CFrame.Position - position).Magnitude > MAX_DISTANCE then
return
end
local boost = { color = color }
local holder = anchor(position)
burst(holder, {
Color = ColorSequence.new(boost.color, Color3.new(1, 1, 1)),
@@ -186,9 +186,24 @@ Remotes:WaitForChild("BoostPicked").OnClientEvent:Connect(function(position: Vec
ring.Size = Vector3.new(0.15, 2, 2)
ring.CFrame = CFrame.new(position - Vector3.new(0, 2, 0)) * CFrame.Angles(0, 0, math.pi / 2)
ring.Parent = workspace
TweenService:Create(ring, TweenInfo.new(0.5, Enum.EasingStyle.Quad), { Size = Vector3.new(0.15, 16, 16), Transparency = 1 }):Play()
TweenService:Create(ring, TweenInfo.new(0.5, Enum.EasingStyle.Quad), { Size = Vector3.new(0.15, ringSize, ringSize), Transparency = 1 }):Play()
Debris:AddItem(ring, 0.6)
Debris:AddItem(holder, 1)
end
Remotes:WaitForChild("BoostPicked").OnClientEvent:Connect(function(position: Vector3, id: string)
local boost = Config.BoostById[id]
if boost then
pickupFlash(position, boost.color, 16)
end
end)
-- Аптечка и командный буст с карты: та же вспышка, кольцо шире круга.
Remotes:WaitForChild("MapPickup").OnClientEvent:Connect(function(kind: string, position: Vector3, _userId: number, id: string?)
local color = if kind == "heal" then Config.MapEvents.Heal.Color else (Config.TeamBoostById[id or ""] or {}).color
if color then
pickupFlash(position + Vector3.new(0, 2, 0), color, Config.MapEvents.Radius * 4)
end
end)
HitRemote.OnClientEvent:Connect(function(position: Vector3, amount: number, killed: boolean)
+28 -3
View File
@@ -13,6 +13,7 @@ local Garage = require(script.Parent.Garage)
local Hangar = require(script.Parent.Hangar)
local Buggy = require(script.Parent.Buggy)
local Drops = require(script.Parent.Drops)
local MapEvents = require(script.Parent.MapEvents)
local World = require(script.Parent.World)
local Zombies = require(script.Parent.Zombies)
@@ -27,6 +28,7 @@ local DARK = Color3.fromRGB(38, 36, 34)
-- token меняется при каждом изменении состава — так отменяется устаревший отсчёт.
local circles = {}
local RoundRemote: RemoteEvent -- отсчёт перед раундом: клиенту приходит время старта (Round.client)
local IntroRemote: RemoteEvent -- пролёт камеры перед боем: багги команды и время начала (Intro.client)
local lastAction = {} -- [Player] = os.clock()
local function part(parent: Instance, props): BasePart
@@ -141,20 +143,39 @@ local function publish(circle)
end
-- Начало раунда: ждём, пока у всей команды пройдёт загрузка (багги пока на тормозе), появляются зомби,
-- отсчёт у всех игроков (RoundStart) — и на «НАЧАЛИ!» тормоз отпускается, зомби идут в атаку.
-- пролёт камеры над командой (IntroStart, Intro.client), отсчёт у всех игроков (RoundStart) —
-- и на «НАЧАЛИ!» тормоз отпускается, зомби идут в атаку.
local function startRound(index: number, team: { Player })
local start = workspace:GetServerTimeNow() + Config.Zombies.Countdown
local playing = {}
local buggies = {}
for _, player in team do
if player.Parent and player:GetAttribute("Arena") == index then
table.insert(playing, player)
RoundRemote:FireClient(player, start)
local buggy = Garage.BuggyOf(player)
if buggy then
table.insert(buggies, buggy)
end
end
end
if #playing == 0 then
return -- команда уже ушла
end
Zombies.Start(index)
local intro = Config.Intro
local introTime = intro.Opening + intro.PerBuggy * #buggies + intro.Final
local introStart = workspace:GetServerTimeNow()
for _, player in playing do
IntroRemote:FireClient(player, buggies, introStart, index)
end
task.wait(introTime)
local start = workspace:GetServerTimeNow() + Config.Zombies.Countdown
for _, player in playing do
if player.Parent and player:GetAttribute("Arena") == index then
RoundRemote:FireClient(player, start)
end
end
task.wait(Config.Zombies.Countdown)
for _, player in playing do
local buggy = Garage.BuggyOf(player)
@@ -252,6 +273,7 @@ local function leaveArena(player: Player, toHangar: boolean)
local circle = circles[player:GetAttribute("Arena") or 0]
player:SetAttribute("Arena", 0)
Drops.Reset(player) -- бусты действуют только до конца боя
MapEvents.Reset(player)
Garage.RemoveBuggy(player)
if toHangar then
task.spawn(Garage.Teleport, player, Hangar.SpawnPoint, "Ангар")
@@ -374,6 +396,9 @@ function Lobby.Init(remotes: Folder)
RoundRemote = Instance.new("RemoteEvent")
RoundRemote.Name = "RoundStart"
RoundRemote.Parent = remotes
IntroRemote = Instance.new("RemoteEvent")
IntroRemote.Name = "IntroStart"
IntroRemote.Parent = remotes
local ActionRemote = Instance.new("RemoteEvent")
ActionRemote.Name = "LobbyAction"
+2
View File
@@ -22,6 +22,7 @@ local Shards = require(script.Parent.Shards)
local Loading = require(script.Parent.Loading)
local Zombies = require(script.Parent.Zombies)
local Drops = require(script.Parent.Drops)
local MapEvents = require(script.Parent.MapEvents)
local remotes = Instance.new("Folder")
remotes.Name = "Remotes"
@@ -32,6 +33,7 @@ Loading.Init(remotes)
Shards.Init()
Zombies.Init(remotes)
Drops.Init(remotes)
MapEvents.Init(remotes)
Weapons.Init(remotes)
Garage.Init(remotes)
Lobby.Init(remotes)
+264
View File
@@ -0,0 +1,264 @@
-- События на карте команды во время боя: круги размером с круг лобби, со столбом света вверх.
-- Аптечка — кто зашёл или въехал в круг, получает часть HP. Одна на карте за раз, появляется в случайном месте.
-- Командный буст — появляется недалеко от игроков и ждёт подбора всего несколько секунд; взял один —
-- действует на всю команду (атрибуты TeamBoost/TeamBoostEnd у игроков, учитывает BuggyStats.BoostMultiplier).
-- Пропал неподобранным — следующий через Cooldown; подобран — не раньше, чем закончится действие.
-- Объекты лежат в папке боя (Zombies<номер>), поэтому убираются вместе с ней.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Config = require(ReplicatedStorage.Shared.Config)
local World = require(script.Parent.World)
local Zombies = require(script.Parent.Zombies)
local ME = Config.MapEvents
local MapEvents = {}
local CHECK_INTERVAL = 0.1
local BEAM_HEIGHT = 160
local SEGMENTS = 24
local WALL_H = 2.5
local rng = Random.new()
-- [номер карты] = { folder, heal = { model, center, expires }?, nextHeal, boost = { model, center, expires, def }?,
-- nextBoost, activeUntil }
local states = {}
local PickupRemote: RemoteEvent
local function playersIn(index: number)
local list = {}
for _, player in Players:GetPlayers() do
local character = player.Character
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
local root = character and character:FindFirstChild("HumanoidRootPart") :: BasePart?
if player:GetAttribute("Arena") == index and humanoid and root and humanoid.Health > 0 then
table.insert(list, { player = player, humanoid = humanoid, root = root })
end
end
return list
end
-- Место на земле на расстоянии distance = { от, до } от случайного игрока, внутри карты.
local function placeNear(index: number, targets, distance): Vector3?
if #targets == 0 then
return nil
end
local map = World.Arenas[index]
local limit = Config.World.Size / 2 - 20
for _ = 1, 15 do
local around = targets[rng:NextInteger(1, #targets)].root.Position
local angle = rng:NextNumber(0, math.pi * 2)
local d = rng:NextNumber(distance[1], distance[2])
local x, z = around.X + math.cos(angle) * d, around.Z + math.sin(angle) * d
if math.abs(x - map.origin.X) < limit and math.abs(z - map.origin.Z) < limit then
local ground = World.GroundHeight(x, z)
if ground then
return Vector3.new(x, ground, z)
end
end
end
return nil
end
local function part(parent: Instance, props): BasePart
local p = Instance.new("Part")
p.Anchored = true
p.CanCollide = false
p.CanQuery = false
p.CanTouch = false
p.CastShadow = false
for k, v in props do
p[k] = v
end
p.Parent = parent
return p
end
-- Круг как у лобби: светящееся кольцо, полупрозрачный пол, низкие стенки, столб света и значок над центром.
local function buildCircle(parent: Instance, name: string, ground: Vector3, color: Color3, icon: string, caption: string): Model
local R = ME.Radius
local model = Instance.new("Model")
model.Name = name
local disc = CFrame.new(ground) * CFrame.Angles(0, 0, math.pi / 2)
part(model, { Shape = Enum.PartType.Cylinder, Size = Vector3.new(0.12, R * 2, R * 2), CFrame = disc * CFrame.new(0.1, 0, 0), Color = color, Material = Enum.Material.Neon, Transparency = 0.45 })
local width = 2 * R * math.tan(math.pi / SEGMENTS) + 0.05
for i = 0, SEGMENTS - 1 do
local around = CFrame.new(ground) * CFrame.Angles(0, i / SEGMENTS * math.pi * 2, 0)
part(model, { Size = Vector3.new(width, WALL_H, 0.2), CFrame = around * CFrame.new(0, WALL_H / 2, -R), Color = color, Material = Enum.Material.Glass, Transparency = 0.6 })
part(model, { Size = Vector3.new(width, 0.2, 0.3), CFrame = around * CFrame.new(0, WALL_H, -R), Color = color, Material = Enum.Material.Neon, Transparency = 0.2 })
end
local core = part(model, { Name = "Core", Size = Vector3.new(0.2, 0.2, 0.2), CFrame = CFrame.new(ground + Vector3.new(0, 0.2, 0)), Transparency = 1 })
local bottom = Instance.new("Attachment")
bottom.Parent = core
local top = Instance.new("Attachment")
top.Position = Vector3.new(0, BEAM_HEIGHT, 0)
top.Parent = core
local beam = Instance.new("Beam")
beam.Attachment0 = bottom
beam.Attachment1 = top
beam.Color = ColorSequence.new(color)
beam.LightEmission = 1
beam.LightInfluence = 0
beam.Width0 = R * 1.4
beam.Width1 = R * 0.6
beam.FaceCamera = true
beam.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.35), NumberSequenceKeypoint.new(0.5, 0.7), NumberSequenceKeypoint.new(1, 1) })
beam.Parent = core
local light = Instance.new("PointLight")
light.Color = color
light.Range = 22
light.Brightness = 3
light.Shadows = false
light.Parent = core
-- Значок и подпись над кругом (у командного буста клиент дописывает обратный отсчёт)
local board = Instance.new("BillboardGui")
board.Name = "Board"
board.Size = UDim2.fromScale(10, 5)
board.StudsOffsetWorldSpace = Vector3.new(0, 6, 0)
board.LightInfluence = 0
board.MaxDistance = 300
board.Parent = core
local iconLabel = Instance.new("TextLabel")
iconLabel.BackgroundTransparency = 1
iconLabel.Size = UDim2.fromScale(1, 0.6)
iconLabel.Font = Enum.Font.GothamBlack
iconLabel.TextScaled = true
iconLabel.Text = icon
iconLabel.Parent = board
local captionLabel = Instance.new("TextLabel")
captionLabel.Name = "Caption"
captionLabel.BackgroundTransparency = 1
captionLabel.Position = UDim2.fromScale(0, 0.6)
captionLabel.Size = UDim2.fromScale(1, 0.4)
captionLabel.Font = Enum.Font.GothamBlack
captionLabel.TextScaled = true
captionLabel.TextColor3 = color
captionLabel.TextStrokeTransparency = 0.3
captionLabel.Text = caption
captionLabel.Parent = board
model.Parent = parent
return model
end
-- Кто из игроков карты внутри круга (персонаж или его багги — у машины запас на размер).
local function inside(targets, center: Vector3)
for _, target in targets do
local seat = target.humanoid.SeatPart
local position = if seat then seat.AssemblyRootPart.Position else target.root.Position
local flat = (position - center) * Vector3.new(1, 0, 1)
if flat.Magnitude <= ME.Radius + (if seat then 3 else 0.5) and math.abs(position.Y - center.Y) < 12 then
return target
end
end
return nil
end
local function remove(slot)
if slot and slot.model.Parent then
slot.model:Destroy()
end
end
local function update(index: number, s, targets)
local now = workspace:GetServerTimeNow()
-- Аптечка
if s.heal then
local who = inside(targets, s.heal.center)
if who then
local h = who.humanoid
h.Health = math.min(h.MaxHealth, h.Health + h.MaxHealth * ME.Heal.Amount)
PickupRemote:FireAllClients("heal", s.heal.center, who.player.UserId)
remove(s.heal)
s.heal = nil
s.nextHeal = now + rng:NextNumber(ME.Heal.Interval[1], ME.Heal.Interval[2])
elseif now > s.heal.expires then
remove(s.heal)
s.heal = nil
s.nextHeal = now + rng:NextNumber(ME.Heal.Interval[1], ME.Heal.Interval[2])
end
elseif now >= s.nextHeal then
local ground = placeNear(index, targets, ME.Heal.Distance)
if ground then
local model = buildCircle(s.folder, "HealCircle", ground, ME.Heal.Color, ME.Heal.Icon, ("+%d%% HP"):format(ME.Heal.Amount * 100))
s.heal = { model = model, center = ground, expires = now + ME.Heal.Lifetime }
end
end
-- Командный буст
local TB = ME.TeamBoost
if s.boost then
local who = inside(targets, s.boost.center)
if who then
local def = s.boost.def
local ends = now + def.duration
for _, target in targets do
target.player:SetAttribute("TeamBoost", def.id)
target.player:SetAttribute("TeamBoostEnd", ends)
end
PickupRemote:FireAllClients("team", s.boost.center, who.player.UserId, def.id, ends)
remove(s.boost)
s.boost = nil
s.activeUntil = ends
s.nextBoost = math.max(ends, now + TB.Cooldown)
elseif now > s.boost.expires then
remove(s.boost) -- не успели — пропадает
s.boost = nil
s.nextBoost = now + TB.Cooldown
end
elseif now >= s.nextBoost and now >= s.activeUntil then
local ground = placeNear(index, targets, TB.Distance)
if ground then
local def = TB.List[rng:NextInteger(1, #TB.List)]
local model = buildCircle(s.folder, "TeamBoost", ground, def.color, def.icon, ("+%d%% %s"):format(def.value * 100, def.name))
model:SetAttribute("ExpiresAt", now + TB.Wait) -- клиент пишет над кругом, сколько осталось
model:SetAttribute("Boost", def.id)
s.boost = { model = model, center = ground, expires = now + TB.Wait, def = def }
end
end
end
local function tick()
local now = workspace:GetServerTimeNow()
for index = 1, #World.Arenas do
local folder = Zombies.Battle(index)
local s = states[index]
if not folder then
states[index] = nil -- боя нет — объекты убрались вместе с папкой
continue
end
if not s or s.folder ~= folder then
-- Бой только начался: первая аптечка и первый буст — не сразу.
s = { folder = folder, nextHeal = now + 12, nextBoost = now + 15, activeUntil = 0 }
states[index] = s
end
local targets = playersIn(index)
if #targets > 0 then
update(index, s, targets)
end
end
end
-- Игрок ушёл с карты — командный буст ему больше не нужен.
function MapEvents.Reset(player: Player)
player:SetAttribute("TeamBoost", nil)
player:SetAttribute("TeamBoostEnd", nil)
end
function MapEvents.Init(remotes: Folder)
PickupRemote = Instance.new("RemoteEvent")
PickupRemote.Name = "MapPickup"
PickupRemote.Parent = remotes
task.spawn(function()
while true do
task.wait(CHECK_INTERVAL)
tick()
end
end)
end
return MapEvents
+8 -2
View File
@@ -469,9 +469,9 @@ local function think(arena)
end
if distance <= data.attackRange and now - data.lastAttack >= data.attackCooldown then
data.lastAttack = now
-- Буст «Броня» уменьшает урон по игроку
-- Буст «Броня» из дропа и командная броня с карты уменьшают урон по игроку
local armor = Config.BoostById.armor
local reduce = math.min(0.8, armor.step * BuggyStats.BoostStacks(nearest.player, "armor"))
local reduce = math.min(0.8, armor.step * BuggyStats.BoostStacks(nearest.player, "armor") + BuggyStats.TeamBonus(nearest.player, "armor"))
nearest.humanoid:TakeDamage(data.attackDamage * (1 - reduce))
end
elseif data.walk and data.walk.IsPlaying then
@@ -528,6 +528,12 @@ function Zombies.Attack(index: number)
end
end
-- Идёт ли бой на карте (после «НАЧАЛИ!»), и папка карты для её объектов.
function Zombies.Battle(index: number): Folder?
local arena = arenas[index]
return if arena and arena.attacking then arena.folder else nil
end
function Zombies.Stop(index: number)
local arena = arenas[index]
if arena then
+15 -2
View File
@@ -55,13 +55,26 @@ function BuggyStats.BoostStacks(player: Player, id: string): number
return player:GetAttribute("Boost_" .. id) or 0
end
-- Множитель от буста: 1 + step × количество (скорострельность, урон, таран, скорость, манёвренность).
-- Командный буст с карты (атрибуты TeamBoost* ставит сервер, MapEvents): прибавка к stat, пока не истёк.
function BuggyStats.TeamBonus(player: Player?, stat: string): number
if not player then
return 0
end
local boost = Config.TeamBoostById[player:GetAttribute("TeamBoost") or ""]
if boost and boost.stat == stat and workspace:GetServerTimeNow() < (player:GetAttribute("TeamBoostEnd") or 0) then
return boost.value
end
return 0
end
-- Множитель от буста: 1 + step × количество (скорострельность, урон, таран, скорость, манёвренность)
-- плюс действующий командный буст на тот же показатель.
function BuggyStats.BoostMultiplier(player: Player?, id: string): number
local boost = Config.BoostById[id]
if not player or not boost then
return 1
end
return 1 + boost.step * BuggyStats.BoostStacks(player, id)
return 1 + boost.step * BuggyStats.BoostStacks(player, id) + BuggyStats.TeamBonus(player, id)
end
return BuggyStats
+40
View File
@@ -172,6 +172,14 @@ Config.Zombies = {
Glow = Color3.fromRGB(110, 255, 80), -- свечение: свет от тела, дымка, глаза
}
-- Пролёт камеры перед боем (между загрузкой команды и отсчётом): общий план, проход вдоль каждой багги,
-- стыковка с камерой за рулём. Длительность = Opening + PerBuggy × машин + Final, секунд.
Config.Intro = {
Opening = 3,
PerBuggy = 2.4,
Final = 2.4,
}
-- Волны: в каждой конечное число зомби (одновременно на карте — не больше Config.Zombies Base/PerPlayer/Max).
-- Волна выбита — появляется Босс-Зомби, после него передышка и следующая волна, больше прежней.
Config.Waves = {
@@ -215,6 +223,37 @@ for _, boost in Config.Boosts.List do
Config.BoostById[boost.id] = boost
end
-- События на карте команды (после «НАЧАЛИ!»): круги размером с круг лобби, со столбом света.
Config.MapEvents = {
Radius = 6, -- как у кругов лобби: ниже, после Config.Lobby, подставляется Config.Lobby.Radius
-- Аптечка: кто зашёл или въехал в круг, получает Amount от максимума HP. Одна на карте за раз.
Heal = {
Amount = 0.2,
Interval = { 20, 35 }, -- через сколько секунд после подбора (или исчезновения) появится новая
Distance = { 50, 140 }, -- на каком расстоянии от случайного игрока
Lifetime = 40,
Color = Color3.fromRGB(90, 235, 110),
Icon = "➕",
},
-- Командный буст: ждёт подбора всего Wait секунд, взял один — действует на всю команду.
-- Следующий появляется не раньше Cooldown секунд и не раньше, чем закончится действие текущего.
TeamBoost = {
Wait = 5,
Cooldown = 15,
Distance = { 20, 40 },
-- stat — что усиливает (как бусты из дропа: damage, firerate, armor), value — на сколько
List = {
{ id = "team_damage", name = "Урон команды", stat = "damage", value = 0.10, duration = 10, icon = "⚔️", color = Color3.fromRGB(255, 80, 60) },
{ id = "team_firerate", name = "Скорострельность команды", stat = "firerate", value = 0.2, duration = 10, icon = "⚡", color = Color3.fromRGB(255, 190, 40) },
{ id = "team_armor", name = "Броня команды", stat = "armor", value = 0.25, duration = 10, icon = "🛡️", color = Color3.fromRGB(120, 170, 255) },
},
},
}
Config.TeamBoostById = {}
for _, boost in Config.MapEvents.TeamBoost.List do
Config.TeamBoostById[boost.id] = boost
end
-- Осколки — внутриигровая валюта: открывают закрытые детали и покраски.
-- Выпадают на колесе фортуны и из кейсов (kind = "shards", amount = N).
Config.Shards = {
@@ -241,6 +280,7 @@ Config.Lobby = {
Color3.fromRGB(230, 80, 210),
},
}
Config.MapEvents.Radius = Config.Lobby.Radius -- круги аптечек и бустов — как круги лобби
-- Колесо фортуны в ангаре: призы — редкие покраски (по имени из Config.Garage.Paints), «Кейс» или «Пусто».
Config.Fortune = {