diff --git a/src/editor/engine/GameRuntime.js b/src/editor/engine/GameRuntime.js index 8320eee..c189888 100644 --- a/src/editor/engine/GameRuntime.js +++ b/src/editor/engine/GameRuntime.js @@ -142,6 +142,20 @@ export class GameRuntime { rbxlSkipped++; continue; } const luaSource = unpackRobloxLuaCode(s.code); + // SAFETY: пропускаем скрипты с tight-loop'ами через ChildAdded:wait() + // или WaitForChild через пользовательский while-not-FindFirstChild. + // Они подвешивают страницу (wait() возвращает синхронно, скрипт + // никогда не yield'ит из C-call). Распространённый Roblox 2009 + // паттерн который мы не можем безопасно эмулировать. + if (luaSource && ( + /while\s+not\s+\w+[:.]FindFirstChild/.test(luaSource) || + /ChildAdded:[Ww]ait\(\)/.test(luaSource) || + /:[Gg]etChildren\(\)\s*\[\d/.test(luaSource) + )) { + rbxlSkipped++; + console.warn(`[GameRuntime] skipped ${s.name}: содержит небезопасный tight-loop (WaitForChild/ChildAdded:wait)`); + continue; + } if (luaSource && luaSource.trim()) { // Эвристика Tool: если скрипт ссылается на Equipped/Activated // или Tool = script.Parent — он лежит в Tool. Все Tool-скрипты