incanto 0.7.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 (48) hide show
  1. package/bin/incanto-check.mjs +6 -4
  2. package/dist/2d.d.ts +93 -3
  3. package/dist/2d.js +4 -4
  4. package/dist/3d.d.ts +45 -4
  5. package/dist/3d.js +4 -4
  6. package/dist/{audio-player-VSjk_vG8.d.ts → audio-player-Dyjg5k92.d.ts} +1 -1
  7. package/dist/audit-C6rMyict.js +58 -0
  8. package/dist/{behavior-e3kAmPGC.d.ts → behavior-Bod1AyJS.d.ts} +211 -174
  9. package/dist/{create-game-CEFoFN8d.js → create-game-66c4iYJE.js} +76 -6
  10. package/dist/{create-game-X5iRu6pf.js → create-game-BNDSbhy-.js} +88 -6
  11. package/dist/debug.d.ts +1 -1
  12. package/dist/debug.js +3 -0
  13. package/dist/{errors-BMFaY68Q.d.ts → errors-1dXlIwoR.d.ts} +7 -1
  14. package/dist/{gameplay-CDFgSG6z.js → gameplay-DPMgZk9W.js} +108 -1
  15. package/dist/gameplay.d.ts +44 -3
  16. package/dist/gameplay.js +2 -2
  17. package/dist/index.d.ts +151 -9
  18. package/dist/index.js +189 -4
  19. package/dist/{loader-y_X4zYO0.d.ts → loader-BcUDfNHn.d.ts} +1 -1
  20. package/dist/net.d.ts +46 -2
  21. package/dist/net.js +54 -2
  22. package/dist/particle-sim-CyUU7HVU.js +281 -0
  23. package/dist/{physics-2d-DmQ540uR.js → physics-2d-q2N362ph.js} +45 -4
  24. package/dist/{physics-3d-CDjuhtt_.js → physics-3d-CvHr31d4.js} +1 -1
  25. package/dist/react.d.ts +1 -1
  26. package/dist/react.js +1 -1
  27. package/dist/{register-CscQqB7V.js → register-Cbs7QxoV.js} +139 -4
  28. package/dist/{register-ClKnoILk.js → register-Cqjxrfq0.js} +254 -4
  29. package/dist/{register-C35HDZpm.js → register-CxmuI9FL.js} +1 -1
  30. package/dist/{particle-sim-CrTE7c02.js → register-DRPIjrKG.js} +1185 -278
  31. package/dist/test.d.ts +4 -10
  32. package/dist/test.js +11 -16
  33. package/editor/assets/{agent8-1WJU-yXr.js → agent8-B8QnWCeP.js} +1 -1
  34. package/editor/assets/{index-DzYFgZbl.js → index-CVhnNkb3.js} +81 -81
  35. package/editor/index.html +1 -1
  36. package/package.json +1 -1
  37. package/schemas/scene.schema.json +427 -0
  38. package/skills/incanto-3d-character.md +14 -0
  39. package/skills/incanto-audio.md +23 -0
  40. package/skills/incanto-building-2d-games.md +31 -0
  41. package/skills/incanto-building-3d-games.md +21 -0
  42. package/skills/incanto-gameplay-behaviors.md +28 -0
  43. package/skills/incanto-hud.md +24 -0
  44. package/skills/incanto-multiplayer.md +27 -0
  45. package/skills/incanto-node-reference.md +73 -0
  46. package/skills/incanto-physics-and-input.md +9 -0
  47. package/skills/incanto-verifying-your-game.md +40 -0
  48. package/dist/register-Dl_ixIJe.js +0 -834
package/dist/test.d.ts CHANGED
@@ -1,15 +1,9 @@
1
1
  import { c as JsonValue, i as SceneJson } from "./schema-CcoWb32N.js";
2
- import { O as LogEntry, T as Node, n as BehaviorCtor, v as Engine, w as Scene } from "./behavior-e3kAmPGC.js";
3
- import { t as LoadSceneOptions } from "./loader-y_X4zYO0.js";
4
- import { t as IncantoError } from "./errors-BMFaY68Q.js";
2
+ import { $ as Node, T as LogEntry, n as BehaviorCtor, v as Engine, w as Scene } from "./behavior-Bod1AyJS.js";
3
+ import { t as LoadSceneOptions } from "./loader-BcUDfNHn.js";
4
+ import { i as auditScene, t as IncantoError } from "./errors-1dXlIwoR.js";
5
5
 
6
6
  //#region src/test/index.d.ts
7
- /**
8
- * Register every built-in node set (core + 2d + 3d + net) AND the built-in
9
- * gameplay behaviors — so headless verification (validateScene/runScript) of a
10
- * game built on `incanto/gameplay` works without re-passing them. Idempotent;
11
- * a user behavior passed via `behaviors` (registered after) still wins.
12
- */
13
7
  declare function registerAllNodes(): void;
14
8
  interface NodeCapture {
15
9
  /** Absolute path ('/Root/Player') — stable, grep-able. */
@@ -155,4 +149,4 @@ interface PlaySession {
155
149
  */
156
150
  declare function createPlaySession(json: unknown, opts?: PlaySessionOptions): Promise<PlaySession>;
157
151
  //#endregion
158
- export { NodeCapture, PlaySession, PlaySessionOptions, RunContext, RunFailure, RunResult, RunScriptOptions, SceneCapture, ScriptStep, ValidateSceneOptions, ValidationResult, captureScene, createPlaySession, describeCapture, registerAllNodes, runScript, validateScene };
152
+ export { NodeCapture, PlaySession, PlaySessionOptions, RunContext, RunFailure, RunResult, RunScriptOptions, SceneCapture, ScriptStep, ValidateSceneOptions, ValidationResult, auditScene, captureScene, createPlaySession, describeCapture, registerAllNodes, runScript, validateScene };
package/dist/test.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import { _ as registerBehavior, n as loadScene } from "./loader-B4OEXDZ8.js";
2
- import { s as Engine } from "./particle-sim-CrTE7c02.js";
2
+ import { u as Engine } from "./register-DRPIjrKG.js";
3
3
  import { t as IncantoError } from "./errors-BpWbnbb_.js";
4
+ import { t as auditScene } from "./audit-C6rMyict.js";
4
5
  import { n as jsonEquals, t as jsonClone } from "./json-BLk7H2Qa.js";
5
6
  import { i as getNodeSchema, s as mergeStaticProps } from "./registry-BVJ2HbCn.js";
6
- import { n as registerGameplayBehaviors } from "./gameplay-CDFgSG6z.js";
7
- import { t as registerNodes2D } from "./register-ClKnoILk.js";
8
- import { t as registerNodes3D } from "./register-CscQqB7V.js";
9
- import { t as registerNodesNet } from "./register-C35HDZpm.js";
7
+ import { n as registerGameplayBehaviors } from "./gameplay-DPMgZk9W.js";
8
+ import { t as registerNodes2D } from "./register-Cqjxrfq0.js";
9
+ import { t as registerNodes3D } from "./register-Cbs7QxoV.js";
10
+ import { t as registerNodesNet } from "./register-CxmuI9FL.js";
10
11
  //#region src/test/index.ts
11
12
  /**
12
13
  * incanto/test — the browserless verification harness.
@@ -24,12 +25,6 @@ import { t as registerNodesNet } from "./register-C35HDZpm.js";
24
25
  * Deterministic by construction: fixed timestep, seeded `engine.rng`,
25
26
  * no requestAnimationFrame.
26
27
  */
27
- /**
28
- * Register every built-in node set (core + 2d + 3d + net) AND the built-in
29
- * gameplay behaviors — so headless verification (validateScene/runScript) of a
30
- * game built on `incanto/gameplay` works without re-passing them. Idempotent;
31
- * a user behavior passed via `behaviors` (registered after) still wins.
32
- */
33
28
  function registerAllNodes() {
34
29
  registerNodes2D();
35
30
  registerNodes3D();
@@ -129,10 +124,10 @@ async function runScript(json, opts) {
129
124
  engine.setScene(scene);
130
125
  const physics = opts.physics ?? "auto";
131
126
  if (physics === "2d" || physics === "auto" && scene.dimension === "2d") {
132
- const { enablePhysics2D } = await import("./physics-2d-DmQ540uR.js").then((n) => n.r);
127
+ const { enablePhysics2D } = await import("./physics-2d-q2N362ph.js").then((n) => n.r);
133
128
  await enablePhysics2D(engine);
134
129
  } else if (physics === "3d" || physics === "auto" && scene.dimension === "3d") {
135
- const { enablePhysics3D } = await import("./physics-3d-CDjuhtt_.js").then((n) => n.r);
130
+ const { enablePhysics3D } = await import("./physics-3d-CvHr31d4.js").then((n) => n.r);
136
131
  await enablePhysics3D(engine);
137
132
  }
138
133
  const failures = [];
@@ -234,10 +229,10 @@ async function createPlaySession(json, opts = {}) {
234
229
  engine.setScene(scene);
235
230
  const physics = opts.physics ?? "auto";
236
231
  if (physics === "2d" || physics === "auto" && scene.dimension === "2d") {
237
- const { enablePhysics2D } = await import("./physics-2d-DmQ540uR.js").then((n) => n.r);
232
+ const { enablePhysics2D } = await import("./physics-2d-q2N362ph.js").then((n) => n.r);
238
233
  await enablePhysics2D(engine);
239
234
  } else if (physics === "3d" || physics === "auto" && scene.dimension === "3d") {
240
- const { enablePhysics3D } = await import("./physics-3d-CDjuhtt_.js").then((n) => n.r);
235
+ const { enablePhysics3D } = await import("./physics-3d-CvHr31d4.js").then((n) => n.r);
241
236
  await enablePhysics3D(engine);
242
237
  }
243
238
  const stepMs = 1e3 / (opts.fixedHz ?? 60);
@@ -272,4 +267,4 @@ async function createPlaySession(json, opts = {}) {
272
267
  };
273
268
  }
274
269
  //#endregion
275
- export { captureScene, createPlaySession, describeCapture, registerAllNodes, runScript, validateScene };
270
+ export { auditScene, captureScene, createPlaySession, describeCapture, registerAllNodes, runScript, validateScene };
@@ -1 +1 @@
1
- import{t as e}from"./index-DzYFgZbl.js";async function t(t){return new n((await e(()=>import(`./GameServer-C56iOUgF.js`),[],import.meta.url)).GameServer,t)}var n=class{raw;active=new Map;reconnecting=!1;disposed=!1;constructor(e,t){this.raw=new e({...t})}get account(){return this.raw.account}get connected(){return this.raw.connected}connect(){return this.raw.connected?Promise.resolve(!0):(this.disposed=!1,this.rawConnect())}rawConnect(){return this.raw.connect({onDisconnect:()=>void this.reconnect()})}disconnect(){this.disposed=!0;for(let e of this.active.values())e.off();return this.active.clear(),this.raw.disconnect()}remoteFunction(e,t,n){return this.raw.remoteFunction(e,t,n)}track(e){let t=Symbol(`sub`),n={make:e,off:e()};return this.active.set(t,n),()=>{n.off(),this.active.delete(t)}}async reconnect(){if(!this.disposed&&!this.reconnecting){this.reconnecting=!0;try{await this.rawConnect();for(let e of this.active.values())e.off(),e.off=e.make()}finally{this.reconnecting=!1}}}subscribeRoomState(e,t){return this.track(()=>this.raw.subscribeRoomState(e,t))}subscribeRoomMyState(e,t){return this.track(()=>this.raw.subscribeRoomMyState(e,t))}subscribeRoomAllUserStates(e,t){return this.track(()=>this.raw.subscribeRoomAllUserStates(e,e=>{let n={};for(let t of e??[]){if(!t||typeof t.account!=`string`||t.__leaved)continue;let{account:e,__updated:r,__leaved:i,...a}=t;n[e]=a}t(n)}))}subscribeRoomCollection(e,t,n){return this.track(()=>this.raw.subscribeRoomCollection(e,t,({items:e})=>{let t={};for(let n of e??[])n&&typeof n.__id==`string`&&(t[n.__id]=n);n(t)}))}onRoomMessage(e,t,n){return this.track(()=>this.raw.onRoomMessage(e,t,n))}onRoomUserJoin(e,t){return this.track(()=>this.raw.onRoomUserJoin(e,t))}onRoomUserLeave(e,t){return this.track(()=>this.raw.onRoomUserLeave(e,t))}subscribeGlobalState(e){return this.track(()=>this.raw.subscribeGlobalState(e))}subscribeGlobalMyState(e){return this.track(()=>this.raw.subscribeGlobalMyState(e))}subscribeGlobalUserState(e,t){return this.track(()=>this.raw.subscribeGlobalUserState(e,t))}subscribeGlobalCollection(e,t){return this.track(()=>this.raw.subscribeGlobalCollection(e,({items:e})=>{let n={};for(let t of e??[])t&&typeof t.__id==`string`&&(n[t.__id]=t);t(n)}))}subscribeAsset(e,t){return this.track(()=>this.raw.subscribeAsset(e,t))}onGlobalMessage(e,t){return this.track(()=>this.raw.onGlobalMessage(e,t))}};export{t as createAgent8Server};
1
+ import{t as e}from"./index-CVhnNkb3.js";async function t(t){return new n((await e(()=>import(`./GameServer-C56iOUgF.js`),[],import.meta.url)).GameServer,t)}var n=class{raw;active=new Map;reconnecting=!1;disposed=!1;constructor(e,t){this.raw=new e({...t})}get account(){return this.raw.account}get connected(){return this.raw.connected}connect(){return this.raw.connected?Promise.resolve(!0):(this.disposed=!1,this.rawConnect())}rawConnect(){return this.raw.connect({onDisconnect:()=>void this.reconnect()})}disconnect(){this.disposed=!0;for(let e of this.active.values())e.off();return this.active.clear(),this.raw.disconnect()}remoteFunction(e,t,n){return this.raw.remoteFunction(e,t,n)}track(e){let t=Symbol(`sub`),n={make:e,off:e()};return this.active.set(t,n),()=>{n.off(),this.active.delete(t)}}async reconnect(){if(!this.disposed&&!this.reconnecting){this.reconnecting=!0;try{await this.rawConnect();for(let e of this.active.values())e.off(),e.off=e.make()}finally{this.reconnecting=!1}}}subscribeRoomState(e,t){return this.track(()=>this.raw.subscribeRoomState(e,t))}subscribeRoomMyState(e,t){return this.track(()=>this.raw.subscribeRoomMyState(e,t))}subscribeRoomAllUserStates(e,t){return this.track(()=>this.raw.subscribeRoomAllUserStates(e,e=>{let n={};for(let t of e??[]){if(!t||typeof t.account!=`string`||t.__leaved)continue;let{account:e,__updated:r,__leaved:i,...a}=t;n[e]=a}t(n)}))}subscribeRoomCollection(e,t,n){return this.track(()=>this.raw.subscribeRoomCollection(e,t,({items:e})=>{let t={};for(let n of e??[])n&&typeof n.__id==`string`&&(t[n.__id]=n);n(t)}))}onRoomMessage(e,t,n){return this.track(()=>this.raw.onRoomMessage(e,t,n))}onRoomUserJoin(e,t){return this.track(()=>this.raw.onRoomUserJoin(e,t))}onRoomUserLeave(e,t){return this.track(()=>this.raw.onRoomUserLeave(e,t))}subscribeGlobalState(e){return this.track(()=>this.raw.subscribeGlobalState(e))}subscribeGlobalMyState(e){return this.track(()=>this.raw.subscribeGlobalMyState(e))}subscribeGlobalUserState(e,t){return this.track(()=>this.raw.subscribeGlobalUserState(e,t))}subscribeGlobalCollection(e,t){return this.track(()=>this.raw.subscribeGlobalCollection(e,({items:e})=>{let n={};for(let t of e??[])t&&typeof t.__id==`string`&&(n[t.__id]=t);t(n)}))}subscribeAsset(e,t){return this.track(()=>this.raw.subscribeAsset(e,t))}onGlobalMessage(e,t){return this.track(()=>this.raw.onGlobalMessage(e,t))}};export{t as createAgent8Server};