@vworlds/vecs 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/entity.js CHANGED
@@ -16,6 +16,20 @@ import { Bitset } from "./util/bitset.js";
16
16
  *
17
17
  * Entities support a parent–child hierarchy. When a parent is destroyed its
18
18
  * children are destroyed recursively. The `children` set is created lazily.
19
+ *
20
+ * ## Deferred semantics
21
+ *
22
+ * Inside a system body or `forEach` iteration the world is in **deferred
23
+ * mode**: `add` / `set` / `remove` / `destroy` only enqueue commands; the
24
+ * data layer (`components` map, `componentBitmask`) is not mutated until the
25
+ * world processes the queue. Concretely, inside deferred mode:
26
+ *
27
+ * - `entity.get(C)` returns `undefined` after `entity.add(C)` (no instance yet).
28
+ * - `entity.get(C)` returns the previous value after `entity.set(C, props)`.
29
+ * - `entity.get(C)` still returns the component after `entity.remove(C)`.
30
+ *
31
+ * Outside deferred mode (top-level user code) the same calls execute inline —
32
+ * mutations are visible immediately.
19
33
  */
20
34
  export class Entity {
21
35
  constructor(
@@ -26,7 +40,6 @@ export class Entity {
26
40
  this.world = world;
27
41
  this.eid = eid;
28
42
  this.components = new ArrayMap(); //maps component types to Components
29
- this.deletedComponents = new ArrayMap(); //maps deleted component types to Components
30
43
  /**
31
44
  * Bitmask representing the set of component types currently attached to this
32
45
  * entity. Used by the world to efficiently match entities against query
@@ -34,35 +47,56 @@ export class Entity {
34
47
  */
35
48
  this.componentBitmask = new Bitset();
36
49
  this.queries = new Set();
37
- this.newQueries = [];
38
50
  /**
39
51
  * A free-form property bag that modules can use to associate arbitrary data
40
52
  * with an entity without registering a component.
41
53
  */
42
54
  this.properties = new Map();
43
- this._archetypeChanged = false;
44
- this.destroyed = false;
55
+ /** @internal True once the world has fully processed this entity's destruction. */
56
+ this._destroyed = false;
57
+ }
58
+ /** Parent entity in the scene hierarchy, or `undefined` if this is a root entity. */
59
+ get parent() {
60
+ return this._parent;
61
+ }
62
+ /** Read-only view of direct child entities. */
63
+ get children() {
64
+ return this._children ?? Entity._emptyChildren;
45
65
  }
46
66
  /**
47
- * The set of direct child entities in the scene hierarchy.
48
- *
49
- * The set is created lazily on first access. Mutate it only through
50
- * {@link Entity.destroy} or by setting {@link Entity.parent} on a child —
51
- * both will keep the parent–child links consistent.
67
+ * Immediately reparent this entity. Maintains the bidirectional link,
68
+ * removes it from the old parent's children, and adds it to the new
69
+ * parent's children. Throws if the operation would create a cycle.
52
70
  */
53
- get children() {
54
- if (!this._children) {
55
- this._children = new Set();
71
+ _setParent(newParent) {
72
+ if (newParent !== undefined) {
73
+ let ancestor = newParent;
74
+ while (ancestor !== undefined) {
75
+ if (ancestor === this) {
76
+ throw new Error(`Circular parent reference: entity ${this.eid} is already an ancestor of entity ${newParent.eid}`);
77
+ }
78
+ ancestor = ancestor._parent;
79
+ }
80
+ }
81
+ if (this._parent) {
82
+ this._parent._children?.delete(this);
83
+ }
84
+ this._parent = newParent;
85
+ if (newParent) {
86
+ (newParent._children ?? (newParent._children = new Set())).add(this);
56
87
  }
57
- return this._children;
58
88
  }
59
- getComponentInstance(meta) {
60
- const c = new meta.Class(this, meta);
61
- const hook = meta._onAddHandler;
62
- if (hook) {
63
- hook(c);
89
+ /**
90
+ * Reparent this entity. In deferred mode the change is queued; outside
91
+ * deferred mode it executes immediately.
92
+ */
93
+ setParent(newParent) {
94
+ if (this.world.deferred) {
95
+ this.world._enqueue({ kind: 5 /* CommandKind.SetParent */, entity: this, parent: newParent });
96
+ }
97
+ else {
98
+ this._setParent(newParent);
64
99
  }
65
- return c;
66
100
  }
67
101
  /**
68
102
  * Queue an `onSet` / `update` notification for the given component and
@@ -75,74 +109,60 @@ export class Entity {
75
109
  * @returns This entity, for chaining.
76
110
  */
77
111
  modified(c) {
78
- this.world._queueUpdatedComponent(c);
112
+ if (c._dirty) {
113
+ return this;
114
+ }
115
+ c._dirty = true;
116
+ if (this.world.deferred) {
117
+ this.world._enqueue({ kind: 2 /* CommandKind.Modified */, entity: this, type: c.type });
118
+ }
119
+ else {
120
+ this._modified(c.type);
121
+ }
79
122
  return this;
80
123
  }
81
- _add(typeOrClass, markAsModified = true) {
124
+ add(typeOrClass) {
82
125
  const type = this.world.getComponentType(typeOrClass);
83
- let c = this.components.get(type);
84
- if (c) {
85
- return c;
86
- }
87
- const meta = this.world.getComponentMeta(typeOrClass);
88
- if (meta.exclusive) {
89
- for (const exclusiveType of meta.exclusive) {
90
- if (this.components.has(exclusiveType)) {
91
- this.remove(exclusiveType);
92
- }
93
- }
126
+ if (this.world.deferred) {
127
+ this.world._enqueue({ kind: 1 /* CommandKind.Set */, entity: this, type, props: undefined });
94
128
  }
95
- c = this.getComponentInstance(meta);
96
- this.components.set(type, c);
97
- this.componentBitmask.add(type);
98
- this.world._notifyComponentAdded(this, c);
99
- if (markAsModified) {
100
- this.modified(c);
129
+ else {
130
+ this._set(type, undefined);
101
131
  }
102
- return c;
103
- }
104
- add(typeOrClass, markAsModified = true) {
105
- this._add(typeOrClass, markAsModified);
106
132
  return this;
107
133
  }
108
134
  set(typeOrClass, props) {
109
- const c = this._add(typeOrClass, false);
110
- this.modified(c);
111
- Object.assign(c, props);
135
+ const type = this.world.getComponentType(typeOrClass);
136
+ if (this.world.deferred) {
137
+ this.world._enqueue({ kind: 1 /* CommandKind.Set */, entity: this, type, props });
138
+ }
139
+ else {
140
+ this._set(type, props);
141
+ }
112
142
  return this;
113
143
  }
114
144
  remove(typeOrClass) {
115
145
  const type = this.world.getComponentType(typeOrClass);
116
- const c = this.components.get(type);
117
- if (c) {
118
- this.components.delete(type);
119
- this.deletedComponents.set(type, c);
120
- this.componentBitmask.delete(type);
121
- this.world._notifyComponentRemoved(this, c);
146
+ if (this.world.deferred) {
147
+ this.world._enqueue({ kind: 3 /* CommandKind.Remove */, entity: this, type });
148
+ }
149
+ else {
150
+ this._remove(type);
122
151
  }
123
152
  }
124
- /** @internal Called by queries to deliver update notifications. */
125
- _notifyModified(component) {
126
- this.queries.forEach((q) => {
127
- q.notifyModified(component);
128
- });
153
+ /** @internal Look up a component instance by type id. */
154
+ _get(type) {
155
+ return this.components.get(type);
129
156
  }
130
157
  /**
131
158
  * Retrieve the component of type `Class`, or `undefined` if not present.
132
159
  *
133
160
  * @param typeOrClass - Component class or numeric type id.
134
- * @param get_deleted - If `true`, also search components that were removed
135
- * in the current frame but not yet garbage-collected. Useful inside
136
- * `exit` callbacks to read final component values.
137
161
  * @returns The component instance or `undefined`.
138
162
  */
139
- get(typeOrClass, get_deleted = false) {
163
+ get(typeOrClass) {
140
164
  const type = this.world.getComponentType(typeOrClass);
141
- const c = this.components.get(type);
142
- if (!c && get_deleted) {
143
- return this.deletedComponents.get(type);
144
- }
145
- return c;
165
+ return this._get(type);
146
166
  }
147
167
  /**
148
168
  * Typed event emitter for entity-level lifecycle events.
@@ -158,79 +178,146 @@ export class Entity {
158
178
  }
159
179
  return this._events;
160
180
  }
161
- /** @internal */
162
- _hasQuery(q) {
181
+ isInQuery(q) {
163
182
  return this.queries.has(q);
164
183
  }
165
184
  /** @internal Removes a query from this entity's tracking sets without firing any callbacks. */
166
185
  _purgeQuery(q) {
167
186
  this.queries.delete(q);
168
- const idx = this.newQueries.indexOf(q);
169
- if (idx !== -1) {
170
- this.newQueries.splice(idx, 1);
171
- }
172
187
  }
173
- /** @internal */
174
- _addQuery(q) {
175
- if (!this.queries.has(q)) {
176
- this.newQueries.push(q);
177
- q._enter(this);
178
- }
188
+ /** @internal Add a query to the entity's tracked-query set. Called by Query._enter. */
189
+ _addQueryMembership(q) {
190
+ this.queries.add(q);
179
191
  }
180
- /** @internal */
181
- _removeQuery(q) {
182
- if (this.queries.delete(q)) {
183
- q._exit(this);
184
- }
192
+ /** @internal Remove a query from the entity's tracked-query set. Called by Query._exit. */
193
+ _removeQueryMembership(q) {
194
+ this.queries.delete(q);
185
195
  }
186
- /** @internal */
187
196
  _updateQueries() {
188
- this.newQueries.forEach((q) => {
189
- this.queries.add(q);
197
+ this.world.queries.forEach((q) => {
198
+ const belongs = q.belongs(this);
199
+ const isIn = this.isInQuery(q);
200
+ if (belongs !== isIn) {
201
+ belongs ? q._enter(this) : q._exit(this);
202
+ }
190
203
  });
191
- this.newQueries.length = 0;
192
204
  }
193
- /** `true` when the entity has no components attached. */
194
- get empty() {
195
- return this.components.size == 0;
205
+ _new(type, props) {
206
+ const meta = this.world.getComponentMeta(type);
207
+ if (meta.exclusive) {
208
+ for (const exclusiveType of meta.exclusive) {
209
+ if (this.components.has(exclusiveType)) {
210
+ this._remove(exclusiveType);
211
+ }
212
+ }
213
+ }
214
+ const c = new meta.Class(this, meta);
215
+ if (props !== undefined) {
216
+ Object.assign(c, props);
217
+ }
218
+ this.components.set(type, c);
219
+ this.componentBitmask.add(type);
220
+ meta._onAddHandler?.(c);
221
+ this._updateQueries();
222
+ return c;
223
+ }
224
+ /** @internal Execute a Set command — create if absent, apply props, fire hooks, route events. */
225
+ _set(type, props) {
226
+ if (this._destroyed) {
227
+ return;
228
+ }
229
+ const existing = this.components.get(type);
230
+ const c = existing ?? this._new(type, props);
231
+ if (props !== undefined) {
232
+ if (existing) {
233
+ Object.assign(c, props);
234
+ }
235
+ c.meta._onSetHandler?.(c);
236
+ c._dirty = false;
237
+ if (existing) {
238
+ this.queries.forEach((q) => q.notifyModified(c));
239
+ }
240
+ }
196
241
  }
197
- /** @internal */
242
+ /** @internal Execute a Modified command — fire onSet and route update events. */
243
+ _modified(type) {
244
+ if (this._destroyed) {
245
+ return;
246
+ }
247
+ const c = this.components.get(type);
248
+ if (!c) {
249
+ return;
250
+ }
251
+ c.meta._onSetHandler?.(c);
252
+ c._dirty = false;
253
+ this.queries.forEach((q) => q.notifyModified(c));
254
+ }
255
+ /** @internal Execute a Remove command — clear bitmask, route exits, remove component, fire onRemove. */
256
+ _remove(type) {
257
+ if (this._destroyed) {
258
+ return;
259
+ }
260
+ const c = this.components.get(type);
261
+ if (!c) {
262
+ return;
263
+ }
264
+ this.componentBitmask.delete(type);
265
+ this._updateQueries();
266
+ this.components.delete(type);
267
+ c.meta._onRemoveHandler?.(c);
268
+ }
269
+ /** @internal Execute a Destroy command — exit queries, fire onRemove, emit event, unregister. */
198
270
  _destroy() {
199
- if (this.destroyed) {
271
+ if (this._destroyed) {
200
272
  return;
201
273
  }
202
- this.destroyed = true;
274
+ // 1. Fire exit on every query the entity belongs to.
275
+ const toExit = [];
203
276
  this.queries.forEach((q) => {
204
- q._exit(this);
277
+ if (q.world) {
278
+ toExit.push(q);
279
+ }
205
280
  });
206
- this.queries.clear();
281
+ toExit.forEach((q) => q._exit(this));
282
+ // 2. Fire onRemove on every still-attached component.
283
+ this.components.forEach((c) => c.meta._onRemoveHandler?.(c));
284
+ // 3. Emit the destroy event.
207
285
  if (this._events) {
208
286
  this._events.emit("destroy");
209
287
  this._events.removeAllListeners("destroy");
210
288
  }
289
+ // 4. Mark destroyed and unhook from world / parent.
290
+ this._destroyed = true;
291
+ this.world._unregisterEntity(this);
292
+ if (this._parent) {
293
+ this._parent._children?.delete(this);
294
+ this._parent = undefined;
295
+ }
296
+ }
297
+ /** `true` when the entity has no components attached. */
298
+ get empty() {
299
+ return this.components.size == 0;
211
300
  }
212
301
  /**
213
302
  * Destroy this entity and recursively destroy all of its children.
214
303
  *
215
- * All components are removed (triggering `onRemove` hooks and `exit`
216
- * callbacks), the entity is unregistered from the world, and the `"destroy"`
217
- * event is emitted. The entity must not be used after calling this method.
304
+ * All components have their `onRemove` hooks fired, the entity is
305
+ * unregistered from the world, and the `"destroy"` event is emitted. The
306
+ * entity must not be used after the destroy completes.
218
307
  */
219
308
  destroy() {
220
- this.world._notifyEntityDestroyed(this);
221
- this.children.forEach((child) => {
222
- child.destroy();
223
- });
224
- this.children.clear();
225
- if (this.parent) {
226
- this.parent.children.delete(this);
227
- this.world.archetypeChanged(this.parent);
228
- this.parent = undefined;
309
+ if (this.world.deferred) {
310
+ this.world._enqueue({ kind: 4 /* CommandKind.Destroy */, entity: this });
311
+ }
312
+ else {
313
+ this._destroy();
314
+ }
315
+ if (this._children) {
316
+ this._children.forEach((child) => {
317
+ child.destroy();
318
+ });
319
+ this._children.clear();
229
320
  }
230
- }
231
- /** @internal */
232
- clearDeletedComponents() {
233
- this.deletedComponents.clear();
234
321
  }
235
322
  /**
236
323
  * Iterate over every component currently attached to this entity.
@@ -246,4 +333,5 @@ export class Entity {
246
333
  return `Entity${this.eid}`;
247
334
  }
248
335
  }
336
+ Entity._emptyChildren = new Set();
249
337
  //# sourceMappingURL=entity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity.js","sourceRoot":"","sources":["../src/entity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAI1C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,MAAM;IA2BjB;IACE,+CAA+C;IAC/B,KAAY;IAC5B,0DAA0D;IAC1C,GAAW;QAFX,UAAK,GAAL,KAAK,CAAO;QAEZ,QAAG,GAAH,GAAG,CAAQ;QA9BrB,eAAU,GAAG,IAAI,QAAQ,EAAa,CAAC,CAAC,oCAAoC;QAC5E,sBAAiB,GAAG,IAAI,QAAQ,EAAa,CAAC,CAAC,4CAA4C;QAEnG;;;;WAIG;QACa,qBAAgB,GAAG,IAAI,MAAM,EAAE,CAAC;QAC/B,YAAO,GAAG,IAAI,GAAG,EAAS,CAAC;QAC3B,eAAU,GAAY,EAAE,CAAC;QAE1C;;;WAGG;QACI,eAAU,GAAG,IAAI,GAAG,EAAe,CAAC;QAOpC,sBAAiB,GAAY,KAAK,CAAC;QAClC,cAAS,GAAG,KAAK,CAAC;IAOvB,CAAC;IAEJ;;;;;;OAMG;IACH,IAAW,QAAQ;QACjB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAU,CA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U,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;SAC1B;IACH,CAAC;IAED,yDAAyD;IACzD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;OAMG;IACI,OAAO;QACZ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACvB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,6BAAqB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;SAClE;aAAM;YACL,IAAI,CAAC,QAAQ,EAAE,CAAC;SACjB;QACD,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC/B,KAAK,CAAC,OAAO,EAAE,CAAC;YAClB,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;SACxB;IACH,CAAC;IAED;;;;;OAKG;IACI,gBAAgB,CAAC,QAAgC;QACtD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED,oDAAoD;IAC7C,QAAQ;QACb,OAAO,SAAS,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,CAAC;;AA3WuB,qBAAc,GAAwB,IAAI,GAAG,EAAE,CAAC"}
package/dist/filter.js CHANGED
@@ -33,23 +33,25 @@ export class Filter {
33
33
  this.belongs = buildEntityTest(world, dsl);
34
34
  }
35
35
  forEach(componentsOrCallback, callback) {
36
- if (typeof componentsOrCallback === "function") {
37
- this.world._forEachEntity((e) => {
38
- if (this.belongs(e)) {
39
- componentsOrCallback(e);
40
- }
41
- });
42
- }
43
- else {
44
- const types = componentsOrCallback.map((C) => this.world.getComponentType(C));
45
- this.world._forEachEntity((e) => {
46
- if (!this.belongs(e)) {
47
- return;
48
- }
49
- const resolved = types.map((t) => e.get(t));
50
- callback(e, resolved);
51
- });
52
- }
36
+ this.world.defer(() => {
37
+ if (typeof componentsOrCallback === "function") {
38
+ this.world.entities.forEach((e) => {
39
+ if (this.belongs(e)) {
40
+ componentsOrCallback(e);
41
+ }
42
+ });
43
+ }
44
+ else {
45
+ const types = componentsOrCallback.map((C) => this.world.getComponentType(C));
46
+ this.world.entities.forEach((e) => {
47
+ if (!this.belongs(e)) {
48
+ return;
49
+ }
50
+ const resolved = types.map((t) => e.get(t));
51
+ callback(e, resolved);
52
+ });
53
+ }
54
+ });
53
55
  }
54
56
  }
55
57
  //# sourceMappingURL=filter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter.js","sourceRoot":"","sources":["../src/filter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAA0D,MAAM,UAAU,CAAC;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,MAAM;IAGjB,YACmB,KAAY,EAC7B,GAAa;QADI,UAAK,GAAL,KAAK,CAAO;QAG7B,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC;IA2BM,OAAO,CACZ,oBAA6D,EAC7D,QAAoF;QAEpF,IAAI,OAAO,oBAAoB,KAAK,UAAU,EAAE;YAC9C,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC9B,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;oBACnB,oBAAoB,CAAC,CAAC,CAAC,CAAC;iBACzB;YACH,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,MAAM,KAAK,GAAG,oBAA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,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC9E,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;oBAChC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;wBACpB,OAAO;qBACR;oBACD,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC5C,QAAS,CAAC,CAAC,EAAE,QAAe,CAAC,CAAC;gBAChC,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vworlds/vecs",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",