feat(rbxl): XML-������ ������ .rbxl + Day/Night + Tool/Mouse/Backpack flow #38
@ -213,26 +213,22 @@ export class GameRuntime {
|
|||||||
}
|
}
|
||||||
} else if (cmd === 'lightingTimeUpdate') {
|
} else if (cmd === 'lightingTimeUpdate') {
|
||||||
// Roblox Lighting:SetMinutesAfterMidnight → Babylon небо.
|
// Roblox Lighting:SetMinutesAfterMidnight → Babylon небо.
|
||||||
const now = performance.now();
|
// Ускоряем в 8x чтобы юзер увидел переход день↔ночь
|
||||||
if (!this._lastLightUpdate || now - this._lastLightUpdate > 250) {
|
// в течение ~5 секунд после Play.
|
||||||
this._lastLightUpdate = now;
|
|
||||||
try {
|
try {
|
||||||
const hour = Number(payload?.hour);
|
const baseHour = Number(payload?.hour);
|
||||||
// Debug-лог (первые несколько раз)
|
if (baseHour >= 0 && baseHour < 24) {
|
||||||
if (!this._lightDbgCount) this._lightDbgCount = 0;
|
if (this._lightBaseHour == null) {
|
||||||
if (this._lightDbgCount < 5) {
|
this._lightBaseHour = baseHour;
|
||||||
this._lightDbgCount++;
|
this._lightStartReal = performance.now();
|
||||||
console.log('[lightingTimeUpdate]', { payload, hour,
|
|
||||||
hasSetTimeOfDay: typeof this.scene3d?.setTimeOfDay,
|
|
||||||
hasEnvironment: !!this.scene3d?.environment });
|
|
||||||
}
|
}
|
||||||
if (hour >= 0 && hour < 24) {
|
// Δigh-час относительно стартовой
|
||||||
|
const dGame = baseHour - this._lightBaseHour;
|
||||||
|
const accel = 8;
|
||||||
|
const hour = ((this._lightBaseHour + dGame * accel) % 24 + 24) % 24;
|
||||||
this.scene3d?.setTimeOfDay?.(hour);
|
this.scene3d?.setTimeOfDay?.(hour);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (_) {}
|
||||||
console.error('[lightingTimeUpdate] error:', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (cmd === 'particleCreated') {
|
} else if (cmd === 'particleCreated') {
|
||||||
// Roblox Instance.new('Sparkles') — запомнили какие
|
// Roblox Instance.new('Sparkles') — запомнили какие
|
||||||
// partlcle-эффекты есть у Tool. При equip покажем у руки.
|
// partlcle-эффекты есть у Tool. При equip покажем у руки.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user