object move blocks

debug floaters
This commit is contained in:
azykov@mail.ru
2026-06-12 21:11:35 +03:00
parent 20a4edad5a
commit 209ff3f710
31 changed files with 527 additions and 53 deletions
+10 -3
View File
@@ -4,6 +4,8 @@ import { clone } from "../utils";
import { populateRuntimeScene } from "../utils/runtime";
import { ScriptGameEventBus } from "../scripts/eventBus";
import * as ScriptActions from "../scripts/actions";
import { positionOfObject } from "../scripts/positionOfObject";
import { debugLabelsStore } from "../state/debugLabelsStore";
import type { ScriptCoroutines } from "../scripts/coroutines";
// // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -51,6 +53,7 @@ export class GameFactory {
const eventBus = new ScriptGameEventBus(coroutines);
const scriptHelpers = {
positionOfObject,
// convert all ScriptActions imported to a structure factory(coroutine):
// {
// WaitSeconds: (seconds) => new WaitSecondsScriptAction(coroutine, seconds),
@@ -71,7 +74,7 @@ export class GameFactory {
.filter((ot) => ot.javascript)
.forEach((ot) => {
try {
const javascript = `(function gameScript(eventBus, helpers, thisObject, thisObjectType) {${ot.javascript}})`;
const javascript = `(function gameScript(eventBus, helpers, thisObject, thisObjectType) {${ot.javascript}})\n//# sourceURL=GameScript:${ot.name}.js`;
const gameScript = eval(javascript);
Object.values(scene.objects)
@@ -86,16 +89,20 @@ export class GameFactory {
const localScriptHelpers = {
...scriptHelpers,
actions: scriptHelpers.actions({ thisObject: o, thisObjectType: ot }),
debug: {
show: (key: string, text: string) => debugLabelsStore.setOne(o.id, key, text),
clear: (key: string) => debugLabelsStore.deleteOne(o.id, key),
},
};
gameScript(eventBus, localScriptHelpers, o, ot);
}
catch (err) {
console.log('Error running object instance script:\n' + err);
console.error(`[GameScript:${ot.name}] Error running script for object ${o.id}:`, err);
}
});
}
catch (err) {
console.log('Error evaluating object type script:\n' + err);
console.error(`[GameScript:${ot.name}] Error evaluating script:`, err);
}
});