feat(rbxl): XML-������ ������ .rbxl + Day/Night + Tool/Mouse/Backpack flow #38

Closed
min wants to merge 39 commits from feat/rbxl-xml-parser-import into main
Showing only changes of commit 742bca59ee - Show all commits

View File

@ -213,8 +213,7 @@ export class GameRuntime {
}
} else if (cmd === 'lightingTimeUpdate') {
// Roblox Lighting:SetMinutesAfterMidnight → Babylon небо.
// Ускоряем в 8x чтобы юзер увидел переход день↔ночь
// в течение ~5 секунд после Play.
// Ускоряем в 8x + меняем пресет skybox (clear/sunset/night).
try {
const baseHour = Number(payload?.hour);
if (baseHour >= 0 && baseHour < 24) {
@ -222,11 +221,25 @@ export class GameRuntime {
this._lightBaseHour = baseHour;
this._lightStartReal = performance.now();
}
// Δigh-час относительно стартовой
const dGame = baseHour - this._lightBaseHour;
const accel = 8;
const hour = ((this._lightBaseHour + dGame * accel) % 24 + 24) % 24;
this.scene3d?.setTimeOfDay?.(hour);
// Skybox preset по фазе:
// 06-08 sunset, 08-17 clear, 17-19 sunset, 19-06 starry-night
let targetPreset;
if (hour >= 6 && hour < 8) targetPreset = 'sunset';
else if (hour >= 8 && hour < 17) targetPreset = 'lowpoly-roblox';
else if (hour >= 17 && hour < 19) targetPreset = 'sunset';
else targetPreset = 'starry-night';
if (this._lightPreset !== targetPreset) {
this._lightPreset = targetPreset;
try {
const sb = this.scene3d?.skybox;
if (sb?.fadeTo) sb.fadeTo({ preset: targetPreset }, 2);
else this.scene3d?.setSkybox?.({ preset: targetPreset });
} catch (_) {}
}
}
} catch (_) {}
} else if (cmd === 'particleCreated') {