feat(g27): полный паритет «Двойной прыжок»

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'.
This commit is contained in:
min 2026-06-09 21:50:08 +03:00
parent 19c475f132
commit 17417b1b33
2 changed files with 51 additions and 28 deletions

View File

@ -2290,39 +2290,58 @@ end)`;
// ИГРА 27 — «Двойной прыжок» // ИГРА 27 — «Двойной прыжок»
// ═══════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════
'double-jump': { 'double-jump': {
g27_main: `-- === ИГРА «ДВОЙНОЙ ПРЫЖОК» (Lua) === g27_main: `-- === ИГРА «ДВОЙНОЙ ПРЫЖОК» — главный скрипт (Lua) ===
${SNIPPET_BROADCAST}
local Players = game:GetService("Players") 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 __rbxl_set_double_jump(true)
local char = player.Character or player.CharacterAdded:Wait() __rbxl_show_text("Жми Space ДВАЖДЫ — двойной прыжок!", 4)
local h = char:WaitForChild("Humanoid")
-- Восстанавливаем прыжки при касании земли local loseSound = Instance.new("Sound", workspace)
h.StateChanged:Connect(function(_, newState) loseSound.SoundId = "lose"; loseSound.Volume = 0.7
if newState == Enum.HumanoidStateType.Landed then local winSound = Instance.new("Sound", workspace)
jumpsLeft = 2 winSound.SoundId = "win"; winSound.Volume = 1
-- Респаун при падении в пропасть
RunService.Heartbeat:Connect(function()
if won then return end
local py = __rbxl_player_y()
if py < -3 then
player:LoadCharacter()
loseSound:Play()
end end
end) end)
UserInputService.InputBegan:Connect(function(input, gp) -- Финиш сообщает о победе
if gp then return end local winEvent = getEvent("WinReached")
if input.KeyCode == Enum.KeyCode.Space and jumpsLeft > 0 then winEvent.Event:Connect(function()
jumpsLeft = jumpsLeft - 1 if won then return end
if jumpsLeft == 1 then won = true
local hrp = char:FindFirstChild("HumanoidRootPart") __rbxl_show_text("Победа! Двойной прыжок освоен!", 5)
if hrp then winSound:Play()
hrp.Velocity = Vector3.new(hrp.Velocity.X, 50, hrp.Velocity.Z) local px = __rbxl_player_x()
end local py = __rbxl_player_y()
end local pz = __rbxl_player_z()
end __rbxl_spawn_particles("confetti", px, py + 3, pz, 3, 3)
end) end)`,
end g27_finish: `-- === Скрипт финиш-зоны (Lua) ===
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local part = script.Parent
local fired = false
Players.PlayerAdded:Connect(setupDoubleJump) part.Touched:Connect(function(hit)
for _, p in ipairs(Players:GetPlayers()) do setupDoubleJump(p) end if fired then return end
print("Жми Space дважды — двойной прыжок!")`, 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)`,
}, },
// ═══════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════

View File

@ -1970,6 +1970,10 @@ export function registerRobloxShim(lua, opts) {
const text = value == null ? null : ('Очки: ' + value); const text = value == null ? null : ('Очки: ' + value);
send('ui.set', { id: '__score', text }); 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). // Камера-облёт — паритет с JS game.camera.cutscene(points, opts).
// pointsFlat/lookAtFlat: x1,y1,z1,x2,y2,z2,... — потому что массив // pointsFlat/lookAtFlat: x1,y1,z1,x2,y2,z2,... — потому что массив
// объектов в wasmoon через C-boundary неудобен. // объектов в wasmoon через C-boundary неудобен.