From 019068cffa95793d415f6abb0e93f5d7aecab767 Mon Sep 17 00:00:00 2001 From: min Date: Tue, 9 Jun 2026 22:55:54 +0300 Subject: [PATCH] =?UTF-8?q?docs(42)=20+=20feat(g43):=20=C2=AB=D0=93=D0=BE?= =?UTF-8?q?=D0=BD=D0=BA=D0=B0=20=D1=81=20=D0=BF=D1=80=D0=B5=D0=BF=D1=8F?= =?UTF-8?q?=D1=82=D1=81=D1=82=D0=B2=D0=B8=D1=8F=D0=BC=D0=B8=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit g42 docs: CodeBoth 4 скрипта. g43 паритет: - Heartbeat: time += dt → timer - BindableEvents Boost/Spike/FinishReached - Boost → set_speed(1.8) + pickup + 'УСКОРЕНИЕ!', task.delay 3 → set_speed(1) - Spike → damage_player(15) + set_speed(0.5) + hit, task.delay 1.5 → 1 - Finish → 'Финиш! Время: X сек' + confetti - 3 g43_boost_N + 5 g43_spike_N: Touched throttle 1с → Fire соответствующее - g43_finish: Touched → FinishReached:Fire Shim: __rbxl_set_speed(mul) → cmd 'player.setSpeed' с полем 'mul'. --- src/community/docsGamesBuildersLua.js | 117 +++++++++++++++++++++++++- src/community/docsLessons.jsx | 16 ++-- src/editor/engine/lua/RobloxShim.js | 4 + 3 files changed, 128 insertions(+), 9 deletions(-) diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index 6538f92..d29a593 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -3943,7 +3943,122 @@ end)`, }, // ═══════════════════════════════════════════════════════════════ - // ИГРЫ 43-50: явных Lua-версий пока нет. + // ИГРА 43 — «Гонка с препятствиями» + // ═══════════════════════════════════════════════════════════════ + 'obstacle-race': (function() { + const BOOST_IDS = [1, 2, 3]; // id 1-3 — бусты + const SPIKE_IDS = [4, 5, 6, 7, 8]; // id 4-8 — шипы + const overrides = { + g43_main: `-- === ИГРА «ГОНКА С ПРЕПЯТСТВИЯМИ» — главный скрипт (Lua) === +${SNIPPET_BROADCAST} + +local RunService = game:GetService("RunService") +local time = 0 +local won = false + +__rbxl_timer_set(0) +__rbxl_show_text("Гонка! Синее ускоряет, шипы мешают", 4) + +local pickupSound = Instance.new("Sound", workspace) +pickupSound.SoundId = "pickup"; pickupSound.Volume = 0.7 +local hitSound = Instance.new("Sound", workspace) +hitSound.SoundId = "hit"; hitSound.Volume = 0.6 +local winSound = Instance.new("Sound", workspace) +winSound.SoundId = "win"; winSound.Volume = 1 + +-- Таймер каждый кадр +RunService.Heartbeat:Connect(function(dt) + if won then return end + time = time + dt + __rbxl_timer_set(time) +end) + +-- Буст ускоряет на 3с +local boostEvent = getEvent("Boost") +boostEvent.Event:Connect(function() + __rbxl_set_speed(1.8) + pickupSound:Play() + __rbxl_show_text("УСКОРЕНИЕ!", 1) + task.delay(3, function() __rbxl_set_speed(1) end) +end) + +-- Шип бьёт + замедляет на 1.5с +local spikeEvent = getEvent("Spike") +spikeEvent.Event:Connect(function() + __rbxl_damage_player(15) + __rbxl_set_speed(0.5) + hitSound:Play() + task.delay(1.5, function() __rbxl_set_speed(1) end) +end) + +-- Финиш +local finishEvent = getEvent("FinishReached") +finishEvent.Event:Connect(function() + if won then return end + won = true + local t = math.floor(time * 10) / 10 + __rbxl_show_text("Финиш! Время: " .. t .. " сек", 6) + 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)`, + g43_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("FinishReached") + if ev then ev:Fire() end +end)`, + }; + // Бусты — Touched → Boost:Fire (throttle 1с) + const boostScript = `-- === Скрипт буста (Lua) === +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local part = script.Parent +local lastFire = 0 + +part.Touched:Connect(function(hit) + local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") + if not h then return end + local now = tick() + if now - lastFire < 1 then return end + lastFire = now + local ev = ReplicatedStorage:FindFirstChild("Boost") + if ev then ev:Fire() end +end)`; + for (const bid of BOOST_IDS) { + overrides['g43_boost_' + bid] = boostScript; + } + // Шипы — Touched → Spike:Fire (throttle 1с) + const spikeScript = `-- === Скрипт шипа-ловушки (Lua) === +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local part = script.Parent +local lastFire = 0 + +part.Touched:Connect(function(hit) + local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") + if not h then return end + local now = tick() + if now - lastFire < 1 then return end + lastFire = now + local ev = ReplicatedStorage:FindFirstChild("Spike") + if ev then ev:Fire() end +end)`; + for (const sid of SPIKE_IDS) { + overrides['g43_spike_' + sid] = spikeScript; + } + return overrides; + })(), + + // ═══════════════════════════════════════════════════════════════ + // ИГРЫ 44-50: явных Lua-версий пока нет. // buildGameProject в docsGamesBuilders.js использует generateFallbackLua // (главный скрипт → показ подсказки + слушает FinishReached → // победа+конфетти; скрипт на финиш-примитиве → шлёт FinishReached; diff --git a/src/community/docsLessons.jsx b/src/community/docsLessons.jsx index 53d053e..00d3e74 100644 --- a/src/community/docsLessons.jsx +++ b/src/community/docsLessons.jsx @@ -5986,7 +5986,7 @@ game.self.onTouch(() => {

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

- {`// === ИГРА «RPG-ДЕРЕВНЯ» — главный скрипт === + {`// === ИГРА «RPG-ДЕРЕВНЯ» — главный скрипт === // этап: 0=начало, 1=ищем амулет, 2=несём кузнецу, 3=готово let stage = 0; @@ -6038,7 +6038,7 @@ game.onMessage('smithTalk', () => { } else { smith.say('Принеси мне амулет — поговори со старостой.', 4); } -});`} +});`}

Разберём: