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
2 changed files with 14 additions and 0 deletions
Showing only changes of commit ba2f3bb57f - Show all commits

View File

@ -1606,6 +1606,17 @@ export class GameRuntime {
routeEvent(target, eventType, extra = {}) { routeEvent(target, eventType, extra = {}) {
if (!target || !eventType) return; if (!target || !eventType) return;
for (const sb of this.sandboxes) { for (const sb of this.sandboxes) {
// LuaSharedSandbox = один sandbox на все Lua-скрипты, target=null.
// Шлём ему ВСЕ события — shim сам найдёт соответствующий Part
// через partById и сфейерит Touched на нужной части.
if (sb.constructor?.name === 'LuaSharedSandbox' || sb._luaShared) {
const kind = eventType === 'touch' ? 'touched'
: eventType === 'untouch' ? 'untouched'
: eventType;
const primId = target.id ?? target.ref ?? null;
sb.sendEvent({ kind, primId, target, ...extra });
continue;
}
if (!sb.target) continue; if (!sb.target) continue;
if (!this._targetMatches(sb.target, target)) continue; if (!this._targetMatches(sb.target, target)) continue;
sb.sendEvent({ type: eventType, ...extra }); sb.sendEvent({ type: eventType, ...extra });

View File

@ -36,6 +36,9 @@ export class LuaSharedSandbox {
this._guiTree = null; this._guiTree = null;
this._loopHandle = null; this._loopHandle = null;
this._lastTickAt = 0; this._lastTickAt = 0;
// Маркер для GameRuntime.routeEvent — этот sandbox принимает все
// события и сам маршрутизирует через shim.fireTargetEvent.
this._luaShared = true;
} }
setOnCommand(cb) { this._onCommand = cb; } setOnCommand(cb) { this._onCommand = cb; }