From 57c57796442d682dad975926d5c6ae7051056123 Mon Sep 17 00:00:00 2001 From: min Date: Tue, 9 Jun 2026 23:12:28 +0300 Subject: [PATCH] =?UTF-8?q?docs(46)=20+=20feat(g47):=20=C2=AB=D0=9A=D0=B2?= =?UTF-8?q?=D0=B5=D1=81=D1=82-=D0=BF=D0=BE=D0=B1=D0=B5=D0=B3=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit g46 docs: CodeBoth 4 скрипта (main+cube+up1+up2). g47 паритет: - TOTAL=3, pressed/escaped counters - BindableEvents ButtonPressed/Escape - 3 g47_btn_N: Heartbeat distance(3) + '[E] Нажать кнопку' E → used=true + Color зелёный + ButtonPressed:Fire - При pressed>=3: tween двери Position.Y+6 + CanCollide=false + win sound - g47_finish: Touched → Escape:Fire → 'Победа! Сбежал!' + confetti --- src/community/docsGamesBuildersLua.js | 115 ++++++++++++++++++++++++-- src/community/docsLessons.jsx | 16 ++-- 2 files changed, 116 insertions(+), 15 deletions(-) diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index 72de679..6e238e7 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -4343,13 +4343,114 @@ end)`, }, // ═══════════════════════════════════════════════════════════════ - // ИГРЫ 46-50: явных Lua-версий пока нет. - // buildGameProject в docsGamesBuilders.js использует generateFallbackLua - // (главный скрипт → показ подсказки + слушает FinishReached → - // победа+конфетти; скрипт на финиш-примитиве → шлёт FinishReached; - // остальные target-скрипты → красят примитив на касание). - // Это даёт «хоть что-то рабочее» в любой игре до того как напишем - // полноценный Lua-скрипт. Когда дописываем игру — добавляем сюда явный override. + // ИГРА 47 — «Квест-побег» + // ═══════════════════════════════════════════════════════════════ + 'escape-quest': (function() { + const BTN_COUNT = 3; + const overrides = { + g47_main: `-- === ИГРА «КВЕСТ-ПОБЕГ» — главный скрипт (Lua) === +${SNIPPET_BROADCAST} + +local TweenService = game:GetService("TweenService") +local TOTAL = ${BTN_COUNT} +local pressed = 0 +local escaped = false + +__rbxl_show_text("Найди и нажми 3 кнопки, чтобы выйти!", 4) + +local clickSound = Instance.new("Sound", workspace) +clickSound.SoundId = "click"; clickSound.Volume = 0.6 +local winSound = Instance.new("Sound", workspace) +winSound.SoundId = "win"; winSound.Volume = 1 + +local btnEvent = getEvent("ButtonPressed") +btnEvent.Event:Connect(function() + pressed = pressed + 1 + clickSound:Play() + __rbxl_show_text("Кнопка " .. pressed .. " из " .. TOTAL, 1.5) + if pressed >= TOTAL then + 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 + __rbxl_show_text("Все кнопки нажаты! Дверь открыта!", 3) + winSound:Play() + end +end) + +local escEvent = getEvent("Escape") +escEvent.Event:Connect(function() + if escaped then return end + escaped = 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)`, + g47_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("Escape") + if ev then ev:Fire() end +end)`, + }; + for (let i = 1; i <= BTN_COUNT; i++) { + overrides['g47_btn_' + i] = `-- === Скрипт кнопки ${i} (Lua) === +local UserInputService = game:GetService("UserInputService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local part = script.Parent +local used = false +local hintVisible = false + +RunService.Heartbeat:Connect(function() + if used then return end + 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("g47_btn_${i}_hint", "[E] Нажать кнопку", 50, 75, "#ffe44a", 20) + else + __rbxl_hud_set("g47_btn_${i}_hint", nil) + end + end +end) + +UserInputService.InputBegan:Connect(function(input, gp) + if gp then return end + if not hintVisible then return end + if used then return end + if input.KeyCode ~= Enum.KeyCode.E then return end + used = true + __rbxl_hud_set("g47_btn_${i}_hint", nil) + part.Color = Color3.fromRGB(34, 221, 85) + local ev = ReplicatedStorage:FindFirstChild("ButtonPressed") + if ev then ev:Fire() end +end)`; + } + return overrides; + })(), + + // ═══════════════════════════════════════════════════════════════ + // ИГРЫ 48-50: явных Lua-версий пока нет. + // buildGameProject в docsGamesBuilders.js использует generateFallbackLua. 'clicker': { g46_main: `-- === ИГРА «КЛИКЕР» — главный скрипт (Lua) === ${SNIPPET_BROADCAST} diff --git a/src/community/docsLessons.jsx b/src/community/docsLessons.jsx index 2bed13c..1450e1f 100644 --- a/src/community/docsLessons.jsx +++ b/src/community/docsLessons.jsx @@ -6660,7 +6660,7 @@ game.every(1.8, () => {

Шаг 2. Главный скрипт

- {`// === ИГРА «КЛИКЕР» — главный скрипт === + {`// === ИГРА «КЛИКЕР» — главный скрипт === let points = 0; // очки let perClick = 1; // очков за клик @@ -6725,7 +6725,7 @@ game.onMessage('buyAuto', () => { game.ui.score = points; game.sound.play('pickup'); game.ui.showText('Авто-доход: +' + autoIncome + ' в секунду', 2); -});`} +});`}

Разберём: