feat: 50 игр на Lua + импорт Roblox для всех + поддержка Lua в плеере #39
@ -2161,24 +2161,48 @@ end)`;
|
||||
// ИГРА 25 — «Облёт камеры»
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
'flyby-camera': {
|
||||
g25_main: `-- === ИГРА «ОБЛЁТ КАМЕРЫ» (Lua) ===
|
||||
local TweenService = game:GetService("TweenService")
|
||||
local camera = workspace.CurrentCamera
|
||||
camera.CameraType = Enum.CameraType.Scriptable
|
||||
g25_main: `-- === ИГРА «КАМЕРА-ОБЛЁТ» — главный скрипт (Lua) ===
|
||||
${SNIPPET_BROADCAST}
|
||||
|
||||
local points = {
|
||||
CFrame.new(Vector3.new(0, 20, -30), Vector3.new(0, 5, 0)),
|
||||
CFrame.new(Vector3.new(20, 15, 0), Vector3.new(0, 5, 0)),
|
||||
CFrame.new(Vector3.new(0, 25, 30), Vector3.new(0, 5, 0)),
|
||||
}
|
||||
local won = false
|
||||
|
||||
for _, cf in ipairs(points) do
|
||||
local tween = TweenService:Create(camera, TweenInfo.new(2), { CFrame = cf })
|
||||
tween:Play(); tween.Completed:Wait()
|
||||
end
|
||||
-- При старте — облёт уровня камерой по точкам
|
||||
-- (точки x,y,z через запятую; segDuration — длительность одного отрезка)
|
||||
__rbxl_camera_cutscene("0,18,-10, 12,12,8, -12,12,18, 0,10,28", 1.8)
|
||||
|
||||
camera.CameraType = Enum.CameraType.Custom
|
||||
print("Облёт окончен — теперь играй!")`,
|
||||
local winSound = Instance.new("Sound", workspace)
|
||||
winSound.SoundId = "win"; winSound.Volume = 1
|
||||
|
||||
-- Когда облёт закончился — отдаём камеру игроку и пишем подсказку
|
||||
__rbxl_on_cutscene_done(function()
|
||||
__rbxl_show_text("Вперёд, к зелёному финишу!", 3)
|
||||
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)`,
|
||||
g25_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)`,
|
||||
},
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
|
||||
@ -1965,6 +1965,24 @@ export function registerRobloxShim(lua, opts) {
|
||||
global.set('__rbxl_heal_player', (amount) => {
|
||||
send('player.heal', { amount: Number(amount) || 0 });
|
||||
});
|
||||
// Камера-облёт — паритет с JS game.camera.cutscene(points, opts).
|
||||
// pointsFlat: x1,y1,z1,x2,y2,z2,... — потому что массив объектов
|
||||
// в wasmoon через C-boundary неудобен.
|
||||
global.set('__rbxl_camera_cutscene', (pointsFlat, segDuration) => {
|
||||
const arr = String(pointsFlat || '').split(',').map((s) => Number(s) || 0);
|
||||
const points = [];
|
||||
for (let i = 0; i + 2 < arr.length; i += 3) {
|
||||
points.push({ x: arr[i], y: arr[i + 1], z: arr[i + 2] });
|
||||
}
|
||||
send('camera.cutscene', {
|
||||
points,
|
||||
segDuration: Number(segDuration) || 1.5,
|
||||
});
|
||||
});
|
||||
const _cutsceneDoneCbs = [];
|
||||
global.set('__rbxl_on_cutscene_done', (fn) => {
|
||||
if (typeof fn === 'function') _cutsceneDoneCbs.push(fn);
|
||||
});
|
||||
// Подброс игрока — паритет с JS game.player.boostJump(strength).
|
||||
// 1.0 = обычный прыжок, 3.0 = втрое выше, и т.д.
|
||||
global.set('__rbxl_boost_jump', (strength) => {
|
||||
@ -2279,6 +2297,12 @@ export function registerRobloxShim(lua, opts) {
|
||||
if (part && humanoid.Touched) humanoid.Touched.Fire(part);
|
||||
}
|
||||
}
|
||||
// Cutscene камеры закончилась — фейерим зарегистрированные cb.
|
||||
if (p.type === 'cutsceneDone') {
|
||||
for (const fn of _cutsceneDoneCbs) {
|
||||
_pendingHandlerQueue.push({ fn, args: [] });
|
||||
}
|
||||
}
|
||||
// NPC погиб — фейерим registered cb для конкретного локального ref.
|
||||
if (p.type === 'npcDeath' && p.npcId != null) {
|
||||
const realRef = 'npc:' + p.npcId;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user