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
Showing only changes of commit eb04da6348 - Show all commits

View File

@ -1963,22 +1963,117 @@ end)`,
// ═══════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════
// ИГРА 23 — «3 переключателя» // ИГРА 23 — «3 переключателя»
// ═══════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════
'switches': { 'switches': (function() {
g23_main: `-- === ИГРА «3 ПЕРЕКЛЮЧАТЕЛЯ» (Lua) === const overrides = {
g23_main: `-- === ИГРА «ПЕРЕКЛЮЧАТЕЛИ» — главный скрипт (Lua) ===
${SNIPPET_BROADCAST} ${SNIPPET_BROADCAST}
local activated = {false, false, false} local TweenService = game:GetService("TweenService")
print("Активируй все 3 переключателя!") local ORDER = { 2, 3, 1 } -- правильный порядок рычагов
local pressed = {}
local opened = false
local won = false
local ev = getEvent("SwitchToggled") __rbxl_show_text("Дёрни рычаги в нужном порядке (E)", 4)
ev.Event:Connect(function(idx)
activated[idx] = true local clickSound = Instance.new("Sound", workspace)
print("Переключатель " .. idx .. " активирован") clickSound.SoundId = "click"; clickSound.Volume = 0.7
if activated[1] and activated[2] and activated[3] then local loseSound = Instance.new("Sound", workspace)
print("ПОБЕДА! Все 3 активированы!") loseSound.SoundId = "lose"; loseSound.Volume = 0.7
local winSound = Instance.new("Sound", workspace)
winSound.SoundId = "win"; winSound.Volume = 1
-- Рычаги шлют ev:Fire(num) с номером
local leverEvent = getEvent("LeverPulled")
leverEvent.Event:Connect(function(num)
if opened then return end
clickSound:Play()
table.insert(pressed, num)
local i = #pressed
if pressed[i] ~= ORDER[i] then
pressed = {}
__rbxl_show_text("Неверно! Рычаги сброшены.", 1.5)
loseSound:Play()
return
end end
if #pressed == #ORDER then
opened = true
__rbxl_show_text("Верно! Дверь открыта.", 3)
winSound:Play()
local door = workspace:FindFirstChild("Дверь")
if door then
local dp = door.Position
local goal = { Position = Vector3.new(dp.X, dp.Y + 6, dp.Z) }
TweenService:Create(door, TweenInfo.new(1.2), goal):Play()
door.CanCollide = false
end
else
__rbxl_show_text("Так держать!", 1)
end
end)
-- Финиш
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)`, end)`,
}, g23_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)`,
};
// 3 рычага — каждый ждёт E когда игрок рядом, шлёт свой номер
for (let n = 1; n <= 3; n++) {
overrides['g23_lever_' + n] = `-- === Скрипт рычага ${n} (Lua) ===
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local part = script.Parent
local hintVisible = false
RunService.Heartbeat:Connect(function()
local px = __rbxl_player_x()
local pz = __rbxl_player_z()
local dx = part.Position.X - px
local dz = part.Position.Z - pz
local dist = math.sqrt(dx*dx + dz*dz)
local near = dist <= 3
if near ~= hintVisible then
hintVisible = near
if near then
__rbxl_hud_set("g23_lever_${n}_hint", "[E] Дёрнуть рычаг ${n}", 50, 75, "#ffe44a", 20)
else
__rbxl_hud_set("g23_lever_${n}_hint", nil)
end
end
end)
UserInputService.InputBegan:Connect(function(input, gp)
if gp then return end
if not hintVisible then return end
if input.KeyCode ~= Enum.KeyCode.E then return end
local ev = ReplicatedStorage:FindFirstChild("LeverPulled")
if ev then ev:Fire(${n}) end
end)`;
}
return overrides;
})(),
// ═══════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════
// ИГРА 24 — «Падающий мост» // ИГРА 24 — «Падающий мост»