incanto 0.6.0 → 0.7.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 (32) hide show
  1. package/dist/2d.d.ts +7 -2
  2. package/dist/2d.js +3 -3
  3. package/dist/3d.d.ts +9 -3
  4. package/dist/3d.js +3 -3
  5. package/dist/{audio-player-DkBqRTs4.d.ts → audio-player-VSjk_vG8.d.ts} +1 -1
  6. package/dist/{behavior-CWhW3oa6.d.ts → behavior-e3kAmPGC.d.ts} +11 -0
  7. package/dist/{create-game-DkbZCNaV.js → create-game-CEFoFN8d.js} +3 -3
  8. package/dist/{create-game-B_sW_eiE.js → create-game-X5iRu6pf.js} +3 -3
  9. package/dist/debug.d.ts +3 -1
  10. package/dist/debug.js +56 -6
  11. package/dist/gameplay.d.ts +1 -1
  12. package/dist/index.d.ts +21 -4
  13. package/dist/index.js +3 -3
  14. package/dist/{loader-D2u0fVW2.d.ts → loader-y_X4zYO0.d.ts} +1 -1
  15. package/dist/net.d.ts +1 -1
  16. package/dist/{particle-sim-CFkILGwh.js → particle-sim-CrTE7c02.js} +36 -2
  17. package/dist/{physics-2d-Cgli1aju.js → physics-2d-DmQ540uR.js} +1 -1
  18. package/dist/{physics-3d-CBAQ12LY.js → physics-3d-CDjuhtt_.js} +1 -1
  19. package/dist/react.d.ts +1 -1
  20. package/dist/react.js +1 -1
  21. package/dist/{register-BJCfuuZ2.js → register-ClKnoILk.js} +34 -5
  22. package/dist/{register-Dd7Juujf.js → register-CscQqB7V.js} +44 -3
  23. package/dist/test.d.ts +2 -2
  24. package/dist/test.js +7 -7
  25. package/editor/assets/{agent8-MciFwn0v.js → agent8-1WJU-yXr.js} +1 -1
  26. package/editor/assets/{index-mofVSmuA.js → index-DzYFgZbl.js} +81 -81
  27. package/editor/index.html +1 -1
  28. package/package.json +1 -1
  29. package/schemas/scene.schema.json +175 -0
  30. package/skills/incanto-behaviors-and-scripts.md +25 -0
  31. package/skills/incanto-node-reference.md +35 -0
  32. package/skills/incanto-scene-json-authoring.md +19 -0
@@ -1,5 +1,5 @@
1
1
  import { f as Node } from "./loader-B4OEXDZ8.js";
2
- import { i as applyParticlePreset, r as PARTICLE_PRESET_NAMES, t as ParticleSim } from "./particle-sim-CFkILGwh.js";
2
+ import { i as applyParticlePreset, o as effectiveOrder, r as PARTICLE_PRESET_NAMES, t as ParticleSim } from "./particle-sim-CrTE7c02.js";
3
3
  import { t as IncantoError } from "./errors-BpWbnbb_.js";
4
4
  import { t as Rng } from "./rng-DP-SR7eg.js";
5
5
  import { t as registerCoreNodes } from "./register-Dl_ixIJe.js";
@@ -210,7 +210,18 @@ var Node3D = class extends Node {
210
210
  1
211
211
  ] },
212
212
  visible: { default: true },
213
- renderOrder: { default: 0 }
213
+ renderOrder: { default: 0 },
214
+ orderGroup: {
215
+ default: "default",
216
+ options: [
217
+ "background",
218
+ "terrain",
219
+ "default",
220
+ "characters",
221
+ "effects",
222
+ "overlay"
223
+ ]
224
+ }
214
225
  };
215
226
  position = [
216
227
  0,
@@ -242,6 +253,12 @@ var Node3D = class extends Node {
242
253
  * materials — three sorts the transparent pass by renderOrder, then depth.
243
254
  * Pairs with named scene constants (e.g. `{"@const": "UI"}`) for sorting tiers. */
244
255
  renderOrder = 0;
256
+ /** Named draw-order band; `renderOrder` is the fine offset inside it. */
257
+ orderGroup = "default";
258
+ /** What three actually sorts by: band base + renderOrder. */
259
+ get effectiveRenderOrder() {
260
+ return effectiveOrder(this.orderGroup, this.renderOrder);
261
+ }
245
262
  _object3D = null;
246
263
  /**
247
264
  * @internal Fixed-step render interpolation. A physics body fills these with
@@ -275,7 +292,7 @@ var Node3D = class extends Node {
275
292
  o.rotation.set(MathUtils.degToRad(this.rotation[0] ?? 0), MathUtils.degToRad(this.rotation[1] ?? 0), MathUtils.degToRad(this.rotation[2] ?? 0));
276
293
  o.scale.set(this.scale[0] ?? 1, this.scale[1] ?? 1, this.scale[2] ?? 1);
277
294
  o.visible = this.visible;
278
- o.renderOrder = this.renderOrder;
295
+ o.renderOrder = this.effectiveRenderOrder;
279
296
  }
280
297
  free() {
281
298
  super.free();
@@ -1139,8 +1156,20 @@ const MAX_RESOLUTION = 128;
1139
1156
  * real numbers off `heightAt`.
1140
1157
  */
1141
1158
  var Terrain3D = class extends Node3D {
1159
+ orderGroup = "terrain";
1142
1160
  static typeName = "Terrain3D";
1143
1161
  static props = {
1162
+ orderGroup: {
1163
+ default: "terrain",
1164
+ options: [
1165
+ "background",
1166
+ "terrain",
1167
+ "default",
1168
+ "characters",
1169
+ "effects",
1170
+ "overlay"
1171
+ ]
1172
+ },
1144
1173
  size: { default: [200, 200] },
1145
1174
  maxHeight: { default: 28 },
1146
1175
  seed: { default: 1 },
@@ -5820,9 +5849,21 @@ const PX_TO_M = .01;
5820
5849
  * tilts emission out of the plane too).
5821
5850
  */
5822
5851
  var Particles3D = class Particles3D extends Node3D {
5852
+ orderGroup = "effects";
5823
5853
  static typeName = "Particles3D";
5824
5854
  static signals = ["finished"];
5825
5855
  static props = {
5856
+ orderGroup: {
5857
+ default: "effects",
5858
+ options: [
5859
+ "background",
5860
+ "terrain",
5861
+ "default",
5862
+ "characters",
5863
+ "effects",
5864
+ "overlay"
5865
+ ]
5866
+ },
5826
5867
  preset: {
5827
5868
  default: "custom",
5828
5869
  options: ["custom", ...PARTICLE_PRESET_NAMES]
package/dist/test.d.ts CHANGED
@@ -1,6 +1,6 @@
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-CWhW3oa6.js";
3
- import { t as LoadSceneOptions } from "./loader-D2u0fVW2.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
4
  import { t as IncantoError } from "./errors-BMFaY68Q.js";
5
5
 
6
6
  //#region src/test/index.d.ts
package/dist/test.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { _ as registerBehavior, n as loadScene } from "./loader-B4OEXDZ8.js";
2
- import { a as Engine } from "./particle-sim-CFkILGwh.js";
2
+ import { s as Engine } from "./particle-sim-CrTE7c02.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 { i as getNodeSchema, s as mergeStaticProps } from "./registry-BVJ2HbCn.js";
6
6
  import { n as registerGameplayBehaviors } from "./gameplay-CDFgSG6z.js";
7
- import { t as registerNodes2D } from "./register-BJCfuuZ2.js";
8
- import { t as registerNodes3D } from "./register-Dd7Juujf.js";
7
+ import { t as registerNodes2D } from "./register-ClKnoILk.js";
8
+ import { t as registerNodes3D } from "./register-CscQqB7V.js";
9
9
  import { t as registerNodesNet } from "./register-C35HDZpm.js";
10
10
  //#region src/test/index.ts
11
11
  /**
@@ -129,10 +129,10 @@ async function runScript(json, opts) {
129
129
  engine.setScene(scene);
130
130
  const physics = opts.physics ?? "auto";
131
131
  if (physics === "2d" || physics === "auto" && scene.dimension === "2d") {
132
- const { enablePhysics2D } = await import("./physics-2d-Cgli1aju.js").then((n) => n.r);
132
+ const { enablePhysics2D } = await import("./physics-2d-DmQ540uR.js").then((n) => n.r);
133
133
  await enablePhysics2D(engine);
134
134
  } else if (physics === "3d" || physics === "auto" && scene.dimension === "3d") {
135
- const { enablePhysics3D } = await import("./physics-3d-CBAQ12LY.js").then((n) => n.r);
135
+ const { enablePhysics3D } = await import("./physics-3d-CDjuhtt_.js").then((n) => n.r);
136
136
  await enablePhysics3D(engine);
137
137
  }
138
138
  const failures = [];
@@ -234,10 +234,10 @@ async function createPlaySession(json, opts = {}) {
234
234
  engine.setScene(scene);
235
235
  const physics = opts.physics ?? "auto";
236
236
  if (physics === "2d" || physics === "auto" && scene.dimension === "2d") {
237
- const { enablePhysics2D } = await import("./physics-2d-Cgli1aju.js").then((n) => n.r);
237
+ const { enablePhysics2D } = await import("./physics-2d-DmQ540uR.js").then((n) => n.r);
238
238
  await enablePhysics2D(engine);
239
239
  } else if (physics === "3d" || physics === "auto" && scene.dimension === "3d") {
240
- const { enablePhysics3D } = await import("./physics-3d-CBAQ12LY.js").then((n) => n.r);
240
+ const { enablePhysics3D } = await import("./physics-3d-CDjuhtt_.js").then((n) => n.r);
241
241
  await enablePhysics3D(engine);
242
242
  }
243
243
  const stepMs = 1e3 / (opts.fixedHz ?? 60);
@@ -1 +1 @@
1
- import{t as e}from"./index-mofVSmuA.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-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};