feat(g25): полный паритет «Камера-облёт»
JS:
- camera.cutscene 4 точки + segDuration=1.8
- onCutsceneDone → showText 'Вперёд, к зелёному финишу!'
- onMessage 'win' → 'Победа!' + win + confetti
- finish: onTouch → broadcast 'win'
Lua (паритет):
- __rbxl_camera_cutscene('x1,y1,z1, x2,y2,z2, ...', segDuration)
Парсит CSV → отдаёт в GameRuntime cmd 'camera.cutscene'.
- __rbxl_on_cutscene_done(fn) — регистрация cb.
В fireGlobalEvent при p.type='cutsceneDone' фейерим все cb.
- BindableEvent WinReached
- g25_finish: Touched → WinReached:Fire (fired-флаг)
CSV вместо массива объектов — wasmoon через C-boundary
плохо отдаёт массивы таблиц.
This commit is contained in:
parent
2a39fc2b99
commit
d4b84cf73d
@ -2161,24 +2161,48 @@ end)`;
|
|||||||
// ИГРА 25 — «Облёт камеры»
|
// ИГРА 25 — «Облёт камеры»
|
||||||
// ═══════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════
|
||||||
'flyby-camera': {
|
'flyby-camera': {
|
||||||
g25_main: `-- === ИГРА «ОБЛЁТ КАМЕРЫ» (Lua) ===
|
g25_main: `-- === ИГРА «КАМЕРА-ОБЛЁТ» — главный скрипт (Lua) ===
|
||||||
local TweenService = game:GetService("TweenService")
|
${SNIPPET_BROADCAST}
|
||||||
local camera = workspace.CurrentCamera
|
|
||||||
camera.CameraType = Enum.CameraType.Scriptable
|
|
||||||
|
|
||||||
local points = {
|
local won = false
|
||||||
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)),
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, cf in ipairs(points) do
|
-- При старте — облёт уровня камерой по точкам
|
||||||
local tween = TweenService:Create(camera, TweenInfo.new(2), { CFrame = cf })
|
-- (точки x,y,z через запятую; segDuration — длительность одного отрезка)
|
||||||
tween:Play(); tween.Completed:Wait()
|
__rbxl_camera_cutscene("0,18,-10, 12,12,8, -12,12,18, 0,10,28", 1.8)
|
||||||
end
|
|
||||||
|
|
||||||
camera.CameraType = Enum.CameraType.Custom
|
local winSound = Instance.new("Sound", workspace)
|
||||||
print("Облёт окончен — теперь играй!")`,
|
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) => {
|
global.set('__rbxl_heal_player', (amount) => {
|
||||||
send('player.heal', { amount: Number(amount) || 0 });
|
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).
|
// Подброс игрока — паритет с JS game.player.boostJump(strength).
|
||||||
// 1.0 = обычный прыжок, 3.0 = втрое выше, и т.д.
|
// 1.0 = обычный прыжок, 3.0 = втрое выше, и т.д.
|
||||||
global.set('__rbxl_boost_jump', (strength) => {
|
global.set('__rbxl_boost_jump', (strength) => {
|
||||||
@ -2279,6 +2297,12 @@ export function registerRobloxShim(lua, opts) {
|
|||||||
if (part && humanoid.Touched) humanoid.Touched.Fire(part);
|
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.
|
// NPC погиб — фейерим registered cb для конкретного локального ref.
|
||||||
if (p.type === 'npcDeath' && p.npcId != null) {
|
if (p.type === 'npcDeath' && p.npcId != null) {
|
||||||
const realRef = 'npc:' + p.npcId;
|
const realRef = 'npc:' + p.npcId;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user