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
+5
-19
@@ -29,13 +29,8 @@ export interface ModelWrite {
|
||||
}
|
||||
|
||||
/**
|
||||
* The running game: entities instantiated from one scene plus the systems ticking them.
|
||||
*
|
||||
* The world mirrors the scene of the project it was built from: while playing that is a copy of
|
||||
* the model, thrown away on stop; the editor run builds on the saved one, where the writes stay.
|
||||
* `syncFromModel()` pulls editor changes (moved, placed, removed or re-parented objects, edited
|
||||
* properties) into the entities; `syncToModel()` pushes what the systems changed (positions,
|
||||
* variables, destroyed entities) back, so the panels show live values.
|
||||
* The running game: entities of one scene plus the systems ticking them. Built on the play copy
|
||||
* (discarded on stop) or, for the editor run, on the saved model, where its writes stay.
|
||||
*/
|
||||
export class World {
|
||||
readonly entities: Entity[] = [];
|
||||
@@ -82,12 +77,7 @@ export class World {
|
||||
return this.elapsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the entities match the scene: one entity per placed object (created on demand,
|
||||
* dropped when the object is gone), positions, names and resolved properties taken from
|
||||
* the model, parent links re-established. Property bags are updated in place so systems
|
||||
* holding a reference keep seeing the current values.
|
||||
*/
|
||||
/** Makes the entities match the scene; props are updated in place so systems holding a bag stay current. */
|
||||
syncFromModel(): void {
|
||||
const scene = findScene(this.project, this.sceneId);
|
||||
if (!scene) return;
|
||||
@@ -145,11 +135,8 @@ export class World {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of an asset while running (Spawn node): the object is added to
|
||||
* the scene of the runtime copy – so the panels list it and a full sync keeps it – and its
|
||||
* entity is created right away, without touching the other entities (they may have moved
|
||||
* during this tick already). Position is local to `parent`, world when there is none.
|
||||
* Returns null for unknown or unplaceable assets.
|
||||
* Adds the object to the scene and creates only its entity, leaving the others alone (they may have
|
||||
* moved this tick already). Position is local to `parent`, world when there is none.
|
||||
*/
|
||||
spawn(
|
||||
assetId: string,
|
||||
@@ -279,7 +266,6 @@ export class World {
|
||||
return this.entities.filter((e) => e.parent === entity);
|
||||
}
|
||||
|
||||
/** Everything parented below an entity, at any depth. */
|
||||
descendantsOf(entity: Entity): Entity[] {
|
||||
return descendantsBelow(
|
||||
entity,
|
||||
|
||||
Reference in new issue
Block a user