From eb04da63485868faada066b7eb0448e490b6b177 Mon Sep 17 00:00:00 2001 From: min Date: Tue, 9 Jun 2026 21:33:12 +0300 Subject: [PATCH] =?UTF-8?q?feat(g23):=20=D0=BF=D0=BE=D0=BB=D0=BD=D1=8B?= =?UTF-8?q?=D0=B9=20=D0=BF=D0=B0=D1=80=D0=B8=D1=82=D0=B5=D1=82=20=C2=AB?= =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BA=D0=BB=D1=8E=D1=87=D0=B0=D1=82?= =?UTF-8?q?=D0=B5=D0=BB=D0=B8=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JS: - showText 'Дёрни рычаги в нужном порядке (E)' - onMessage 'lever' с {num} → click sound + pressed.push + проверка совпадения с ORDER=[2,3,1]. Ошибка → reset + 'Неверно!' + lose Полная последовательность → 'Верно! Дверь открыта' + win + tween двери - onMessage 'win' → 'Победа!' + win + confetti - лычаги: onInteract E (distance=3) → broadcast 'lever' {num} - финиш: onTouch → broadcast 'win' Lua (паритет): - __rbxl_show_text + Sounds - BindableEvents LeverPulled (с num аргументом) + WinReached - g23_main: проверка порядка + tween двери (Position.Y+6) + CanCollide=false - 3 g23_lever_N: Heartbeat distance-check (3), __rbxl_hud_set '[E] Дёрнуть рычаг N' в нижней части экрана. UserInputService.InputBegan E → LeverPulled:Fire(n) - g23_finish: Touched → WinReached:Fire (fired-флаг) --- src/community/docsGamesBuildersLua.js | 117 +++++++++++++++++++++++--- 1 file changed, 106 insertions(+), 11 deletions(-) diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index 765cdd3..95335a3 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -1963,22 +1963,117 @@ end)`, // ═══════════════════════════════════════════════════════════════ // ИГРА 23 — «3 переключателя» // ═══════════════════════════════════════════════════════════════ - 'switches': { - g23_main: `-- === ИГРА «3 ПЕРЕКЛЮЧАТЕЛЯ» (Lua) === + 'switches': (function() { + const overrides = { + g23_main: `-- === ИГРА «ПЕРЕКЛЮЧАТЕЛИ» — главный скрипт (Lua) === ${SNIPPET_BROADCAST} -local activated = {false, false, false} -print("Активируй все 3 переключателя!") +local TweenService = game:GetService("TweenService") +local ORDER = { 2, 3, 1 } -- правильный порядок рычагов +local pressed = {} +local opened = false +local won = false -local ev = getEvent("SwitchToggled") -ev.Event:Connect(function(idx) - activated[idx] = true - print("Переключатель " .. idx .. " активирован") - if activated[1] and activated[2] and activated[3] then - print("ПОБЕДА! Все 3 активированы!") +__rbxl_show_text("Дёрни рычаги в нужном порядке (E)", 4) + +local clickSound = Instance.new("Sound", workspace) +clickSound.SoundId = "click"; clickSound.Volume = 0.7 +local loseSound = Instance.new("Sound", workspace) +loseSound.SoundId = "lose"; loseSound.Volume = 0.7 +local winSound = Instance.new("Sound", workspace) +winSound.SoundId = "win"; winSound.Volume = 1 + +-- Рычаги шлют ev:Fire(num) с номером +local leverEvent = getEvent("LeverPulled") +leverEvent.Event:Connect(function(num) + if opened then return end + clickSound:Play() + table.insert(pressed, num) + local i = #pressed + if pressed[i] ~= ORDER[i] then + pressed = {} + __rbxl_show_text("Неверно! Рычаги сброшены.", 1.5) + loseSound:Play() + return end + if #pressed == #ORDER then + opened = true + __rbxl_show_text("Верно! Дверь открыта.", 3) + winSound:Play() + local door = workspace:FindFirstChild("Дверь") + if door then + local dp = door.Position + local goal = { Position = Vector3.new(dp.X, dp.Y + 6, dp.Z) } + TweenService:Create(door, TweenInfo.new(1.2), goal):Play() + door.CanCollide = false + end + else + __rbxl_show_text("Так держать!", 1) + end +end) + +-- Финиш +local winEvent = getEvent("WinReached") +winEvent.Event:Connect(function() + if won then return end + won = true + __rbxl_show_text("Победа! Ты разгадал порядок!", 5) + winSound:Play() + local px = __rbxl_player_x() + local py = __rbxl_player_y() + local pz = __rbxl_player_z() + __rbxl_spawn_particles("confetti", px, py + 3, pz, 3, 3) end)`, - }, + g23_finish: `-- === Скрипт финиша (Lua) === +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local part = script.Parent +local fired = false + +part.Touched:Connect(function(hit) + if fired then return end + local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") + if not h then return end + fired = true + local ev = ReplicatedStorage:FindFirstChild("WinReached") + if ev then ev:Fire() end +end)`, + }; + // 3 рычага — каждый ждёт E когда игрок рядом, шлёт свой номер + for (let n = 1; n <= 3; n++) { + overrides['g23_lever_' + n] = `-- === Скрипт рычага ${n} (Lua) === +local UserInputService = game:GetService("UserInputService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local part = script.Parent +local hintVisible = false + +RunService.Heartbeat:Connect(function() + local px = __rbxl_player_x() + local pz = __rbxl_player_z() + local dx = part.Position.X - px + local dz = part.Position.Z - pz + local dist = math.sqrt(dx*dx + dz*dz) + local near = dist <= 3 + if near ~= hintVisible then + hintVisible = near + if near then + __rbxl_hud_set("g23_lever_${n}_hint", "[E] Дёрнуть рычаг ${n}", 50, 75, "#ffe44a", 20) + else + __rbxl_hud_set("g23_lever_${n}_hint", nil) + end + end +end) + +UserInputService.InputBegan:Connect(function(input, gp) + if gp then return end + if not hintVisible then return end + if input.KeyCode ~= Enum.KeyCode.E then return end + local ev = ReplicatedStorage:FindFirstChild("LeverPulled") + if ev then ev:Fire(${n}) end +end)`; + } + return overrides; + })(), // ═══════════════════════════════════════════════════════════════ // ИГРА 24 — «Падающий мост»