incanto 0.11.0 → 0.13.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 (83) hide show
  1. package/README.md +22 -0
  2. package/bin/incanto-new.mjs +87 -0
  3. package/dist/2d.d.ts +2 -2
  4. package/dist/2d.js +3 -3
  5. package/dist/3d.d.ts +246 -71
  6. package/dist/3d.js +143 -4
  7. package/dist/{behavior-Bod1AyJS.d.ts → behavior-CPibUfnH.d.ts} +4 -2
  8. package/dist/{create-game-CdWhP6ve.js → create-game-Ct86zczq.js} +5 -5
  9. package/dist/{create-game-DZ_4Nfq8.js → create-game-J6g4QInv.js} +75 -24
  10. package/dist/debug.d.ts +1 -1
  11. package/dist/{duplicate-BEvGBtb_.js → duplicate-BINwP0WG.js} +1 -1
  12. package/dist/{gameplay-Dn3yidJw.js → gameplay-sSqrUcnz.js} +75 -3
  13. package/dist/gameplay.d.ts +37 -2
  14. package/dist/gameplay.js +2 -2
  15. package/dist/index.d.ts +3 -30
  16. package/dist/index.js +4 -4
  17. package/dist/{loader-B4OEXDZ8.js → loader-BZqOKfI2.js} +3 -1
  18. package/dist/{loader-BcUDfNHn.d.ts → loader-DILt9PGC.d.ts} +1 -1
  19. package/dist/net.d.ts +1 -1
  20. package/dist/net.js +3 -3
  21. package/dist/{audio-player-Dyjg5k92.d.ts → pathfinding-RWYkNKx9.d.ts} +29 -2
  22. package/dist/{physics-2d-DweTURFt.js → physics-2d-BiIdl51r.js} +8 -4
  23. package/dist/{physics-3d-Br97Ans2.js → physics-3d-DhaAaKJo.js} +8 -4
  24. package/dist/react.d.ts +1 -1
  25. package/dist/react.js +1 -1
  26. package/dist/{register-Cwc-yCYx.js → register-BFFE1Mh1.js} +2 -2
  27. package/dist/{register-ysLR3WQS.js → register-BFw4c83z.js} +508 -123
  28. package/dist/{register-BD6zgrv_.js → register-Djwckzgx.js} +2 -2
  29. package/dist/{register-DJZXxwAn.js → register-nObreUQR.js} +1 -1
  30. package/dist/test.d.ts +2 -2
  31. package/dist/test.js +10 -10
  32. package/editor/assets/{agent8-BxNvAcLA.js → agent8-BF8Jfbkl.js} +1 -1
  33. package/editor/assets/{index-DMCQXowF.js → index-DSq0gdhE.js} +53 -41
  34. package/editor/index.html +1 -1
  35. package/package.json +4 -2
  36. package/schemas/scene.schema.json +263 -0
  37. package/skills/incanto-3d-character.md +37 -1
  38. package/skills/incanto-building-3d-games.md +83 -0
  39. package/skills/incanto-editor.md +3 -3
  40. package/skills/incanto-gameplay-behaviors.md +23 -1
  41. package/skills/incanto-node-reference.md +51 -0
  42. package/templates-app/beacon-isle-3d/PROJECT/Context.md +44 -0
  43. package/templates-app/beacon-isle-3d/PROJECT/Requirements.md +16 -0
  44. package/templates-app/beacon-isle-3d/PROJECT/Status.md +38 -0
  45. package/templates-app/beacon-isle-3d/PROJECT/Structure.md +24 -0
  46. package/templates-app/beacon-isle-3d/docs/project-3d-rules.md +38 -0
  47. package/templates-app/beacon-isle-3d/generate-world.ts +814 -0
  48. package/templates-app/beacon-isle-3d/index.html +68 -0
  49. package/templates-app/beacon-isle-3d/package.json +26 -0
  50. package/templates-app/beacon-isle-3d/src/behaviors.ts +570 -0
  51. package/templates-app/beacon-isle-3d/src/game.scene.json +2992 -0
  52. package/templates-app/beacon-isle-3d/src/main.ts +33 -0
  53. package/templates-app/beacon-isle-3d/tsconfig.json +13 -0
  54. package/templates-app/beacon-isle-3d/verify.ts +285 -0
  55. package/templates-app/beacon-isle-3d/vite.config.ts +5 -0
  56. package/templates-app/tps-3d/PROJECT/Context.md +49 -0
  57. package/templates-app/tps-3d/PROJECT/Requirements.md +38 -0
  58. package/templates-app/tps-3d/PROJECT/Status.md +41 -0
  59. package/templates-app/tps-3d/PROJECT/Structure.md +44 -0
  60. package/templates-app/tps-3d/docs/project-3d-rules.md +38 -0
  61. package/templates-app/tps-3d/index.html +244 -0
  62. package/templates-app/tps-3d/package.json +25 -0
  63. package/templates-app/tps-3d/src/behaviors.ts +405 -0
  64. package/templates-app/tps-3d/src/game.scene.json +677 -0
  65. package/templates-app/tps-3d/src/main.ts +64 -0
  66. package/templates-app/tps-3d/tsconfig.json +13 -0
  67. package/templates-app/tps-3d/verify.ts +167 -0
  68. package/templates-app/tps-3d/vite.config.ts +5 -0
  69. package/templates-app/village-quest-3d/PROJECT/Context.md +39 -0
  70. package/templates-app/village-quest-3d/PROJECT/Requirements.md +36 -0
  71. package/templates-app/village-quest-3d/PROJECT/Status.md +26 -0
  72. package/templates-app/village-quest-3d/PROJECT/Structure.md +30 -0
  73. package/templates-app/village-quest-3d/docs/project-3d-rules.md +38 -0
  74. package/templates-app/village-quest-3d/index.html +68 -0
  75. package/templates-app/village-quest-3d/package.json +25 -0
  76. package/templates-app/village-quest-3d/src/behaviors.ts +529 -0
  77. package/templates-app/village-quest-3d/src/grove.scene.json +826 -0
  78. package/templates-app/village-quest-3d/src/main.ts +35 -0
  79. package/templates-app/village-quest-3d/src/quest.ts +18 -0
  80. package/templates-app/village-quest-3d/src/village.scene.json +680 -0
  81. package/templates-app/village-quest-3d/tsconfig.json +13 -0
  82. package/templates-app/village-quest-3d/verify.ts +254 -0
  83. package/templates-app/village-quest-3d/vite.config.ts +5 -0
package/dist/net.js CHANGED
@@ -1,9 +1,9 @@
1
- import { n as loadScene } from "./loader-B4OEXDZ8.js";
2
- import { u as Engine } from "./register-DJZXxwAn.js";
1
+ import { n as loadScene } from "./loader-BZqOKfI2.js";
2
+ import { u as Engine } from "./register-nObreUQR.js";
3
3
  import { t as IncantoError } from "./errors-BpWbnbb_.js";
4
4
  import { t as jsonClone } from "./json-BLk7H2Qa.js";
5
5
  import { n as createAgent8Server } from "./agent8-CvsfVskX.js";
6
- import { i as applySyncPatch, n as NetworkSpawner, r as NetworkManager, t as registerNodesNet } from "./register-Cwc-yCYx.js";
6
+ import { i as applySyncPatch, n as NetworkSpawner, r as NetworkManager, t as registerNodesNet } from "./register-BFFE1Mh1.js";
7
7
  //#region src/net/loopback.ts
8
8
  /**
9
9
  * In-memory multiplayer hub implementing the SAME kernel contract as
@@ -1,4 +1,4 @@
1
- import { $ as Node, P as Listener, l as PropSchema } from "./behavior-Bod1AyJS.js";
1
+ import { $ as Node, P as Listener, l as PropSchema } from "./behavior-CPibUfnH.js";
2
2
 
3
3
  //#region src/core/nodes/audio-player.d.ts
4
4
  /**
@@ -107,4 +107,31 @@ declare class AudioPlayer extends Node {
107
107
  override update(_dt: number): void;
108
108
  }
109
109
  //#endregion
110
- export { AudioPlayer as n, SpatialPose as r, AudioElementLike as t };
110
+ //#region src/core/pathfinding.d.ts
111
+ /**
112
+ * Grid A* — the pathfinding every top-down/RPG/tower-defense asks for and
113
+ * agents keep re-inventing badly. Pure and dimension-free: cells in, cells
114
+ * out; the caller maps cells to world units (px, meters, tiles).
115
+ */
116
+ interface PathGrid {
117
+ width: number;
118
+ height: number;
119
+ /** True = impassable. Out-of-bounds is always solid. */
120
+ solid(x: number, y: number): boolean;
121
+ }
122
+ interface FindPathOptions {
123
+ /** Allow diagonal steps (blocked from cutting corners). Default true. */
124
+ diagonal?: boolean;
125
+ /** Abort guard for huge/impossible searches. Default 20000 nodes. */
126
+ maxExpansions?: number;
127
+ }
128
+ /**
129
+ * A* from `from` to `to` (inclusive cell coords). Returns the cell path
130
+ * INCLUDING both endpoints, or null when unreachable. Straight steps cost
131
+ * 1, diagonals √2; the heuristic is octile (admissible for both modes).
132
+ */
133
+ declare function findPath(grid: PathGrid, from: [number, number], to: [number, number], opts?: FindPathOptions): [number, number][] | null;
134
+ /** Build a PathGrid from row-strings ('#' = solid) — tests and tile games. */
135
+ declare function gridFromRows(rows: readonly string[]): PathGrid;
136
+ //#endregion
137
+ export { AudioElementLike as a, gridFromRows as i, PathGrid as n, AudioPlayer as o, findPath as r, SpatialPose as s, FindPathOptions as t };
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
2
  import { t as IncantoError } from "./errors-BpWbnbb_.js";
3
- import { _ as RigidBody2D, b as validateCollider2D, g as PhysicsBody2D, h as CharacterBody2D, m as Area2D, p as Joint2D, y as Node2D } from "./register-BD6zgrv_.js";
3
+ import { _ as RigidBody2D, b as validateCollider2D, g as PhysicsBody2D, h as CharacterBody2D, m as Area2D, p as Joint2D, y as Node2D } from "./register-Djwckzgx.js";
4
4
  import { n as registerDebugSource } from "./debug-draw-CZmOYjL2.js";
5
5
  //#region src/2d/physics/physics-2d.ts
6
6
  var physics_2d_exports = /* @__PURE__ */ __exportAll({
@@ -16,7 +16,7 @@ const DEG = Math.PI / 180;
16
16
  */
17
17
  async function enablePhysics2D(engine, opts) {
18
18
  const R = await import("@dimforge/rapier2d-compat");
19
- await R.init();
19
+ await R.init({});
20
20
  return new Physics2D(R, engine, opts);
21
21
  }
22
22
  /**
@@ -99,8 +99,12 @@ var Physics2D = class {
99
99
  const b = this.byColliderHandle.get(h2);
100
100
  if (!a || !b) return;
101
101
  const sig = started ? "triggerEnter" : "triggerExit";
102
- a.emit(sig, b);
103
- b.emit(sig, a);
102
+ try {
103
+ a.emit(sig, b);
104
+ b.emit(sig, a);
105
+ } catch (error) {
106
+ console.error(`incanto: error in a '${sig}' handler (${a.name} ↔ ${b.name}):`, error);
107
+ }
104
108
  });
105
109
  }
106
110
  /** @internal Called by CharacterBody2D.moveAndSlide (during tree fixedUpdate). */
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
2
  import { t as IncantoError } from "./errors-BpWbnbb_.js";
3
3
  import { n as registerDebugSource } from "./debug-draw-CZmOYjL2.js";
4
- import { A as PhysicsBody3D, C as Terrain3D, D as Joint3D, N as Node3D, O as Area3D, P as validateCollider3D, j as RigidBody3D, k as CharacterBody3D } from "./register-ysLR3WQS.js";
4
+ import { A as Area3D, F as Node3D, I as validateCollider3D, M as PhysicsBody3D, N as RigidBody3D, T as Terrain3D, j as CharacterBody3D, k as Joint3D } from "./register-BFw4c83z.js";
5
5
  import { Euler, Quaternion } from "three";
6
6
  //#region src/3d/physics/physics-3d.ts
7
7
  var physics_3d_exports = /* @__PURE__ */ __exportAll({
@@ -16,7 +16,7 @@ const DEG = Math.PI / 180;
16
16
  */
17
17
  async function enablePhysics3D(engine, opts) {
18
18
  const R = await import("@dimforge/rapier3d-compat");
19
- await R.init();
19
+ await R.init({});
20
20
  return new Physics3D(R, engine, opts);
21
21
  }
22
22
  /** Per-engine 3D physics world. Same contract as Physics2D. */
@@ -124,8 +124,12 @@ var Physics3D = class {
124
124
  const b = this.byColliderHandle.get(h2);
125
125
  if (!a || !b) return;
126
126
  const sig = started ? "triggerEnter" : "triggerExit";
127
- a.emit(sig, b);
128
- b.emit(sig, a);
127
+ try {
128
+ a.emit(sig, b);
129
+ b.emit(sig, a);
130
+ } catch (error) {
131
+ console.error(`incanto: error in a '${sig}' handler (${a.name} ↔ ${b.name}):`, error);
132
+ }
129
133
  });
130
134
  }
131
135
  /** @internal Called by CharacterBody3D.moveAndSlide (during tree fixedUpdate). */
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { c as JsonValue } from "./schema-CcoWb32N.js";
2
- import { n as BehaviorCtor, v as Engine, w as Scene } from "./behavior-Bod1AyJS.js";
2
+ import { n as BehaviorCtor, v as Engine, w as Scene } from "./behavior-CPibUfnH.js";
3
3
  import { CSSProperties, ReactNode } from "react";
4
4
 
5
5
  //#region src/react/index.d.ts
package/dist/react.js CHANGED
@@ -156,7 +156,7 @@ function IncantoCanvas(props) {
156
156
  pointer: latest.pointer,
157
157
  ...keyboard !== void 0 ? { keyboard } : {}
158
158
  };
159
- const next = await (_gameFactory ?? (mode === "3d" ? async (o) => (await import("./create-game-DZ_4Nfq8.js").then((n) => n.n)).createGame3D(o) : async (o) => (await import("./create-game-CdWhP6ve.js").then((n) => n.n)).createGame2D(o)))(opts);
159
+ const next = await (_gameFactory ?? (mode === "3d" ? async (o) => (await import("./create-game-J6g4QInv.js").then((n) => n.n)).createGame3D(o) : async (o) => (await import("./create-game-Ct86zczq.js").then((n) => n.n)).createGame2D(o)))(opts);
160
160
  if (disposed) {
161
161
  next.dispose();
162
162
  return;
@@ -1,5 +1,5 @@
1
- import { f as Node, t as buildNodeJson, y as Signal } from "./loader-B4OEXDZ8.js";
2
- import { t as registerCoreNodes } from "./register-DJZXxwAn.js";
1
+ import { f as Node, t as buildNodeJson, y as Signal } from "./loader-BZqOKfI2.js";
2
+ import { t as registerCoreNodes } from "./register-nObreUQR.js";
3
3
  import { t as IncantoError } from "./errors-BpWbnbb_.js";
4
4
  import { n as jsonEquals, t as jsonClone } from "./json-BLk7H2Qa.js";
5
5
  import { l as registerNode } from "./registry-BVJ2HbCn.js";