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 c5b713fd1f - Show all commits

View File

@ -121,8 +121,16 @@ export class GameRuntime {
// скрипты (с маркером // @roblox-lua) теперь идут через ОДИН LuaSharedSandbox. // скрипты (с маркером // @roblox-lua) теперь идут через ОДИН LuaSharedSandbox.
// .rbxl-скрипты распаковываем из JS-комментария-обёртки в чистый Lua. // .rbxl-скрипты распаковываем из JS-комментария-обёртки в чистый Lua.
const luaUserBatch = []; const luaUserBatch = [];
// По умолчанию импортированные .rbxl-скрипты НЕ выполняются:
// - типичная Roblox-карта = 500-2000 скриптов, многие используют
// DataStore/Tool/PlayerGui/UserInputService, которых у нас нет;
// - даже с stub'ами сотни падений → tab подвисает;
// Юзер может включить через window.__RBXL_RUN_IMPORTED = true в консоли.
const runImportedRbxl = typeof window !== 'undefined' && window.__RBXL_RUN_IMPORTED === true;
let rbxlSkipped = 0;
for (const s of scripts) { for (const s of scripts) {
if (s && typeof s.code === 'string' && s.code.startsWith('// @roblox-lua')) { if (s && typeof s.code === 'string' && s.code.startsWith('// @roblox-lua')) {
if (!runImportedRbxl) { rbxlSkipped++; continue; }
const luaSource = unpackRobloxLuaCode(s.code); const luaSource = unpackRobloxLuaCode(s.code);
if (luaSource && luaSource.trim()) { if (luaSource && luaSource.trim()) {
luaUserBatch.push({ luaUserBatch.push({
@ -212,6 +220,9 @@ export class GameRuntime {
if (rbxlImported > 0) { if (rbxlImported > 0) {
this._log('info', `Запущено Roblox-Lua скриптов (импортированных): ${rbxlImported}`); this._log('info', `Запущено Roblox-Lua скриптов (импортированных): ${rbxlImported}`);
} }
if (rbxlSkipped > 0) {
this._log('info', `Импортированных .rbxl-скриптов пропущено: ${rbxlSkipped}. Включить: window.__RBXL_RUN_IMPORTED = true`);
}
if (luaWritten > 0) { if (luaWritten > 0) {
this._log('info', `Запущено Lua-скриптов юзера: ${luaWritten}`); this._log('info', `Запущено Lua-скриптов юзера: ${luaWritten}`);
} }