Consolidate duplicated editor code, trim comments, refresh README
Split GraphCanvas (1076 -> 831 lines) into EdgeLayer and graphMenus; the port and marker menus were the same list and are now one function. Value specs of the inspector and the list tab share valueSpecs.ts, and the remaining copies (compound commands, type glyphs, typed asset lookup, name rule, play/editor world setup, marquee) are merged. Four copies had already drifted apart; merging them fixes: - "Disconnect N links" in the port menu is one undo step, not N - "+ Add collider" is hidden on a placed container instance, as in the hierarchy menu, instead of always failing - a bool property coerced from the text "false" becomes false - a port command on an unknown node type reports instead of crashing Comment-only edits leave the bundle byte-identical. README corrected in 35 places (step limit, jump-run clock, suite duration, 409 body, ...). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9212e61c4c
commit
8f92a06c84
96 files changed
+999
-1261
No files matched your search
+4
-14
@@ -1,13 +1,6 @@
|
||||
/**
|
||||
* Keeps the behaviors switched to "run in editor" running while the project is *not* playing.
|
||||
*
|
||||
* The one thing that makes this different from Play: the world is built from the saved model, not
|
||||
* from a copy. What such a behavior moves or writes is a real edit – it is saved and it is not on
|
||||
* the undo stack.
|
||||
*/
|
||||
/** Runs "run in editor" behaviors outside play mode, on a world built from the saved model, not a copy. */
|
||||
import { hasEditorRun, runsInEditor } from '../core/properties/editorRun';
|
||||
import { BehaviorSystem } from '../runtime/systems/BehaviorSystem';
|
||||
import { CollisionSystem } from '../runtime/systems/CollisionSystem';
|
||||
import { addGameSystems, type BehaviorSystem, behaviorError } from '../runtime/systems/BehaviorSystem';
|
||||
import { Input } from '../runtime/systems/Input';
|
||||
import { type ModelWrite, World } from '../runtime/World';
|
||||
import type { EditorState } from './state';
|
||||
@@ -96,10 +89,7 @@ export class EditorRun {
|
||||
// Baking a container's content into the scene would be an edit nobody asked for, so it is off
|
||||
// here: the content runs, but resolved from its template (see `WorldOptions.bakeContainers`).
|
||||
const fresh = World.instantiate(project, scene.id, { bakeContainers: false });
|
||||
const collisions = new CollisionSystem();
|
||||
this.behaviors = new BehaviorSystem(project, this.input, collisions, (e) => runsInEditor(e.props));
|
||||
fresh.addSystem(collisions);
|
||||
fresh.addSystem(this.behaviors);
|
||||
this.behaviors = addGameSystems(fresh, project, this.input, (e) => runsInEditor(e.props));
|
||||
this.world = fresh;
|
||||
this.hadFocus = this.hooks.focused();
|
||||
this.input.attach(this.hooks.focused);
|
||||
@@ -116,7 +106,7 @@ export class EditorRun {
|
||||
return true;
|
||||
}
|
||||
if (!world.stopRequested) return false;
|
||||
const error = world.log.find((line) => line.startsWith('Error in behavior'));
|
||||
const error = behaviorError(world);
|
||||
this.stop();
|
||||
this.state.setNotice(error ?? 'A behavior running in the editor stopped it.');
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user