@typeonce/ritmo 0.6.0 → 0.8.0

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.
Files changed (148) hide show
  1. package/README.md +2 -0
  2. package/dist/Brand.d.ts +9 -4
  3. package/dist/Brand.d.ts.map +1 -1
  4. package/dist/Brand.js +9 -4
  5. package/dist/Brand.js.map +1 -1
  6. package/dist/Clock.d.ts +186 -0
  7. package/dist/Clock.d.ts.map +1 -0
  8. package/dist/Clock.js +111 -0
  9. package/dist/Clock.js.map +1 -0
  10. package/dist/Command.d.ts +250 -41
  11. package/dist/Command.d.ts.map +1 -1
  12. package/dist/Command.js +59 -23
  13. package/dist/Command.js.map +1 -1
  14. package/dist/Condition.d.ts +12 -1
  15. package/dist/Condition.d.ts.map +1 -1
  16. package/dist/Condition.js.map +1 -1
  17. package/dist/Debug.d.ts +163 -15
  18. package/dist/Debug.d.ts.map +1 -1
  19. package/dist/Debug.js.map +1 -1
  20. package/dist/Decode.d.ts +1 -1
  21. package/dist/Decode.js +1 -1
  22. package/dist/Descriptor.d.ts +67 -24
  23. package/dist/Descriptor.d.ts.map +1 -1
  24. package/dist/Descriptor.js +32 -15
  25. package/dist/Descriptor.js.map +1 -1
  26. package/dist/Entity.d.ts +22 -5
  27. package/dist/Entity.d.ts.map +1 -1
  28. package/dist/Entity.js +2 -2
  29. package/dist/Entity.js.map +1 -1
  30. package/dist/EntityScope.d.ts +26 -1
  31. package/dist/EntityScope.d.ts.map +1 -1
  32. package/dist/EntityScope.js +14 -2
  33. package/dist/EntityScope.js.map +1 -1
  34. package/dist/HostClock.d.ts +49 -0
  35. package/dist/HostClock.d.ts.map +1 -0
  36. package/dist/HostClock.js +46 -0
  37. package/dist/HostClock.js.map +1 -0
  38. package/dist/Inspector.d.ts +7 -1
  39. package/dist/Inspector.d.ts.map +1 -1
  40. package/dist/Inspector.js.map +1 -1
  41. package/dist/Machine.d.ts +67 -36
  42. package/dist/Machine.d.ts.map +1 -1
  43. package/dist/Machine.js +10 -3
  44. package/dist/Machine.js.map +1 -1
  45. package/dist/Query.d.ts +74 -26
  46. package/dist/Query.d.ts.map +1 -1
  47. package/dist/Query.js +32 -28
  48. package/dist/Query.js.map +1 -1
  49. package/dist/Runtime.d.ts +39 -16
  50. package/dist/Runtime.d.ts.map +1 -1
  51. package/dist/Runtime.js +556 -87
  52. package/dist/Runtime.js.map +1 -1
  53. package/dist/Schedule.d.ts +217 -10
  54. package/dist/Schedule.d.ts.map +1 -1
  55. package/dist/Schedule.js +5 -0
  56. package/dist/Schedule.js.map +1 -1
  57. package/dist/Schema.d.ts +196 -44
  58. package/dist/Schema.d.ts.map +1 -1
  59. package/dist/Schema.js +29 -11
  60. package/dist/Schema.js.map +1 -1
  61. package/dist/Snapshot.d.ts +14 -0
  62. package/dist/Snapshot.d.ts.map +1 -1
  63. package/dist/Snapshot.js.map +1 -1
  64. package/dist/System.d.ts +212 -58
  65. package/dist/System.d.ts.map +1 -1
  66. package/dist/System.js +84 -6
  67. package/dist/System.js.map +1 -1
  68. package/dist/index.d.ts +8 -7
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +8 -7
  71. package/dist/index.js.map +1 -1
  72. package/dist/internal/cells.d.ts +3 -3
  73. package/dist/internal/cells.d.ts.map +1 -1
  74. package/dist/internal/cells.js +9 -11
  75. package/dist/internal/cells.js.map +1 -1
  76. package/dist/internal/debug.d.ts +13 -0
  77. package/dist/internal/debug.d.ts.map +1 -1
  78. package/dist/internal/debug.js +192 -7
  79. package/dist/internal/debug.js.map +1 -1
  80. package/dist/internal/equal.d.ts +8 -0
  81. package/dist/internal/equal.d.ts.map +1 -0
  82. package/dist/internal/equal.js +38 -0
  83. package/dist/internal/equal.js.map +1 -0
  84. package/dist/internal/fragments.d.ts.map +1 -1
  85. package/dist/internal/fragments.js +11 -1
  86. package/dist/internal/fragments.js.map +1 -1
  87. package/dist/internal/game.d.ts.map +1 -1
  88. package/dist/internal/game.js +41 -6
  89. package/dist/internal/game.js.map +1 -1
  90. package/dist/internal/order.d.ts +10 -0
  91. package/dist/internal/order.d.ts.map +1 -0
  92. package/dist/internal/order.js +122 -0
  93. package/dist/internal/order.js.map +1 -0
  94. package/dist/internal/queries.d.ts.map +1 -1
  95. package/dist/internal/queries.js +32 -10
  96. package/dist/internal/queries.js.map +1 -1
  97. package/dist/internal/requirements.d.ts +26 -0
  98. package/dist/internal/requirements.d.ts.map +1 -0
  99. package/dist/internal/requirements.js +46 -0
  100. package/dist/internal/requirements.js.map +1 -0
  101. package/package.json +1 -1
  102. package/src/Brand.ts +9 -4
  103. package/src/Clock.ts +311 -0
  104. package/src/Command.ts +407 -89
  105. package/src/Condition.ts +17 -1
  106. package/src/Debug.ts +172 -14
  107. package/src/Decode.ts +1 -1
  108. package/src/Descriptor.ts +92 -37
  109. package/src/Entity.ts +24 -5
  110. package/src/EntityScope.ts +27 -2
  111. package/src/HostClock.ts +64 -0
  112. package/src/Inspector.ts +7 -2
  113. package/src/Machine.ts +81 -37
  114. package/src/Query.ts +110 -38
  115. package/src/Runtime.ts +607 -111
  116. package/src/Schedule.ts +380 -13
  117. package/src/Schema.ts +249 -63
  118. package/src/Snapshot.ts +4 -0
  119. package/src/System.ts +248 -93
  120. package/src/index.ts +8 -7
  121. package/src/internal/cells.ts +10 -12
  122. package/src/internal/debug.ts +208 -12
  123. package/src/internal/equal.ts +31 -0
  124. package/src/internal/fragments.ts +12 -2
  125. package/src/internal/game.ts +61 -7
  126. package/src/internal/order.ts +144 -0
  127. package/src/internal/queries.ts +37 -13
  128. package/src/internal/requirements.ts +71 -0
  129. package/dist/Definition.d.ts +0 -99
  130. package/dist/Definition.d.ts.map +0 -1
  131. package/dist/Definition.js +0 -68
  132. package/dist/Definition.js.map +0 -1
  133. package/dist/Feature.d.ts +0 -106
  134. package/dist/Feature.d.ts.map +0 -1
  135. package/dist/Feature.js +0 -87
  136. package/dist/Feature.js.map +0 -1
  137. package/dist/Fx.d.ts +0 -128
  138. package/dist/Fx.d.ts.map +0 -1
  139. package/dist/Fx.js +0 -112
  140. package/dist/Fx.js.map +0 -1
  141. package/dist/internal/definition.d.ts +0 -17
  142. package/dist/internal/definition.d.ts.map +0 -1
  143. package/dist/internal/definition.js +0 -25
  144. package/dist/internal/definition.js.map +0 -1
  145. package/src/Definition.ts +0 -106
  146. package/src/Feature.ts +0 -241
  147. package/src/Fx.ts +0 -176
  148. package/src/internal/definition.ts +0 -56
package/dist/Command.d.ts CHANGED
@@ -65,7 +65,7 @@ import * as Entity from "./Entity.ts";
65
65
  import type * as EntityScope from "./EntityScope.ts";
66
66
  import type * as Relation from "./Relation.ts";
67
67
  import * as Result from "./Result.ts";
68
- import type { Schema } from "./Schema.ts";
68
+ import type { RequirementPair, Schema } from "./Schema.ts";
69
69
  /**
70
70
  * Type-level helpers for staged entity construction.
71
71
  *
@@ -108,7 +108,7 @@ type EntryOf<D> = D extends Descriptor<"component", string, any> ? Entry<D> : ne
108
108
  export type SchemaEntry<S extends Schema.Any> = EntryOf<SchemaComponentDescriptor<S>>;
109
109
  /**
110
110
  * One entry accepted by `spawn(...)` and `insert(...)`: a plain descriptor/value
111
- * pair, or a `Result` of one (from `entryRaw(...)` or `entryResult(...)`).
111
+ * pair, or a `Result` of one (from `entryRaw(...)`).
112
112
  */
113
113
  export type SpawnEntry<S extends Schema.Any> = SchemaEntry<S> | Result.Result<SchemaEntry<S>, any>;
114
114
  type EntryValue<T> = [
@@ -117,10 +117,14 @@ type EntryValue<T> = [
117
117
  /**
118
118
  * Folds entries into the component proof of the resulting draft.
119
119
  */
120
- export type FoldEntries<Entries extends ReadonlyArray<SpawnEntry<any>>, P extends Entity.ComponentProof = {}> = Entries extends readonly [
120
+ export type FoldEntries<Entries extends ReadonlyArray<SpawnEntry<any>>, P extends Entity.ComponentProof = {}> = number extends Entries["length"] ? P & MaybeEntries<EntryValue<Entries[number]>> : Entries extends readonly [
121
121
  infer Head extends SpawnEntry<any>,
122
122
  ...infer Tail extends Array<SpawnEntry<any>>
123
123
  ] ? FoldEntries<Tail, Draft.InsertEntry<P, EntryValue<Head>>> : P;
124
+ /** The proof of entries that may each be present: every component they can hold, optional. */
125
+ type MaybeEntries<Entry> = {
126
+ readonly [E in Entry as E extends readonly [infer D extends Descriptor<"component", string, any>, unknown] ? Descriptor.Name<D> : never]?: E extends readonly [infer D extends Descriptor<"component", string, any>, unknown] ? Descriptor.Value<D> : never;
127
+ };
124
128
  /**
125
129
  * Per-entry failures, aligned with the entries: `null` for entries that
126
130
  * succeeded or could not fail.
@@ -160,9 +164,10 @@ export type DeferredCommand<S extends Schema.Any> = {
160
164
  export interface InternalWorld<S extends Schema.Any> {
161
165
  /**
162
166
  * Creates the entity for an id reserved by `commands.spawn(...)` with its
163
- * staged components.
167
+ * staged components. Returns `false`, creating nothing, when the
168
+ * components break a `Schema.requires` requirement.
164
169
  */
165
- readonly spawnEntity: (id: Entity.EntityId<S, any>, components: ReadonlyArray<Entity.StagedComponent>) => void;
170
+ readonly spawnEntity: (id: Entity.EntityId<S, any>, components: ReadonlyArray<Entity.StagedComponent>) => boolean;
166
171
  /**
167
172
  * Removes an entity and its outgoing and incoming relations.
168
173
  */
@@ -176,13 +181,15 @@ export interface InternalWorld<S extends Schema.Any> {
176
181
  */
177
182
  readonly destroyEntityScope: (scope: EntityScope.EntityScope.Any) => void;
178
183
  /**
179
- * Removes a component from a live entity.
184
+ * Removes components from a live entity, all or none: nothing is removed
185
+ * when that would leave a component without one it requires.
180
186
  */
181
- readonly removeComponent: (id: Entity.EntityId<S, any>, descriptor: Descriptor<"component", string, any>) => void;
187
+ readonly removeComponents: (id: Entity.EntityId<S, any>, descriptors: ReadonlyArray<Descriptor<"component", string, any>>) => void;
182
188
  /**
183
- * Inserts or replaces a component on a live entity.
189
+ * Inserts or replaces components on a live entity, all or none: nothing is
190
+ * written when an inserted component would miss one it requires.
184
191
  */
185
- readonly writeComponent: (id: Entity.EntityId<S, any>, descriptor: Descriptor<"component", string, any>, value: unknown) => void;
192
+ readonly insertComponents: (id: Entity.EntityId<S, any>, entries: ReadonlyArray<Entity.StagedComponent>) => void;
186
193
  /**
187
194
  * Attempts to attach one relation edge between two live entities.
188
195
  */
@@ -201,13 +208,15 @@ export interface InternalWorld<S extends Schema.Any> {
201
208
  */
202
209
  export declare const entry: <D extends Descriptor<"component", string, any>>(descriptor: D, value: Descriptor.Value<D>) => Entry<D>;
203
210
  /**
204
- * Lifts an already validated value into an entry result, keeping the failure
205
- * visible to `spawn(...)` / `insert(...)`.
206
- */
207
- export declare const entryResult: <D extends Descriptor<"component", string, any>, Error>(descriptor: D, result: Result.Result<Descriptor.Value<D>, Error>) => Result.Result<Entry<D>, Error>;
208
- /**
209
- * Validates raw input through a constructed descriptor and returns an entry
210
- * result.
211
+ * Validates raw input through a constructed descriptor's own validator and
212
+ * returns an entry result for `spawn(...)` / `insert(...)`.
213
+ *
214
+ * This is the one way to put unvalidated data on an entity: the descriptor
215
+ * owns its validator (`Descriptor.ConstructedComponent(...)`, built with
216
+ * `Decode` or `Descriptor.fromStandardSchema`). Values that are already
217
+ * valid use a plain `[Descriptor, value]` entry instead. To validate authored
218
+ * constants once at module load, call the constructor (`Vector2.result(...)`)
219
+ * and keep the carried value.
211
220
  *
212
221
  * @example
213
222
  * ```ts
@@ -221,11 +230,14 @@ export declare const entryResult: <D extends Descriptor<"component", string, any
221
230
  */
222
231
  export declare const entryRaw: <D extends DescriptorModule.ConstructedDescriptor<"component", string, any, any, any>>(descriptor: D, raw: Descriptor.Raw<D>) => Result.Result<Entry<D>, Descriptor.ConstructionError<D>>;
223
232
  /**
224
- * Adds entries to a draft. Plain entries return the new draft; if any entry is
225
- * a `Result`, the draft is returned as a `Result` whose error lists every
226
- * entry's failure (or `null`).
233
+ * Adds entries to a draft, a value not yet spawned. Plain entries return the
234
+ * new draft; if any entry is a `Result`, the draft is returned as a `Result`
235
+ * whose error lists every entry's failure (or `null`).
236
+ *
237
+ * Use this while building what a spawn will hold. Use `commands.insert` to
238
+ * add or replace components on an entity that already exists.
227
239
  */
228
- export declare const insert: <S extends Schema.Any, P extends Entity.ComponentProof, Root, const Entries extends ReadonlyArray<SpawnEntry<S>>>(draft: Entity.EntityDraft<S, P, Root>, ...entries: Entries) => DraftFor<S, Entries, P, Root>;
240
+ export declare const extend: <S extends Schema.Any, P extends Entity.ComponentProof, Root, const Entries extends ReadonlyArray<SpawnEntry<S>>>(draft: Entity.EntityDraft<S, P, Root>, ...entries: Entries) => DraftFor<S, Entries, P, Root>;
229
241
  /**
230
242
  * Starts a staged entity from component entries.
231
243
  *
@@ -250,58 +262,255 @@ export declare const spawn: <S extends Schema.Any, Root = unknown, const Entries
250
262
  * attach the relation when the spawn command is applied.
251
263
  */
252
264
  export declare const relate: <S extends Schema.Any, P extends Entity.ComponentProof, R extends Relation.Relation.Any, Root = unknown>(draft: Entity.EntityDraft<S, P, Root>, relation: R, target: Entity.EntityId<S, Root>) => Entity.EntityDraft<S, P, Root>;
265
+ /** One permission of `Game.System.commands(...)`: a kind of command, and what it may touch. */
266
+ export interface Permission<out Kind extends PermissionKind, out Value> {
267
+ readonly permission: Kind;
268
+ readonly values: ReadonlyArray<Value>;
269
+ }
270
+ export type PermissionKind = "spawns" | "inserts" | "removes" | "despawns" | "despawnsScope" | "relates";
271
+ type ComponentDescriptor = Descriptor<"component", string, any>;
272
+ /**
273
+ * Allows `spawn` / `spawnIn` of drafts whose components are all among `components`.
274
+ * Use it for entities the system creates; use `extend` on a draft to build one.
275
+ */
276
+ export declare const spawns: <const Components extends ReadonlyArray<ComponentDescriptor>>(...components: Components) => Permission<"spawns", Components[number]>;
277
+ /**
278
+ * Allows `insert(entity, [X, value])` with `X` among `components`: add or
279
+ * replace at the next `applyDeferred()`. To change a value now, on an entity
280
+ * you matched, write through a query (`Game.Query.write`) instead.
281
+ */
282
+ export declare const inserts: <const Components extends ReadonlyArray<ComponentDescriptor>>(...components: Components) => Permission<"inserts", Components[number]>;
283
+ /** Allows `remove(entity, X)` with `X` among `components`. */
284
+ export declare const removes: <const Components extends ReadonlyArray<ComponentDescriptor>>(...components: Components) => Permission<"removes", Components[number]>;
285
+ /**
286
+ * Allows `despawn(entity)` where `entity` comes from a query match proving one
287
+ * of `components` (`match.entity`), never a raw id: the system can only
288
+ * despawn what it has proven is, for example, an `Enemy`.
289
+ */
290
+ export declare const despawns: <const Components extends ReadonlyArray<ComponentDescriptor>>(...components: Components) => Permission<"despawns", Components[number]>;
291
+ /** Allows `despawnScope(scope)` for this scope. */
292
+ export declare const despawnsScope: <const Scope extends EntityScope.EntityScope.Any>(scope: Scope) => Permission<"despawnsScope", Scope>;
293
+ /** Allows `relate`, `unrelate`, and `reorderChildren` for these relations. */
294
+ export declare const relates: <const Relations extends ReadonlyArray<Relation.Relation.Any>>(...relations: Relations) => Permission<"relates", Relations[number]>;
295
+ type PermissionValue<Permissions, Kind extends PermissionKind> = Permissions extends Permission<Kind, infer Value> ? Value : never;
296
+ /**
297
+ * The commands a system may queue, declared in its spec as
298
+ * `commands: Game.System.commands(...)`. Without it, the system has no
299
+ * `commands`.
300
+ */
301
+ export interface CommandAccess<out Spawns = never, out Inserts = never, out Removes = never, out Despawns = never, out Scopes = never, out Relates = never> {
302
+ readonly kind: "commands";
303
+ readonly permissions: ReadonlyArray<Permission<PermissionKind, unknown>>;
304
+ readonly __permissions?: (_: never) => readonly [Spawns, Inserts, Removes, Despawns, Scopes, Relates];
305
+ }
306
+ export declare namespace CommandAccess {
307
+ type Any = CommandAccess<any, any, any, any, any, any>;
308
+ }
309
+ /** Declares the commands a system may queue; see the permission builders. */
310
+ export declare const commands: <const Permissions extends ReadonlyArray<Permission<PermissionKind, unknown>>>(...permissions: Permissions) => CommandAccess<PermissionValue<Permissions[number], "spawns">, PermissionValue<Permissions[number], "inserts">, PermissionValue<Permissions[number], "removes">, PermissionValue<Permissions[number], "despawns">, PermissionValue<Permissions[number], "despawnsScope">, PermissionValue<Permissions[number], "relates">>;
311
+ /** The `commands` of a system that declares none. */
312
+ export type NotDeclared = "commands are not declared for this system: add commands: Game.System.commands(...) to its spec, with the permissions it needs (spawns, inserts, removes, despawns, despawnsScope, relates)";
313
+ /** A method whose permission is not declared: any call fails with an argument error naming the fix. */
314
+ type MethodNotDeclared<Method extends string, Builder extends string> = (...fix: ReadonlyArray<`${Method} is not declared in this system's commands: add Game.System.${Builder}(...) to Game.System.commands(...)`>) => never;
315
+ type Fix<Message extends string> = {
316
+ readonly __fixCommands__: Message;
317
+ };
318
+ type Names<D> = D extends {
319
+ readonly name: infer Name extends string;
320
+ } ? Name : never;
321
+ /** Every key of every member of a union of proofs (a draft with a conditional entry is a union). */
322
+ type AllKeys<P> = P extends unknown ? keyof P & string : never;
323
+ type DraftAllowed<P, Spawns> = [
324
+ Exclude<AllKeys<P>, Names<Spawns>>
325
+ ] extends [never] ? unknown : Fix<`${Exclude<AllKeys<P>, Names<Spawns>>} is not declared in this system's commands: add it to Game.System.spawns(...)`>;
326
+ type EntriesAllowed<Entries extends ReadonlyArray<readonly [ComponentDescriptor, unknown]>, Inserts> = [
327
+ Exclude<Entries[number][0], Inserts>
328
+ ] extends [never] ? unknown : Fix<`${Names<Exclude<Entries[number][0], Inserts>>} is not declared in this system's commands: add it to Game.System.inserts(...)`>;
329
+ type RemoveAllowed<D, Removes> = [
330
+ D
331
+ ] extends [Removes] ? unknown : Fix<`${Names<D>} is not declared in this system's commands: add it to Game.System.removes(...)`>;
332
+ type DespawnAllowed<E, Despawns> = E extends {
333
+ readonly kind: "EntityRef" | "EntityMut";
334
+ readonly __proves?: (_: never) => infer Proves;
335
+ } ? [Extract<Proves, Despawns>] extends [never] ? Fix<`despawn needs an entity from a query proving ${Names<Despawns>} (declared in despawns)`> : unknown : E extends {
336
+ readonly [spawnedTypeId]: (_: never) => infer Spawned;
337
+ } ? [Extract<Spawned, Names<Despawns>>] extends [never] ? Fix<`despawn needs an entity spawned with ${Names<Despawns>} (declared in despawns)`> : unknown : Fix<`despawn needs an entity from a query proving ${Names<Despawns>} (declared in despawns), not a raw id: pass match.entity`>;
338
+ declare const spawnedTypeId: unique symbol;
253
339
  /**
254
- * Public command API exposed to systems.
340
+ * The id `spawn` / `spawnIn` return: an `EntityId` that also records the
341
+ * components its draft holds in every case, so the system that queued it can
342
+ * `despawn` it before the next `applyDeferred()` (no query can match it yet).
343
+ * Stored as a plain `EntityId`, it is a raw id again.
344
+ */
345
+ export type SpawnedId<S extends Schema.Any, Root, Components extends string> = Entity.EntityId<S, Root> & {
346
+ readonly [spawnedTypeId]: (_: never) => Components;
347
+ };
348
+ /** The requirements (`[requirer, required]`) of the components in `Held` that `Held` lacks. */
349
+ type MissingPairs<S extends Schema.Any, Held extends string> = Extract<Schema.Requires<S>, readonly [Held, string]> extends infer Pair ? Pair extends readonly [string, infer To extends string] ? To extends Held ? never : Pair : never : never;
350
+ /** One message per missing requirement: `"Player requires Velocity"`. */
351
+ type MissingMessages<Pairs> = Pairs extends readonly [infer From extends string, infer To extends string] ? `${From} requires ${To}` : never;
352
+ /**
353
+ * Accepts a draft holding every requirement of every component it holds.
354
+ * Direct requirements are enough: each required component must be held
355
+ * too, with its own requirements.
356
+ */
357
+ type DraftRequirementsMet<S extends Schema.Any, Held extends string> = [
358
+ MissingPairs<S, Held>
359
+ ] extends [never] ? unknown : Fix<`${MissingMessages<MissingPairs<S, Held>>}: add the missing entries to the draft`>;
360
+ /** What an insert or remove target is known to hold: a query match's proof, or a `SpawnedId`'s draft. A raw id proves nothing. */
361
+ type TargetHolds<E> = E extends {
362
+ readonly kind: "EntityRef" | "EntityMut";
363
+ readonly __proves?: (_: never) => infer Proves;
364
+ } ? Names<Proves> : E extends {
365
+ readonly [spawnedTypeId]: (_: never) => infer Spawned extends string;
366
+ } ? Spawned : never;
367
+ /** What a remove target is known to lack: its query's `without`. */
368
+ type TargetLacks<E> = E extends {
369
+ readonly kind: "EntityRef" | "EntityMut";
370
+ readonly __lacks?: (_: never) => infer Lacks;
371
+ } ? Names<Lacks> : never;
372
+ type EntryNames<Entries extends ReadonlyArray<readonly [ComponentDescriptor, unknown]>> = Names<Entries[number][0]>;
373
+ /** Inserted components with requirements neither inserted alongside nor proven held by the target. */
374
+ type InsertRequirementsMet<S extends Schema.Any, E, Entries extends ReadonlyArray<readonly [ComponentDescriptor, unknown]>> = [
375
+ MissingPairs<S, EntryNames<Entries> | TargetHolds<E>> & readonly [EntryNames<Entries>, string]
376
+ ] extends [never] ? unknown : Fix<`${MissingMessages<MissingPairs<S, EntryNames<Entries> | TargetHolds<E>> & readonly [EntryNames<Entries>, string]>}: insert it in the same call, or pass match.entity from a query that proves it`>;
377
+ /**
378
+ * Removing `Removed` is sound when every component that requires one of
379
+ * them is removed in the same call or proven absent by the target's query
380
+ * (`without`): otherwise the entity may keep a requirer without its
381
+ * requirement.
382
+ */
383
+ type RemoveViolations<S extends Schema.Any, E, Removed extends string> = Extract<Schema.Requires<S>, readonly [string, Removed]> extends infer Pair ? Pair extends readonly [infer From extends string, infer To extends string] ? From extends Removed | TargetLacks<E> ? never : `${To} is required by ${From}: remove ${From} in the same call, or match the entity with a query that has without: [${From}]` : never : never;
384
+ type RemoveRequirementsMet<S extends Schema.Any, E, Removed extends string> = [
385
+ RemoveViolations<S, E, Removed>
386
+ ] extends [never] ? unknown : Fix<RemoveViolations<S, E, Removed>>;
387
+ /** A remove target: `match.entity`, or the id `spawn` returned in this run; never a raw id. */
388
+ type RemoveTargetAllowed<S extends Schema.Any, Root, E> = E extends {
389
+ readonly kind: "EntityRef" | "EntityMut";
390
+ readonly id: Entity.EntityId<S, Root>;
391
+ } ? unknown : E extends SpawnedId<S, Root, string> ? unknown : Fix<"remove needs an entity from a query (pass match.entity) or the id spawn returned in this run, not a raw id">;
392
+ /** The transitive closure of the names `N` require (cycles stop). */
393
+ type RequiredClosure<Pairs extends RequirementPair, N extends string, Seen extends string = never> = [
394
+ Exclude<N, Seen>
395
+ ] extends [never] ? Seen : RequiredClosure<Pairs, Extract<Pairs, readonly [Exclude<N, Seen>, string]>[1], Seen | N>;
396
+ /**
397
+ * The component descriptors that `Names` require, transitively
398
+ * (`Schema.requires`): what `Game.System.spawns(...)` also allows.
399
+ */
400
+ export type RequiredDescriptors<S extends Schema.Any, Names extends string> = 0 extends 1 & Names ? never : string extends Names ? never : [Extract<Schema.Requires<S>, readonly [Names, string]>] extends [never] ? never : Extract<Schema.ComponentDescriptor<S>, {
401
+ readonly name: Exclude<RequiredClosure<Schema.Requires<S>, Names>, Names>;
402
+ }>;
403
+ type SchemaComponent<S extends Schema.Any> = Extract<Schema.Components<S>[keyof Schema.Components<S>], ComponentDescriptor>;
404
+ /** An entity a system has proven something about: `match.entity`, or the id `spawn` returned. */
405
+ type EntityTarget<S extends Schema.Any, Root> = {
406
+ readonly kind: "EntityRef" | "EntityMut";
407
+ readonly id: Entity.EntityId<S, Root>;
408
+ } | SpawnedId<S, Root, string>;
409
+ /** The keys every member of a union of proofs requires (what a draft holds in every case). */
410
+ type RequiredKeys<P> = P extends unknown ? {
411
+ [K in keyof P]-?: {} extends Pick<P, K> ? never : K;
412
+ }[keyof P] & string : never;
413
+ type MissingSomewhere<P, All> = P extends unknown ? Exclude<All, RequiredKeys<P>> : never;
414
+ type HeldNames<P> = Exclude<AllKeys<P>, MissingSomewhere<P, AllKeys<P>>>;
415
+ /**
416
+ * The command API a system gets for its declared permissions. Commands are
417
+ * the structural mutation entrypoint: spawns, inserts, removals, despawns,
418
+ * and relation edits. They are queued in order and applied only at the next
419
+ * `applyDeferred()` (or `applyStateTransitions(...)`) schedule step.
255
420
  *
256
- * Commands are the structural mutation entrypoint: spawns, inserts, removals,
257
- * despawns, and relation edits. They are queued in order and applied only at
258
- * the next `applyDeferred()` (or `applyStateTransitions(...)`) schedule step.
421
+ * Each method exists only with its permission, and only for what it names:
422
+ * `spawn` needs `Game.System.spawns(...)` listing every component of the
423
+ * draft, `insert` needs `inserts`, `remove` needs `removes`, `despawn` needs
424
+ * `despawns` and an entity from a query proving one of them, `despawnScope`
425
+ * needs `despawnsScope`, and relation edits need `relates`.
259
426
  *
260
427
  * Resource and event writes are not commands: they go through the
261
428
  * `writeResource(...)` / `writeEvent(...)` access a system declares.
262
429
  */
263
- export interface CommandsApi<S extends Schema.Any, Root = unknown> {
430
+ export interface CommandsApi<S extends Schema.Any, Root = unknown, Spawns = never, Inserts = never, Removes = never, Despawns = never, Scopes = never, Relates = never> {
264
431
  /**
265
432
  * Queues a staged entity for spawning and returns its stable runtime id.
433
+ *
434
+ * The draft must hold every component its components require
435
+ * (`Schema.requires`); drafts are checked here, so a partial draft built
436
+ * with `Game.Command.spawn(...)` and completed with `extend(...)` is fine.
266
437
  */
267
- readonly spawn: <P extends Entity.ComponentProof>(draft: Entity.EntityDraft<S, P, Root>) => Entity.EntityId<S, Root>;
438
+ readonly spawn: [Spawns] extends [never] ? MethodNotDeclared<"spawn", "spawns"> : <P extends Entity.ComponentProof>(draft: Entity.EntityDraft<S, P, Root> & DraftAllowed<P, Spawns> & DraftRequirementsMet<S, HeldNames<P>>) => SpawnedId<S, Root, HeldNames<P>>;
268
439
  /**
269
- * Queues an entity spawn owned by one lifetime scope.
270
- *
271
- * Scoped entities can later be removed together with `despawnScope(...)`.
440
+ * Queues an entity spawn owned by one lifetime scope (removed together
441
+ * with `despawnScope(...)`). The draft is checked like `spawn(...)`.
272
442
  */
273
- readonly spawnIn: <P extends Entity.ComponentProof>(scope: EntityScope.EntityScope<string, Root>, draft: Entity.EntityDraft<S, P, Root>) => Entity.EntityId<S, Root>;
443
+ readonly spawnIn: [Spawns] extends [never] ? MethodNotDeclared<"spawnIn", "spawns"> : <P extends Entity.ComponentProof>(scope: EntityScope.EntityScope<string, Root>, draft: Entity.EntityDraft<S, P, Root> & DraftAllowed<P, Spawns> & DraftRequirementsMet<S, HeldNames<P>>) => SpawnedId<S, Root, HeldNames<P>>;
274
444
  /**
275
- * Queues component inserts (or replacements) on an existing entity.
445
+ * Queues component inserts (or replacements) on an existing entity, applied
446
+ * at the next `applyDeferred()`. To change a value now, on an entity you
447
+ * matched, write through a query (`Game.Query.write`) instead; components
448
+ * declared `immutable: true` change only through `insert`.
449
+ *
450
+ * Pass `match.entity`: its query proves what the entity holds, which must
451
+ * cover what the inserted components require (`Schema.requires`) together
452
+ * with the entries inserted in the same call. The id `spawn` returned in
453
+ * this run proves its draft. A raw `EntityId` proves nothing, so it only
454
+ * inserts components without requirements.
276
455
  *
277
456
  * Entries must already be valid; validate raw input with
278
457
  * `Game.Command.entryRaw(...)` first.
279
458
  */
280
- readonly insert: (entity: Entity.EntityId<S, Root>, ...entries: ReadonlyArray<SchemaEntry<S>>) => Entity.EntityId<S, Root>;
459
+ readonly insert: [Inserts] extends [never] ? MethodNotDeclared<"insert", "inserts"> : <const E extends Entity.EntityId<S, Root> | EntityTarget<S, Root>, const Entries extends ReadonlyArray<SchemaEntry<S>>>(entity: E, ...entries: Entries & EntriesAllowed<Entries, Inserts> & InsertRequirementsMet<S, E, Entries>) => Entity.EntityId<S, Root>;
281
460
  /**
282
- * Queues an entity removal.
461
+ * Queues an entity removal. A despawned entity stays visible to queries
462
+ * until the next `applyDeferred()`, and despawns never count as writers for
463
+ * `Game.System.thisTick` query reads.
464
+ *
465
+ * Pass `match.entity` from a query proving one of the `despawns`
466
+ * components, or the id `spawn` returned in this run (it holds its draft's
467
+ * components); never a raw id.
283
468
  */
284
- readonly despawn: (entity: Entity.EntityId<S, Root>) => void;
469
+ readonly despawn: [Despawns] extends [never] ? MethodNotDeclared<"despawn", "despawns"> : <const E>(entity: unknown extends DespawnAllowed<E, Despawns> ? E : DespawnAllowed<E, Despawns>) => void;
285
470
  /**
286
471
  * Queues removal of every entity owned by one lifetime scope.
287
472
  */
288
- readonly despawnScope: (scope: EntityScope.EntityScope<string, Root>) => void;
473
+ readonly despawnScope: [Scopes] extends [never] ? MethodNotDeclared<"despawnScope", "despawnsScope"> : (scope: Scopes) => void;
289
474
  /**
290
- * Queues a component removal on an existing entity.
475
+ * Queues the removal of one or more components from an existing entity,
476
+ * applied together at the next `applyDeferred()`.
477
+ *
478
+ * Pass `match.entity` from a query, or the id `spawn` returned in this run;
479
+ * never a raw id. A component another one requires (`Schema.requires`) can
480
+ * only go together with that requirer, in the same call, or from an
481
+ * entity whose query has `without: [Requirer]`.
291
482
  */
292
- readonly remove: <D extends Extract<Schema.Components<S>[keyof Schema.Components<S>], Descriptor<"component", string, any>>>(entity: Entity.EntityId<S, Root>, descriptor: D) => Entity.EntityId<S, Root>;
483
+ readonly remove: [Removes] extends [never] ? MethodNotDeclared<"remove", "removes"> : <const E, const Ds extends readonly [SchemaComponent<S>, ...Array<SchemaComponent<S>>]>(entity: unknown extends RemoveTargetAllowed<S, Root, E> ? E : RemoveTargetAllowed<S, Root, E>, ...descriptors: Ds & RemoveAllowed<Ds[number], Removes> & RemoveRequirementsMet<S, E, Names<Ds[number]>>) => Entity.EntityId<S, Root>;
293
484
  /**
294
485
  * Queues one live relation mutation for deferred application.
295
486
  */
296
- readonly relate: <R extends Extract<Schema.Relations<S>[keyof Schema.Relations<S>], Relation.Relation.Any>>(entity: Entity.EntityId<S, Root>, relation: R, target: Entity.EntityId<S, Root>) => void;
487
+ readonly relate: [Relates] extends [never] ? MethodNotDeclared<"relate", "relates"> : <R extends Extract<Relates, Relation.Relation.Any>>(entity: Entity.EntityId<S, Root>, relation: R, target: Entity.EntityId<S, Root>) => void;
297
488
  /**
298
489
  * Queues removal of one outgoing relation when present.
299
490
  */
300
- readonly unrelate: <R extends Extract<Schema.Relations<S>[keyof Schema.Relations<S>], Relation.Relation.Any>>(entity: Entity.EntityId<S, Root>, relation: R) => void;
491
+ readonly unrelate: [Relates] extends [never] ? MethodNotDeclared<"unrelate", "relates"> : <R extends Extract<Relates, Relation.Relation.Any>>(entity: Entity.EntityId<S, Root>, relation: R) => void;
301
492
  /**
302
493
  * Queues a hierarchy-only reorder of one parent's current children.
303
494
  */
304
- readonly reorderChildren: <R extends Extract<Schema.Relations<S>[keyof Schema.Relations<S>], Relation.Relation.Hierarchy>>(entity: Entity.EntityId<S, Root>, relation: R, children: ReadonlyArray<Entity.EntityId<S, Root>>) => void;
495
+ readonly reorderChildren: [Relates] extends [never] ? MethodNotDeclared<"reorderChildren", "relates"> : <R extends Extract<Relates, Relation.Relation.Hierarchy>>(entity: Entity.EntityId<S, Root>, relation: R, children: ReadonlyArray<Entity.EntityId<S, Root>>) => void;
496
+ }
497
+ /** The command queue the runtime gives each system: every command, unchecked, and `flush`. */
498
+ export interface CommandQueue<S extends Schema.Any, Root = unknown> {
499
+ readonly spawn: (draft: Entity.EntityDraft<S, any, Root>) => Entity.EntityId<S, Root>;
500
+ readonly spawnIn: (scope: EntityScope.EntityScope<string, Root>, draft: Entity.EntityDraft<S, any, Root>) => Entity.EntityId<S, Root>;
501
+ readonly insert: (entity: Entity.EntityId<S, Root> | {
502
+ readonly id: Entity.EntityId<S, Root>;
503
+ }, ...entries: ReadonlyArray<SchemaEntry<S>>) => Entity.EntityId<S, Root>;
504
+ readonly despawn: (entity: Entity.EntityId<S, Root> | {
505
+ readonly id: Entity.EntityId<S, Root>;
506
+ }) => void;
507
+ readonly despawnScope: (scope: EntityScope.EntityScope<string, Root>) => void;
508
+ readonly remove: (entity: Entity.EntityId<S, Root> | {
509
+ readonly id: Entity.EntityId<S, Root>;
510
+ }, ...descriptors: ReadonlyArray<ComponentDescriptor>) => Entity.EntityId<S, Root>;
511
+ readonly relate: (entity: Entity.EntityId<S, Root>, relation: Relation.Relation.Any, target: Entity.EntityId<S, Root>) => void;
512
+ readonly unrelate: (entity: Entity.EntityId<S, Root>, relation: Relation.Relation.Any) => void;
513
+ readonly reorderChildren: (entity: Entity.EntityId<S, Root>, relation: Relation.Relation.Hierarchy, children: ReadonlyArray<Entity.EntityId<S, Root>>) => void;
305
514
  /**
306
515
  * Drains the queued commands in insertion order.
307
516
  */
@@ -313,6 +522,6 @@ export interface CommandsApi<S extends Schema.Any, Root = unknown> {
313
522
  * The returned API is intentionally imperative for system authors, but all
314
523
  * mutations stay deferred until `flush()` is applied by the runtime.
315
524
  */
316
- export declare const makeCommands: <S extends Schema.Any, Root = unknown>(allocateId: () => Entity.EntityId<S, Root>) => CommandsApi<S, Root>;
525
+ export declare const makeCommands: <S extends Schema.Any, Root = unknown>(allocateId: () => Entity.EntityId<S, Root>) => CommandQueue<S, Root>;
317
526
  export {};
318
527
  //# sourceMappingURL=Command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../src/Command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,OAAO,KAAK,gBAAgB,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,WAAW,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,KAAK,QAAQ,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC;;;;;GAKG;AACH,yBAAiB,KAAK,CAAC;IACrB;;;;;OAKG;IACH,KAAY,MAAM,CAChB,CAAC,SAAS,MAAM,CAAC,cAAc,EAC/B,GAAG,SAAS,MAAM,EAClB,KAAK,IACH,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG;QACjB,QAAQ,EAAE,CAAC,IAAI,GAAG,GAAG,KAAK;KAC3B,CAAA;IAED;;OAEG;IACH,KAAY,WAAW,CACrB,CAAC,SAAS,MAAM,CAAC,cAAc,EAC/B,KAAK,SAAS,SAAS,CAAC,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,IACpE,KAAK,SAAS,SAAS,CAAC,MAAM,CAAC,SAAS,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,MAA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,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,KAAK,IAAI,CAAA;IAC9J;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAA;CACxD;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,cACnD,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,KACzC,YAAY,CAAC,CAAC,EAAE,IAAI,CAsGtB,CAAA"}
package/dist/Command.js CHANGED
@@ -71,15 +71,15 @@ const unspawnedId = Entity.makeEntityId(-1);
71
71
  */
72
72
  export const entry = (descriptor, value) => [descriptor, value];
73
73
  /**
74
- * Lifts an already validated value into an entry result, keeping the failure
75
- * visible to `spawn(...)` / `insert(...)`.
76
- */
77
- export const entryResult = (descriptor, result) => result.ok
78
- ? Result.success([descriptor, result.value])
79
- : Result.failure(result.error);
80
- /**
81
- * Validates raw input through a constructed descriptor and returns an entry
82
- * result.
74
+ * Validates raw input through a constructed descriptor's own validator and
75
+ * returns an entry result for `spawn(...)` / `insert(...)`.
76
+ *
77
+ * This is the one way to put unvalidated data on an entity: the descriptor
78
+ * owns its validator (`Descriptor.ConstructedComponent(...)`, built with
79
+ * `Decode` or `Descriptor.fromStandardSchema`). Values that are already
80
+ * valid use a plain `[Descriptor, value]` entry instead. To validate authored
81
+ * constants once at module load, call the constructor (`Vector2.result(...)`)
82
+ * and keep the carried value.
83
83
  *
84
84
  * @example
85
85
  * ```ts
@@ -91,13 +91,21 @@ export const entryResult = (descriptor, result) => result.ok
91
91
  * commands.spawn(draft.value)
92
92
  * ```
93
93
  */
94
- export const entryRaw = (descriptor, raw) => entryResult(descriptor, DescriptorModule.constructorOf(descriptor).result(raw));
94
+ export const entryRaw = (descriptor, raw) => {
95
+ const validated = DescriptorModule.constructorOf(descriptor).result(raw);
96
+ return validated.ok
97
+ ? Result.success([descriptor, validated.value])
98
+ : Result.failure(validated.error);
99
+ };
95
100
  /**
96
- * Adds entries to a draft. Plain entries return the new draft; if any entry is
97
- * a `Result`, the draft is returned as a `Result` whose error lists every
98
- * entry's failure (or `null`).
101
+ * Adds entries to a draft, a value not yet spawned. Plain entries return the
102
+ * new draft; if any entry is a `Result`, the draft is returned as a `Result`
103
+ * whose error lists every entry's failure (or `null`).
104
+ *
105
+ * Use this while building what a spawn will hold. Use `commands.insert` to
106
+ * add or replace components on an entity that already exists.
99
107
  */
100
- export const insert = (draft, ...entries) => build(draft.id, { ...draft.proof }, [...draft.components], draft.relations, entries);
108
+ export const extend = (draft, ...entries) => build(draft.id, { ...draft.proof }, [...draft.components], draft.relations, entries);
101
109
  /**
102
110
  * Shared draft builder. Plain entries take a fast path; the first `Result`
103
111
  * entry switches to collecting per-entry errors.
@@ -162,6 +170,31 @@ export const relate = (draft, relation, target) => Entity.draft(draft.id, draft.
162
170
  target
163
171
  }
164
172
  ]);
173
+ /**
174
+ * Allows `spawn` / `spawnIn` of drafts whose components are all among `components`.
175
+ * Use it for entities the system creates; use `extend` on a draft to build one.
176
+ */
177
+ export const spawns = (...components) => ({ permission: "spawns", values: components });
178
+ /**
179
+ * Allows `insert(entity, [X, value])` with `X` among `components`: add or
180
+ * replace at the next `applyDeferred()`. To change a value now, on an entity
181
+ * you matched, write through a query (`Game.Query.write`) instead.
182
+ */
183
+ export const inserts = (...components) => ({ permission: "inserts", values: components });
184
+ /** Allows `remove(entity, X)` with `X` among `components`. */
185
+ export const removes = (...components) => ({ permission: "removes", values: components });
186
+ /**
187
+ * Allows `despawn(entity)` where `entity` comes from a query match proving one
188
+ * of `components` (`match.entity`), never a raw id: the system can only
189
+ * despawn what it has proven is, for example, an `Enemy`.
190
+ */
191
+ export const despawns = (...components) => ({ permission: "despawns", values: components });
192
+ /** Allows `despawnScope(scope)` for this scope. */
193
+ export const despawnsScope = (scope) => ({ permission: "despawnsScope", values: [scope] });
194
+ /** Allows `relate`, `unrelate`, and `reorderChildren` for these relations. */
195
+ export const relates = (...relations) => ({ permission: "relates", values: relations });
196
+ /** Declares the commands a system may queue; see the permission builders. */
197
+ export const commands = (...permissions) => ({ kind: "commands", permissions });
165
198
  /**
166
199
  * Creates a fresh command queue for a system execution.
167
200
  *
@@ -182,7 +215,8 @@ export const makeCommands = (allocateId) => {
182
215
  queue.push({
183
216
  tag: "spawn",
184
217
  apply(world) {
185
- world.spawnEntity(id, draft.components);
218
+ if (!world.spawnEntity(id, draft.components))
219
+ return;
186
220
  for (const stagedRelation of draft.relations) {
187
221
  world.tryRelate(id, stagedRelation.relation, stagedRelation.target);
188
222
  }
@@ -195,7 +229,8 @@ export const makeCommands = (allocateId) => {
195
229
  queue.push({
196
230
  tag: "spawnIn",
197
231
  apply(world) {
198
- world.spawnEntity(id, draft.components);
232
+ if (!world.spawnEntity(id, draft.components))
233
+ return;
199
234
  world.assignEntityScope(id, scope);
200
235
  for (const stagedRelation of draft.relations) {
201
236
  world.tryRelate(id, stagedRelation.relation, stagedRelation.target);
@@ -204,22 +239,22 @@ export const makeCommands = (allocateId) => {
204
239
  });
205
240
  return id;
206
241
  },
207
- insert(entity, ...entries) {
242
+ insert(target, ...entries) {
243
+ const entity = typeof target === "object" ? target.id : target;
208
244
  queue.push({
209
245
  tag: "insert",
210
246
  apply(world) {
211
- for (const [descriptor, value] of entries) {
212
- world.writeComponent(entity, descriptor, value);
213
- }
247
+ world.insertComponents(entity, entries);
214
248
  }
215
249
  });
216
250
  return entity;
217
251
  },
218
252
  despawn(entity) {
253
+ const id = typeof entity === "object" ? entity.id : entity;
219
254
  queue.push({
220
255
  tag: "despawn",
221
256
  apply(world) {
222
- world.destroyEntity(entity);
257
+ world.destroyEntity(id);
223
258
  }
224
259
  });
225
260
  },
@@ -231,11 +266,12 @@ export const makeCommands = (allocateId) => {
231
266
  }
232
267
  });
233
268
  },
234
- remove(entity, descriptor) {
269
+ remove(target, ...descriptors) {
270
+ const entity = typeof target === "object" ? target.id : target;
235
271
  queue.push({
236
272
  tag: "remove",
237
273
  apply(world) {
238
- world.removeComponent(entity, descriptor);
274
+ world.removeComponents(entity, descriptors);
239
275
  }
240
276
  });
241
277
  return entity;