From 17417b1b3367138f1196681d4cd9bc003d088ef6 Mon Sep 17 00:00:00 2001 From: min Date: Tue, 9 Jun 2026 21:50:08 +0300 Subject: [PATCH] =?UTF-8?q?feat(g27):=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=94=D0=B2=D0=BE=D0=B9=D0=BD=D0=BE=D0=B9=20=D0=BF=D1=80=D1=8B?= =?UTF-8?q?=D0=B6=D0=BE=D0=BA=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JS: - player.setDoubleJump(true) - showText 'Жми Space ДВАЖДЫ — двойной прыжок!' - onTick: y<-3 → respawn + lose - onMessage 'win' → 'Победа!' + win + confetti - финиш: onTouch → broadcast 'win' Lua (паритет): - __rbxl_set_double_jump(true) — паритет с player.setDoubleJump - __rbxl_show_text + Sounds - Heartbeat: player_y < -3 → LoadCharacter + lose - BindableEvent WinReached - g27_finish: Touched → WinReached:Fire (fired-флаг) Shim добавил __rbxl_set_double_jump(bool) → cmd 'player.setDoubleJump'. --- src/community/docsGamesBuildersLua.js | 75 +++++++++++++++++---------- src/editor/engine/lua/RobloxShim.js | 4 ++ 2 files changed, 51 insertions(+), 28 deletions(-) diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index 278f5cb..bfce9b1 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -2290,39 +2290,58 @@ end)`; // ИГРА 27 — «Двойной прыжок» // ═══════════════════════════════════════════════════════════════ 'double-jump': { - g27_main: `-- === ИГРА «ДВОЙНОЙ ПРЫЖОК» (Lua) === + g27_main: `-- === ИГРА «ДВОЙНОЙ ПРЫЖОК» — главный скрипт (Lua) === +${SNIPPET_BROADCAST} + local Players = game:GetService("Players") -local UserInputService = game:GetService("UserInputService") +local RunService = game:GetService("RunService") +local player = Players.LocalPlayer +local won = false -local function setupDoubleJump(player) - local jumpsLeft = 2 - local char = player.Character or player.CharacterAdded:Wait() - local h = char:WaitForChild("Humanoid") +-- Включаем игроку двойной прыжок — теперь можно прыгнуть ещё раз в воздухе +__rbxl_set_double_jump(true) +__rbxl_show_text("Жми Space ДВАЖДЫ — двойной прыжок!", 4) - -- Восстанавливаем прыжки при касании земли - h.StateChanged:Connect(function(_, newState) - if newState == Enum.HumanoidStateType.Landed then - jumpsLeft = 2 - end - end) +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 - UserInputService.InputBegan:Connect(function(input, gp) - if gp then return end - if input.KeyCode == Enum.KeyCode.Space and jumpsLeft > 0 then - jumpsLeft = jumpsLeft - 1 - if jumpsLeft == 1 then - local hrp = char:FindFirstChild("HumanoidRootPart") - if hrp then - hrp.Velocity = Vector3.new(hrp.Velocity.X, 50, hrp.Velocity.Z) - end - end - end - end) -end +-- Респаун при падении в пропасть +RunService.Heartbeat:Connect(function() + if won then return end + local py = __rbxl_player_y() + if py < -3 then + player:LoadCharacter() + loseSound:Play() + end +end) -Players.PlayerAdded:Connect(setupDoubleJump) -for _, p in ipairs(Players:GetPlayers()) do setupDoubleJump(p) end -print("Жми Space дважды — двойной прыжок!")`, +-- Финиш сообщает о победе +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)`, + g27_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)`, }, // ═══════════════════════════════════════════════════════════════ diff --git a/src/editor/engine/lua/RobloxShim.js b/src/editor/engine/lua/RobloxShim.js index 20f8b2f..7f9a77f 100644 --- a/src/editor/engine/lua/RobloxShim.js +++ b/src/editor/engine/lua/RobloxShim.js @@ -1970,6 +1970,10 @@ export function registerRobloxShim(lua, opts) { const text = value == null ? null : ('Очки: ' + value); send('ui.set', { id: '__score', text }); }); + // Двойной прыжок — паритет с JS game.player.setDoubleJump(bool). + global.set('__rbxl_set_double_jump', (enabled) => { + send('player.setDoubleJump', { enabled: !!enabled }); + }); // Камера-облёт — паритет с JS game.camera.cutscene(points, opts). // pointsFlat/lookAtFlat: x1,y1,z1,x2,y2,z2,... — потому что массив // объектов в wasmoon через C-boundary неудобен.