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 89baf23877 - Show all commits

View File

@ -917,31 +917,127 @@ end)`;
// ═══════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════
// ИГРА 12 — «Кодовая дверь» // ИГРА 12 — «Кодовая дверь»
// ═══════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════
'code-door': { 'code-door': (function() {
g12_main: `-- === ИГРА «КОДОВАЯ ДВЕРЬ» — главный скрипт (Lua) === const overrides = {
g12_main: `-- === ИГРА «ДВЕРЬ ПО КОДУ» — главный скрипт (Lua) ===
${SNIPPET_BROADCAST} ${SNIPPET_BROADCAST}
local correctCode = "1234" local TweenService = game:GetService("TweenService")
local currentInput = "" local CODE = { 3, 1, 4, 2 }
local entered = {}
local opened = false
local won = false
print("Введи код 1234 (касайся кнопок по порядку)") __rbxl_show_text("Нажми кнопки в правильном порядке (E)", 4)
local ev = getEvent("CodeButton") local clickSound = Instance.new("Sound", workspace)
ev.Event:Connect(function(digit) clickSound.SoundId = "click"; clickSound.Volume = 0.7
currentInput = currentInput .. tostring(digit) local loseSound = Instance.new("Sound", workspace)
print("Ввод: " .. currentInput) loseSound.SoundId = "lose"; loseSound.Volume = 0.8
if #currentInput == 4 then local winSound = Instance.new("Sound", workspace)
if currentInput == correctCode then winSound.SoundId = "win"; winSound.Volume = 1
print("Верно! Дверь открывается")
local doorEv = getEvent("DoorOpen") local pressEvent = getEvent("ButtonPress")
doorEv:Fire() pressEvent.Event:Connect(function(num)
if opened then return end
clickSound:Play()
table.insert(entered, num)
local i = #entered
if entered[i] ~= CODE[i] then
-- ошибка сброс
entered = {}
__rbxl_show_text("Неверно! Код сброшен.", 1.5)
loseSound:Play()
return
end
if #entered == #CODE 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 else
print("Неверный код, попробуй ещё") __rbxl_show_text("Верно! Дальше...", 1)
end
currentInput = ""
end 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)`,
}, g12_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)`,
};
// 4 кнопки — каждая шлёт свой номер при нажатии E (если игрок рядом)
for (let num = 1; num <= 4; num++) {
overrides['g12_btn_' + num] = `-- === Скрипт кнопки-цифры ${num} (Lua) ===
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local part = script.Parent
local hintVisible = false
-- Подсказка над кнопкой (виден когда игрок рядом)
local hintGui = Instance.new("BillboardGui", part)
hintGui.Size = UDim2.new(4, 0, 1, 0)
hintGui.StudsOffset = Vector3.new(0, 1.5, 0)
hintGui.AlwaysOnTop = true
local label = Instance.new("TextLabel", hintGui)
label.Size = UDim2.new(1, 0, 1, 0)
label.BackgroundTransparency = 1
label.TextColor3 = Color3.fromRGB(255, 255, 255)
label.TextStrokeTransparency = 0
label.TextScaled = true
label.Text = "[E] Нажать ${num}"
label.Visible = 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
label.Visible = near
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("ButtonPress")
if ev then ev:Fire(${num}) end
end)`;
}
return overrides;
})(),
// ═══════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════
// ИГРА 13 — «Торговец» // ИГРА 13 — «Торговец»