feat: 50 игр на Lua + импорт Roblox для всех + поддержка Lua в плеере #39

Merged
min merged 215 commits from feat/lua-50-games-bundle into main 2026-06-09 21:59:25 +00:00
2 changed files with 51 additions and 28 deletions
Showing only changes of commit 17417b1b33 - Show all commits

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
end
end)
UserInputService.InputBegan:Connect(function(input, gp) -- Респаун при падении в пропасть
if gp then return end RunService.Heartbeat:Connect(function()
if input.KeyCode == Enum.KeyCode.Space and jumpsLeft > 0 then if won then return end
jumpsLeft = jumpsLeft - 1 local py = __rbxl_player_y()
if jumpsLeft == 1 then if py < -3 then
local hrp = char:FindFirstChild("HumanoidRootPart") player:LoadCharacter()
if hrp then loseSound:Play()
hrp.Velocity = Vector3.new(hrp.Velocity.X, 50, hrp.Velocity.Z) end
end end)
end
end
end)
end
Players.PlayerAdded:Connect(setupDoubleJump) -- Финиш сообщает о победе
for _, p in ipairs(Players:GetPlayers()) do setupDoubleJump(p) end local winEvent = getEvent("WinReached")
print("Жми Space дважды — двойной прыжок!")`, 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); 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 неудобен.