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); } -});`} +});`}

Разберём: