diff --git a/src/editor/engine/GameRuntime.js b/src/editor/engine/GameRuntime.js index 7138dec..400a1b9 100644 --- a/src/editor/engine/GameRuntime.js +++ b/src/editor/engine/GameRuntime.js @@ -326,10 +326,6 @@ export class GameRuntime { } } catch (_) {} } else { - if (cmd === 'npc.spawn' || cmd === 'npc.damage' || cmd === 'scene.setLabel' || cmd === 'scene.clearLabel') { - // eslint-disable-next-line no-console - console.warn('[Lua onCommand]', cmd, JSON.stringify(payload).slice(0, 200)); - } this._handleCommand(null, cmd, payload); } }); @@ -1497,7 +1493,8 @@ export class GameRuntime { const nid = this._resolveNpcId(ref); if (nid != null) { fn(nid); return; } // ещё не резолвится — откладываем (только для локальных ref NPC) - if (typeof ref === 'string' && ref.indexOf('npc:_local_') === 0) { + if (typeof ref === 'string' + && (ref.indexOf('npc:_local_') === 0 || ref.startsWith('npc_lua_'))) { if (!this._pendingNpcCmds) this._pendingNpcCmds = new Map(); if (!this._pendingNpcCmds.has(ref)) this._pendingNpcCmds.set(ref, []); this._pendingNpcCmds.get(ref).push(fn); @@ -2156,8 +2153,8 @@ export class GameRuntime { // Также сообщаем Lua-sandbox-ам маппинг, чтобы // npc.onDeath по локальному ref находил npcId. for (const sb of this.sandboxes) { - if (sb.api?._localToRealNpc) { - try { sb.api.setNpcLocalRef?.(payload.ref, 'npc:' + npcId); } catch (_) {} + if (sb.api?.setNpcLocalRef) { + try { sb.api.setNpcLocalRef(payload.ref, 'npc:' + npcId); } catch (_) {} } } }