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 56c35273ef - Show all commits

View File

@ -326,10 +326,6 @@ export class GameRuntime {
} }
} catch (_) {} } catch (_) {}
} else { } 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); this._handleCommand(null, cmd, payload);
} }
}); });
@ -1497,7 +1493,8 @@ export class GameRuntime {
const nid = this._resolveNpcId(ref); const nid = this._resolveNpcId(ref);
if (nid != null) { fn(nid); return; } if (nid != null) { fn(nid); return; }
// ещё не резолвится — откладываем (только для локальных ref NPC) // ещё не резолвится — откладываем (только для локальных 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) this._pendingNpcCmds = new Map();
if (!this._pendingNpcCmds.has(ref)) this._pendingNpcCmds.set(ref, []); if (!this._pendingNpcCmds.has(ref)) this._pendingNpcCmds.set(ref, []);
this._pendingNpcCmds.get(ref).push(fn); this._pendingNpcCmds.get(ref).push(fn);
@ -2156,8 +2153,8 @@ export class GameRuntime {
// Также сообщаем Lua-sandbox-ам маппинг, чтобы // Также сообщаем Lua-sandbox-ам маппинг, чтобы
// npc.onDeath по локальному ref находил npcId. // npc.onDeath по локальному ref находил npcId.
for (const sb of this.sandboxes) { for (const sb of this.sandboxes) {
if (sb.api?._localToRealNpc) { if (sb.api?.setNpcLocalRef) {
try { sb.api.setNpcLocalRef?.(payload.ref, 'npc:' + npcId); } catch (_) {} try { sb.api.setNpcLocalRef(payload.ref, 'npc:' + npcId); } catch (_) {}
} }
} }
} }