@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.
- package/README.md +2 -0
- package/dist/Brand.d.ts +9 -4
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +9 -4
- package/dist/Brand.js.map +1 -1
- package/dist/Clock.d.ts +186 -0
- package/dist/Clock.d.ts.map +1 -0
- package/dist/Clock.js +111 -0
- package/dist/Clock.js.map +1 -0
- package/dist/Command.d.ts +250 -41
- package/dist/Command.d.ts.map +1 -1
- package/dist/Command.js +59 -23
- package/dist/Command.js.map +1 -1
- package/dist/Condition.d.ts +12 -1
- package/dist/Condition.d.ts.map +1 -1
- package/dist/Condition.js.map +1 -1
- package/dist/Debug.d.ts +163 -15
- package/dist/Debug.d.ts.map +1 -1
- package/dist/Debug.js.map +1 -1
- package/dist/Decode.d.ts +1 -1
- package/dist/Decode.js +1 -1
- package/dist/Descriptor.d.ts +67 -24
- package/dist/Descriptor.d.ts.map +1 -1
- package/dist/Descriptor.js +32 -15
- package/dist/Descriptor.js.map +1 -1
- package/dist/Entity.d.ts +22 -5
- package/dist/Entity.d.ts.map +1 -1
- package/dist/Entity.js +2 -2
- package/dist/Entity.js.map +1 -1
- package/dist/EntityScope.d.ts +26 -1
- package/dist/EntityScope.d.ts.map +1 -1
- package/dist/EntityScope.js +14 -2
- package/dist/EntityScope.js.map +1 -1
- package/dist/HostClock.d.ts +49 -0
- package/dist/HostClock.d.ts.map +1 -0
- package/dist/HostClock.js +46 -0
- package/dist/HostClock.js.map +1 -0
- package/dist/Inspector.d.ts +7 -1
- package/dist/Inspector.d.ts.map +1 -1
- package/dist/Inspector.js.map +1 -1
- package/dist/Machine.d.ts +67 -36
- package/dist/Machine.d.ts.map +1 -1
- package/dist/Machine.js +10 -3
- package/dist/Machine.js.map +1 -1
- package/dist/Query.d.ts +74 -26
- package/dist/Query.d.ts.map +1 -1
- package/dist/Query.js +32 -28
- package/dist/Query.js.map +1 -1
- package/dist/Runtime.d.ts +39 -16
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +556 -87
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +217 -10
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +5 -0
- package/dist/Schedule.js.map +1 -1
- package/dist/Schema.d.ts +196 -44
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +29 -11
- package/dist/Schema.js.map +1 -1
- package/dist/Snapshot.d.ts +14 -0
- package/dist/Snapshot.d.ts.map +1 -1
- package/dist/Snapshot.js.map +1 -1
- package/dist/System.d.ts +212 -58
- package/dist/System.d.ts.map +1 -1
- package/dist/System.js +84 -6
- package/dist/System.js.map +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/internal/cells.d.ts +3 -3
- package/dist/internal/cells.d.ts.map +1 -1
- package/dist/internal/cells.js +9 -11
- package/dist/internal/cells.js.map +1 -1
- package/dist/internal/debug.d.ts +13 -0
- package/dist/internal/debug.d.ts.map +1 -1
- package/dist/internal/debug.js +192 -7
- package/dist/internal/debug.js.map +1 -1
- package/dist/internal/equal.d.ts +8 -0
- package/dist/internal/equal.d.ts.map +1 -0
- package/dist/internal/equal.js +38 -0
- package/dist/internal/equal.js.map +1 -0
- package/dist/internal/fragments.d.ts.map +1 -1
- package/dist/internal/fragments.js +11 -1
- package/dist/internal/fragments.js.map +1 -1
- package/dist/internal/game.d.ts.map +1 -1
- package/dist/internal/game.js +41 -6
- package/dist/internal/game.js.map +1 -1
- package/dist/internal/order.d.ts +10 -0
- package/dist/internal/order.d.ts.map +1 -0
- package/dist/internal/order.js +122 -0
- package/dist/internal/order.js.map +1 -0
- package/dist/internal/queries.d.ts.map +1 -1
- package/dist/internal/queries.js +32 -10
- package/dist/internal/queries.js.map +1 -1
- package/dist/internal/requirements.d.ts +26 -0
- package/dist/internal/requirements.d.ts.map +1 -0
- package/dist/internal/requirements.js +46 -0
- package/dist/internal/requirements.js.map +1 -0
- package/package.json +1 -1
- package/src/Brand.ts +9 -4
- package/src/Clock.ts +311 -0
- package/src/Command.ts +407 -89
- package/src/Condition.ts +17 -1
- package/src/Debug.ts +172 -14
- package/src/Decode.ts +1 -1
- package/src/Descriptor.ts +92 -37
- package/src/Entity.ts +24 -5
- package/src/EntityScope.ts +27 -2
- package/src/HostClock.ts +64 -0
- package/src/Inspector.ts +7 -2
- package/src/Machine.ts +81 -37
- package/src/Query.ts +110 -38
- package/src/Runtime.ts +607 -111
- package/src/Schedule.ts +380 -13
- package/src/Schema.ts +249 -63
- package/src/Snapshot.ts +4 -0
- package/src/System.ts +248 -93
- package/src/index.ts +8 -7
- package/src/internal/cells.ts +10 -12
- package/src/internal/debug.ts +208 -12
- package/src/internal/equal.ts +31 -0
- package/src/internal/fragments.ts +12 -2
- package/src/internal/game.ts +61 -7
- package/src/internal/order.ts +144 -0
- package/src/internal/queries.ts +37 -13
- package/src/internal/requirements.ts +71 -0
- package/dist/Definition.d.ts +0 -99
- package/dist/Definition.d.ts.map +0 -1
- package/dist/Definition.js +0 -68
- package/dist/Definition.js.map +0 -1
- package/dist/Feature.d.ts +0 -106
- package/dist/Feature.d.ts.map +0 -1
- package/dist/Feature.js +0 -87
- package/dist/Feature.js.map +0 -1
- package/dist/Fx.d.ts +0 -128
- package/dist/Fx.d.ts.map +0 -1
- package/dist/Fx.js +0 -112
- package/dist/Fx.js.map +0 -1
- package/dist/internal/definition.d.ts +0 -17
- package/dist/internal/definition.d.ts.map +0 -1
- package/dist/internal/definition.js +0 -25
- package/dist/internal/definition.js.map +0 -1
- package/src/Definition.ts +0 -106
- package/src/Feature.ts +0 -241
- package/src/Fx.ts +0 -176
- package/src/internal/definition.ts +0 -56
package/dist/System.js
CHANGED
|
@@ -47,6 +47,38 @@ export const writeResource = (descriptor) => ({
|
|
|
47
47
|
mode: "write",
|
|
48
48
|
descriptor
|
|
49
49
|
});
|
|
50
|
+
/**
|
|
51
|
+
* Creates a resource read that also reports `changed()`: whether a committed
|
|
52
|
+
* write left a different value since this system's previous completed run.
|
|
53
|
+
*
|
|
54
|
+
* Use it for work worth doing only when a value moved: rewriting a HUD label,
|
|
55
|
+
* rebuilding a cache from settings. Use `readResource` when the system needs
|
|
56
|
+
* the value every run anyway.
|
|
57
|
+
*
|
|
58
|
+
* A write that leaves an equal value is not a change: primitives compare
|
|
59
|
+
* with `Object.is`, plain objects and arrays by their entries, other objects
|
|
60
|
+
* by reference. This differs from `Game.Query.changed`, where every write
|
|
61
|
+
* through a component write cell counts. The first run reports `true`; a
|
|
62
|
+
* failed run (rolled back) is not a change, and a failed reader sees the same
|
|
63
|
+
* change again next run. Its own writes are not reported to the writer.
|
|
64
|
+
*
|
|
65
|
+
* Conditions (`Game.Condition.check`) cannot declare it: they own no cursor.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const SyncHud = Game.System("SyncHud", {
|
|
70
|
+
* resources: { score: Game.System.changedResource(Score) },
|
|
71
|
+
* services: { hud: Game.System.service(Hud) }
|
|
72
|
+
* }, ({ resources, services }) => {
|
|
73
|
+
* if (!resources.score.changed()) return
|
|
74
|
+
* services.hud.score.textContent = `${resources.score.get()}`
|
|
75
|
+
* })
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export const changedResource = (descriptor) => ({
|
|
79
|
+
mode: "changed",
|
|
80
|
+
descriptor
|
|
81
|
+
});
|
|
50
82
|
/**
|
|
51
83
|
* Creates an event-read declaration for a system spec.
|
|
52
84
|
*
|
|
@@ -80,7 +112,7 @@ export const readEvent = (descriptor) => ({
|
|
|
80
112
|
*
|
|
81
113
|
* If the payload needs to name an entity for later work, emit a durable
|
|
82
114
|
* `Game.Entity.handle(...)` (optionally with an intent component) and let the later
|
|
83
|
-
* reader re-resolve it through `
|
|
115
|
+
* reader re-resolve it through `queries.x.getHandle(...)` (through a declared query).
|
|
84
116
|
*
|
|
85
117
|
* @example
|
|
86
118
|
* ```ts
|
|
@@ -97,6 +129,50 @@ export const writeEvent = (descriptor) => ({
|
|
|
97
129
|
mode: "write",
|
|
98
130
|
descriptor
|
|
99
131
|
});
|
|
132
|
+
/**
|
|
133
|
+
* Requires that every system writing this event or resource runs earlier in
|
|
134
|
+
* the same `runtime.tick(...)` call than the reading system: the reader then
|
|
135
|
+
* sees this tick's data, never last tick's. The library never reorders
|
|
136
|
+
* anything; it only checks.
|
|
137
|
+
*
|
|
138
|
+
* `runtime.tick(...)` checks it at compile time over everything passed to that
|
|
139
|
+
* call, in order (gated groups count by position), and rejects a writer that
|
|
140
|
+
* runs after the reader and a call whose order is not statically known. A
|
|
141
|
+
* read with no writer in the call compiles (a reader reused in several
|
|
142
|
+
* ticks); the `event-never-written` lint reports data nobody writes.
|
|
143
|
+
* `tryTick` checks the same at runtime.
|
|
144
|
+
*
|
|
145
|
+
* Use it on reads whose correctness depends on running after their writers
|
|
146
|
+
* (damage applied the tick it is dealt). A plain read is right when last
|
|
147
|
+
* tick's data is acceptable.
|
|
148
|
+
*
|
|
149
|
+
* On a query (`queries: { enemies: Game.System.thisTick(Enemies) }`), the
|
|
150
|
+
* writers are systems whose declared commands can change what it matches:
|
|
151
|
+
* `spawns` covering every component it requires, or `inserts` / `removes` of
|
|
152
|
+
* any component it names (selection slots, optional ones included, `with`,
|
|
153
|
+
* `without`, filters). Each must run earlier with an `applyDeferred()` (or
|
|
154
|
+
* `applyStateTransitions(...)`) between it and the reader, since commands
|
|
155
|
+
* apply only there. `despawns` never count: a despawned entity stays visible
|
|
156
|
+
* to queries until the next `applyDeferred()`. Nested schedules are
|
|
157
|
+
* flattened, gated groups count by position, and a transition bundle counts
|
|
158
|
+
* at its `applyStateTransitions(...)` step (which applies queued commands
|
|
159
|
+
* first), as if every schedule in it runs, markers inside included.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* const ApplyDamage = Game.System("ApplyDamage", {
|
|
164
|
+
* events: { damage: Game.System.thisTick(Game.System.readEvent(Damage)) }
|
|
165
|
+
* }, ({ events }) => { ... })
|
|
166
|
+
*
|
|
167
|
+
* runtime.tick(Game.Schedule(DealDamage, ApplyDamage)) // compiles
|
|
168
|
+
* runtime.tick(Game.Schedule(ApplyDamage, DealDamage)) // "ApplyDamage needs Damage from this tick, but its writer DealDamage runs after it"
|
|
169
|
+
*
|
|
170
|
+
* const AimAtNewest = Game.System("AimAtNewest", { queries: { enemies: Game.System.thisTick(Enemies) } }, ...)
|
|
171
|
+
* runtime.tick(Game.Schedule(SpawnWave, Game.Schedule.applyDeferred(), AimAtNewest)) // compiles
|
|
172
|
+
* runtime.tick(Game.Schedule(SpawnWave, AimAtNewest)) // "AimAtNewest needs this tick's commands for queries.enemies, but SpawnWave queues them with no applyDeferred() in between"
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
export const thisTick = (read) => ({ ...read, thisTick: true });
|
|
100
176
|
/**
|
|
101
177
|
* Declares read access to the current committed value of a finite-state machine.
|
|
102
178
|
*
|
|
@@ -129,7 +205,7 @@ export const transition = (stateMachine) => Machine.transition(stateMachine);
|
|
|
129
205
|
* normal events: each run sees those published since its previous run.
|
|
130
206
|
*
|
|
131
207
|
* This is one of the clearest signs that the modeled value should be a machine
|
|
132
|
-
* rather than a
|
|
208
|
+
* rather than a resource or a `Descriptor.EntityState` component.
|
|
133
209
|
*/
|
|
134
210
|
export const readTransitionEvent = (stateMachine) => Machine.readTransitionEvent(stateMachine);
|
|
135
211
|
/**
|
|
@@ -141,8 +217,9 @@ export const readTransitionEvent = (stateMachine) => Machine.readTransitionEvent
|
|
|
141
217
|
* ticked less often than the one that removes (rendering after several fixed
|
|
142
218
|
* updates) still sees every removal. A system skipped by its run conditions
|
|
143
219
|
* keeps its position, like `added`/`changed`, and sees the removals when it
|
|
144
|
-
* runs again. Each log is capped at `Runtime.streamCapacity` entries;
|
|
145
|
-
*
|
|
220
|
+
* runs again. Each log is capped at `Runtime.streamCapacity` entries; a
|
|
221
|
+
* reader that missed dropped ones sees `lagged() === true` (and a `missed`
|
|
222
|
+
* read in the debug trace). Systems usually pair this
|
|
146
223
|
* with host cleanup such as removing renderer-owned nodes. {@link readDespawned}
|
|
147
224
|
* complements this for whole-entity teardown.
|
|
148
225
|
*
|
|
@@ -196,8 +273,8 @@ export const readDespawned = () => ({
|
|
|
196
273
|
* Defines a system from an explicit spec and a typed implementation.
|
|
197
274
|
*
|
|
198
275
|
* This is the public entrypoint for authoring systems. The implementation only
|
|
199
|
-
* receives the capabilities declared in the spec
|
|
200
|
-
*
|
|
276
|
+
* receives the capabilities declared in the spec; return
|
|
277
|
+
* `Result.failure(error)` for an expected failure (see {@link SystemRun}).
|
|
201
278
|
*
|
|
202
279
|
* Use the string-name overload in normal code. The name is turned into an
|
|
203
280
|
* internal ordering token automatically, so the system can participate in
|
|
@@ -265,6 +342,7 @@ export function System(name, spec, run) {
|
|
|
265
342
|
pauseWhen: spec.pauseWhen ?? [],
|
|
266
343
|
transitions: spec.transitions ?? {},
|
|
267
344
|
local: spec.local,
|
|
345
|
+
commands: spec.commands,
|
|
268
346
|
__schemaRoot: undefined
|
|
269
347
|
};
|
|
270
348
|
return {
|
package/dist/System.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"System.js","sourceRoot":"","sources":["../src/System.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"System.js","sourceRoot":"","sources":["../src/System.ts"],"names":[],"mappings":"AA2DA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAIvC,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AA4D/C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,UAAa,EACG,EAAE,CAAC,CAAC;IACpB,UAAU;CACX,CAAC,CAAA;AAkBF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY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AAS,IAAI,EAAE;QAC/B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,IAAI,EAAE;QAC7C,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;QACrB,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;QAC/B,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE;QACnC,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,YAAY,EAAE,SAAS;KAChB,CAAA;IAET,OAAO;QACL,IAAI;QACJ,YAAY,EAAE,yBAAyB,CAAC,cAAc,CAAC;QACvD,YAAY,EAAE,SAAS;QACvB,QAAQ,EAAE;YACR,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC;YACjB,IAAI;SACL;QACD,IAAI,EAAE,cAAc;QACpB,GAAG;KACyC,CAAA;AAChD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* small number of stable namespaces instead of many deep internal paths.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
* Branding helpers for validated
|
|
8
|
+
* Branding helpers for packages that author validated value types (like
|
|
9
|
+
* `@typeonce/ritmo-math`). Game code validates through descriptors instead.
|
|
9
10
|
*/
|
|
10
11
|
export * as Brand from "./Brand.ts";
|
|
11
12
|
/**
|
|
@@ -17,13 +18,13 @@ export * as Decode from "./Decode.ts";
|
|
|
17
18
|
*/
|
|
18
19
|
export * as Debug from "./Debug.ts";
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
+
* Simulation time: the fixed step, the clock resource, durations in whole steps.
|
|
21
22
|
*/
|
|
22
|
-
export * as
|
|
23
|
+
export * as Clock from "./Clock.ts";
|
|
23
24
|
/**
|
|
24
|
-
*
|
|
25
|
+
* Descriptor authoring helpers.
|
|
25
26
|
*/
|
|
26
|
-
export * as
|
|
27
|
+
export * as Descriptor from "./Descriptor.ts";
|
|
27
28
|
/**
|
|
28
29
|
* Entity identity and proof helpers.
|
|
29
30
|
*/
|
|
@@ -33,9 +34,9 @@ export * as Entity from "./Entity.ts";
|
|
|
33
34
|
*/
|
|
34
35
|
export * as EntityScope from "./EntityScope.ts";
|
|
35
36
|
/**
|
|
36
|
-
*
|
|
37
|
+
* The host's wall clock as an injected contract (`standard`, `test()`).
|
|
37
38
|
*/
|
|
38
|
-
export * as
|
|
39
|
+
export * as HostClock from "./HostClock.ts";
|
|
39
40
|
/**
|
|
40
41
|
* Read-only typed world projections.
|
|
41
42
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH;;;GAGG;AACH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC;;GAEG;AACH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C;;GAEG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C;;GAEG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC;;GAEG;AACH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C;;GAEG;AACH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* small number of stable namespaces instead of many deep internal paths.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
* Branding helpers for validated
|
|
8
|
+
* Branding helpers for packages that author validated value types (like
|
|
9
|
+
* `@typeonce/ritmo-math`). Game code validates through descriptors instead.
|
|
9
10
|
*/
|
|
10
11
|
export * as Brand from "./Brand.js";
|
|
11
12
|
/**
|
|
@@ -17,13 +18,13 @@ export * as Decode from "./Decode.js";
|
|
|
17
18
|
*/
|
|
18
19
|
export * as Debug from "./Debug.js";
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
+
* Simulation time: the fixed step, the clock resource, durations in whole steps.
|
|
21
22
|
*/
|
|
22
|
-
export * as
|
|
23
|
+
export * as Clock from "./Clock.js";
|
|
23
24
|
/**
|
|
24
|
-
*
|
|
25
|
+
* Descriptor authoring helpers.
|
|
25
26
|
*/
|
|
26
|
-
export * as
|
|
27
|
+
export * as Descriptor from "./Descriptor.js";
|
|
27
28
|
/**
|
|
28
29
|
* Entity identity and proof helpers.
|
|
29
30
|
*/
|
|
@@ -33,9 +34,9 @@ export * as Entity from "./Entity.js";
|
|
|
33
34
|
*/
|
|
34
35
|
export * as EntityScope from "./EntityScope.js";
|
|
35
36
|
/**
|
|
36
|
-
*
|
|
37
|
+
* The host's wall clock as an injected contract (`standard`, `test()`).
|
|
37
38
|
*/
|
|
38
|
-
export * as
|
|
39
|
+
export * as HostClock from "./HostClock.js";
|
|
39
40
|
/**
|
|
40
41
|
* Read-only typed world projections.
|
|
41
42
|
*/
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH;;;GAGG;AACH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC;;GAEG;AACH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C;;GAEG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C;;GAEG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC;;GAEG;AACH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C;;GAEG;AACH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA"}
|
package/dist/internal/cells.d.ts
CHANGED
|
@@ -15,14 +15,14 @@ import type { EntityRecord, World } from "./world.ts";
|
|
|
15
15
|
declare abstract class WriteCellBase<T> {
|
|
16
16
|
abstract get(): T;
|
|
17
17
|
abstract set(value: T): void;
|
|
18
|
-
|
|
18
|
+
/** Writes a validated candidate only on success. Backs `setRaw` / `updateRaw`. */
|
|
19
|
+
writeResult<E>(result: Result.Result<T, E>): Result.Result<void, E>;
|
|
19
20
|
update(f: (current: T) => T): void;
|
|
20
|
-
updateResult<E>(f: (current: T) => Result.Result<T, E>): Result.Result<void, E>;
|
|
21
21
|
}
|
|
22
22
|
export declare const componentRead: (record: EntityRecord, ordinal: number) => {
|
|
23
23
|
get(): unknown;
|
|
24
24
|
};
|
|
25
|
-
export declare const componentWrite: (record: EntityRecord, ordinal: number, world: World, constructor: ResultConstructor<unknown, unknown, unknown> | undefined,
|
|
25
|
+
export declare const componentWrite: (record: EntityRecord, ordinal: number, world: World, constructor: ResultConstructor<unknown, unknown, unknown> | undefined, entityState: string | undefined) => WriteCellBase<unknown>;
|
|
26
26
|
export declare const componentOptional: (record: EntityRecord, ordinal: number) => {
|
|
27
27
|
readonly present: boolean;
|
|
28
28
|
get(): unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cells.d.ts","sourceRoot":"","sources":["../../src/internal/cells.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGrD;;GAEG;AACH,uBAAe,aAAa,CAAC,CAAC;IAC5B,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAA;IACjB,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;IAE5B,
|
|
1
|
+
{"version":3,"file":"cells.d.ts","sourceRoot":"","sources":["../../src/internal/cells.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGrD;;GAEG;AACH,uBAAe,aAAa,CAAC,CAAC;IAC5B,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAA;IACjB,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;IAE5B,kFAAkF;IAClF,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAA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Q,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,GAAG,IAAI,CAAC,CAAA;CAKtC,CAAA"}
|
package/dist/internal/cells.js
CHANGED
|
@@ -4,7 +4,8 @@ import { ABSENT } from "./world.js";
|
|
|
4
4
|
* Validation behavior shared by every writable cell.
|
|
5
5
|
*/
|
|
6
6
|
class WriteCellBase {
|
|
7
|
-
|
|
7
|
+
/** Writes a validated candidate only on success. Backs `setRaw` / `updateRaw`. */
|
|
8
|
+
writeResult(result) {
|
|
8
9
|
if (!result.ok) {
|
|
9
10
|
return Result.failure(result.error);
|
|
10
11
|
}
|
|
@@ -14,30 +15,27 @@ class WriteCellBase {
|
|
|
14
15
|
update(f) {
|
|
15
16
|
this.set(f(this.get()));
|
|
16
17
|
}
|
|
17
|
-
updateResult(f) {
|
|
18
|
-
return this.setResult(f(this.get()));
|
|
19
|
-
}
|
|
20
18
|
}
|
|
21
19
|
/**
|
|
22
20
|
* Adds raw-validation helpers for values owned by constructed descriptors.
|
|
23
21
|
*/
|
|
24
22
|
const withConstructor = (cell, constructor) => Object.assign(cell, {
|
|
25
23
|
setRaw(raw) {
|
|
26
|
-
return cell.
|
|
24
|
+
return cell.writeResult(constructor.result(raw));
|
|
27
25
|
},
|
|
28
26
|
updateRaw(f) {
|
|
29
|
-
return cell.
|
|
27
|
+
return cell.writeResult(constructor.result(f(cell.get())));
|
|
30
28
|
}
|
|
31
29
|
});
|
|
32
30
|
/**
|
|
33
|
-
* Adds `transition` to the write cell of
|
|
31
|
+
* Adds `transition` to the write cell of an entity state component: a compare-and-set
|
|
34
32
|
* that writes `to` only while the current state is still `from`.
|
|
35
33
|
*/
|
|
36
|
-
const withTransition = (cell,
|
|
34
|
+
const withTransition = (cell, component) => Object.assign(cell, {
|
|
37
35
|
transition(from, to) {
|
|
38
36
|
const actual = cell.get();
|
|
39
37
|
if (actual !== from) {
|
|
40
|
-
return Result.failure({ _tag: "
|
|
38
|
+
return Result.failure({ _tag: "EntityStateMismatch", component, expected: from, actual });
|
|
41
39
|
}
|
|
42
40
|
cell.set(to);
|
|
43
41
|
return Result.success(undefined);
|
|
@@ -115,10 +113,10 @@ class StoreWriteCell extends WriteCellBase {
|
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
115
|
export const componentRead = (record, ordinal) => new ComponentReadCell(record, ordinal);
|
|
118
|
-
export const componentWrite = (record, ordinal, world, constructor,
|
|
116
|
+
export const componentWrite = (record, ordinal, world, constructor, entityState) => {
|
|
119
117
|
const cell = new ComponentWriteCell(record, ordinal, world);
|
|
120
118
|
const constructed = constructor === undefined ? cell : withConstructor(cell, constructor);
|
|
121
|
-
return
|
|
119
|
+
return entityState === undefined ? constructed : withTransition(constructed, entityState);
|
|
122
120
|
};
|
|
123
121
|
export const componentOptional = (record, ordinal) => new OptionalComponentCell(record, ordinal);
|
|
124
122
|
export const storeRead = (store, key) => new StoreReadCell(store, key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cells.js","sourceRoot":"","sources":["../../src/internal/cells.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC;;GAEG;AACH,MAAe,aAAa;IAI1B,
|
|
1
|
+
{"version":3,"file":"cells.js","sourceRoot":"","sources":["../../src/internal/cells.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC;;GAEG;AACH,MAAe,aAAa;IAI1B,kFAAkF;IAClF,WAAW,CAAI,MAA2B;QACxC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACrC,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACtB,OAAO,MAAM,CAAC,OAAO,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,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;AAC3F,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAoB,EAAE,OAAe,EAAiD,EAAE,CACxH,IAAI,qBAAqB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAE5C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAA2B,EAAE,GAAW,EAAsB,EAAE,CACxF,IAAI,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AAE/B;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,KAA2B,EAC3B,GAAW,EACX,KAA4C,EAC5C,WAAqE,EAC7C,EAAE;IAC1B,MAAM,IAAI,GAAG,IAAI,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;IAClD,OAAO,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;AAC9E,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAI,IAAa,EAAgB,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAA;AAE9E;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,SAAwB,EACxB,IAAa,EAC4B,EAAE,CAAC,CAAC;IAC7C,IAAI,OAAO;QACT,OAAO,SAAS,EAAE,CAAA;IACpB,CAAC;IACD,GAAG,EAAE,IAAI;CACV,CAAC,CAAA"}
|
package/dist/internal/debug.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type * as Debug from "../Debug.ts";
|
|
7
7
|
import type { Descriptor } from "../Descriptor.ts";
|
|
8
|
+
import type * as EntityScope from "../EntityScope.ts";
|
|
8
9
|
import type * as Machine from "../Machine.ts";
|
|
9
10
|
import * as Schedule from "../Schedule.ts";
|
|
10
11
|
import type { Schema } from "../Schema.ts";
|
|
@@ -22,8 +23,20 @@ export interface DescribeInput {
|
|
|
22
23
|
readonly schema: Schema.Any;
|
|
23
24
|
readonly machines: ReadonlyArray<Machine.StateMachine.Any>;
|
|
24
25
|
readonly currentMachine: (machine: Machine.StateMachine.Any) => Machine.StateValue | undefined;
|
|
26
|
+
/** Whether the runtime was given an initial value for the machine. */
|
|
27
|
+
readonly providesMachine: (machine: Machine.StateMachine.Any) => boolean;
|
|
28
|
+
/** Every scope defined through the game, with its despawn triggers. */
|
|
29
|
+
readonly scopes: ReadonlyArray<EntityScope.EntityScope.Any>;
|
|
25
30
|
readonly providedServices: ReadonlyArray<string>;
|
|
26
31
|
readonly externallyWrittenEvents: ReadonlySet<string>;
|
|
32
|
+
/** Relations commands have tried to relate or reorder, by the queuing systems. */
|
|
33
|
+
readonly relationMutations: ReadonlyMap<string, ReadonlySet<string>>;
|
|
34
|
+
/** What each system's applied commands did, as `kind:name`; see `Runtime`. */
|
|
35
|
+
readonly commandUses: ReadonlyMap<string, ReadonlySet<string>>;
|
|
36
|
+
/** Systems that ran in this session. */
|
|
37
|
+
readonly ranSystems: ReadonlySet<string>;
|
|
38
|
+
/** Commands skipped because they would have broken a `Schema.requires` requirement. */
|
|
39
|
+
readonly requirementViolations: ReadonlyArray<Debug.RequirementViolation>;
|
|
27
40
|
readonly hasResource: (descriptor: Descriptor.Any) => boolean;
|
|
28
41
|
readonly schedules: ReadonlyArray<readonly [string, AnySchedule]>;
|
|
29
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/internal/debug.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;
|
|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