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 — «Двойной прыжок»
// ═══════════════════════════════════════════════════════════════
'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)
-- Респаун при падении в пропасть
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)
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)`,
},
// ═══════════════════════════════════════════════════════════════

View File

@ -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 неудобен.