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 1be06343ec - Show all commits

View File

@ -3615,16 +3615,28 @@ export class GameRuntime {
const ref = payload?.ref; const ref = payload?.ref;
const text = payload?.text; const text = payload?.text;
if (typeof ref !== 'string') return; if (typeof ref !== 'string') return;
// ленивое создание менеджера меток
if (!this.scene3d._labelManager) { if (!this.scene3d._labelManager) {
this.scene3d._labelManager = new LabelManager(this.scene3d.scene); this.scene3d._labelManager = new LabelManager(this.scene3d.scene);
} }
const lm = this.scene3d._labelManager; const lm = this.scene3d._labelManager;
// резолвим меш объекта (примитив или модель) const applyLabel = () => {
const tgt = this._resolveTweenTarget(ref);
const mesh = tgt && (tgt.data.mesh || tgt.data.rootMesh || tgt.data.rootNode);
if (mesh) {
lm.setLabel(ref, mesh, text, payload?.opts || {});
}
};
// Если NPC ещё не зарезолвлен — откладываем через _npcCmd
// (или просто несколько попыток с retry).
const tgt = this._resolveTweenTarget(ref); const tgt = this._resolveTweenTarget(ref);
const mesh = tgt && (tgt.data.mesh || tgt.data.rootMesh || tgt.data.rootNode); if (tgt) {
if (mesh) { applyLabel();
lm.setLabel(ref, mesh, text, payload?.opts || {}); } else if (typeof ref === 'string' && ref.startsWith('npc_lua_')) {
// NPC ещё спавнится — откладываем
this._npcCmd(ref, () => applyLabel());
} else {
// Retry через 0.3с (для primitive после sceneCreate)
setTimeout(applyLabel, 300);
} }
} catch (e) { } catch (e) {
console.warn('[GameRuntime] scene.setLabel failed', e); console.warn('[GameRuntime] scene.setLabel failed', e);