incanto 0.5.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.
- package/dist/2d.d.ts +14 -3
- package/dist/2d.js +3 -3
- package/dist/3d.d.ts +36 -3
- package/dist/3d.js +3 -3
- package/dist/{audio-player-DkBqRTs4.d.ts → audio-player-VSjk_vG8.d.ts} +1 -1
- package/dist/{behavior-CWhW3oa6.d.ts → behavior-e3kAmPGC.d.ts} +11 -0
- package/dist/{create-game-D8UvwXme.js → create-game-CEFoFN8d.js} +64 -9
- package/dist/{create-game-BFESHv1X.js → create-game-X5iRu6pf.js} +28 -8
- package/dist/debug.d.ts +3 -1
- package/dist/debug.js +56 -6
- package/dist/gameplay.d.ts +1 -1
- package/dist/index.d.ts +21 -4
- package/dist/index.js +3 -3
- package/dist/{loader-D2u0fVW2.d.ts → loader-y_X4zYO0.d.ts} +1 -1
- package/dist/net.d.ts +1 -1
- package/dist/{particle-sim-CFkILGwh.js → particle-sim-CrTE7c02.js} +36 -2
- package/dist/{physics-2d-KXn1N1jF.js → physics-2d-DmQ540uR.js} +1 -1
- package/dist/{physics-3d-C58oQzTX.js → physics-3d-CDjuhtt_.js} +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/{register-D71C4rDC.js → register-ClKnoILk.js} +37 -5
- package/dist/{register-DvPHJdVj.js → register-CscQqB7V.js} +54 -3
- package/dist/test.d.ts +2 -2
- package/dist/test.js +7 -7
- package/editor/assets/{agent8-DruKhR22.js → agent8-1WJU-yXr.js} +1 -1
- package/editor/assets/{index-D2qufqUo.js → index-DzYFgZbl.js} +81 -81
- package/editor/index.html +1 -1
- package/package.json +1 -1
- package/schemas/scene.schema.json +315 -0
- package/skills/incanto-behaviors-and-scripts.md +25 -0
- package/skills/incanto-building-2d-games.md +6 -0
- package/skills/incanto-building-3d-games.md +13 -0
- package/skills/incanto-node-reference.md +70 -0
- package/skills/incanto-scene-json-authoring.md +19 -0
package/dist/net.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as JsonValue, i as SceneJson, s as JsonObject } from "./schema-CcoWb32N.js";
|
|
2
|
-
import { T as Node, et as Signal, l as PropSchema, v as Engine } from "./behavior-
|
|
2
|
+
import { T as Node, et as Signal, l as PropSchema, v as Engine } from "./behavior-e3kAmPGC.js";
|
|
3
3
|
|
|
4
4
|
//#region src/net/types.d.ts
|
|
5
5
|
type Unsubscribe = () => void;
|
|
@@ -1011,6 +1011,21 @@ var Engine = class {
|
|
|
1011
1011
|
* timers, behaviors all breathe together. See `gameplay` `hitStop()`.
|
|
1012
1012
|
*/
|
|
1013
1013
|
timeScale = 1;
|
|
1014
|
+
_time = 0;
|
|
1015
|
+
_unscaledTime = 0;
|
|
1016
|
+
/**
|
|
1017
|
+
* Elapsed GAME time in seconds since the scene started — the sum of every
|
|
1018
|
+
* scaled dt (freezes at timeScale 0, crawls in slow motion). Unity's
|
|
1019
|
+
* `Time.time`. Resets on `setScene`.
|
|
1020
|
+
*/
|
|
1021
|
+
get time() {
|
|
1022
|
+
return this._time;
|
|
1023
|
+
}
|
|
1024
|
+
/** Elapsed REAL time in seconds since the scene started (ignores timeScale) —
|
|
1025
|
+
* UI animations that must keep moving during slow-mo/pause read this. */
|
|
1026
|
+
get unscaledTime() {
|
|
1027
|
+
return this._unscaledTime;
|
|
1028
|
+
}
|
|
1014
1029
|
constructor(opts = {}) {
|
|
1015
1030
|
this.fixedStep = 1 / (opts.fixedHz ?? 60);
|
|
1016
1031
|
this.maxFixedSteps = opts.maxFixedStepsPerTick ?? 5;
|
|
@@ -1028,6 +1043,8 @@ var Engine = class {
|
|
|
1028
1043
|
this._scene = scene;
|
|
1029
1044
|
scene.tree._setEngine(this);
|
|
1030
1045
|
this.input.clear();
|
|
1046
|
+
this._time = 0;
|
|
1047
|
+
this._unscaledTime = 0;
|
|
1031
1048
|
if (scene.input) this.input.declare(scene.input);
|
|
1032
1049
|
this.sceneChanged.emit(scene);
|
|
1033
1050
|
}
|
|
@@ -1107,7 +1124,10 @@ var Engine = class {
|
|
|
1107
1124
|
this.lastMs = nowMs;
|
|
1108
1125
|
return;
|
|
1109
1126
|
}
|
|
1110
|
-
const
|
|
1127
|
+
const rawDt = Math.min((nowMs - this.lastMs) / 1e3, MAX_DT_SECONDS);
|
|
1128
|
+
const dt = rawDt * this.timeScale;
|
|
1129
|
+
this._time += dt;
|
|
1130
|
+
this._unscaledTime += rawDt;
|
|
1111
1131
|
this.lastMs = nowMs;
|
|
1112
1132
|
const scene = this._scene;
|
|
1113
1133
|
if (!scene) return;
|
|
@@ -1132,6 +1152,20 @@ function countNodes(root) {
|
|
|
1132
1152
|
return n;
|
|
1133
1153
|
}
|
|
1134
1154
|
//#endregion
|
|
1155
|
+
//#region src/core/order-groups.ts
|
|
1156
|
+
const ORDER_GROUP_BASE = {
|
|
1157
|
+
background: -2e3,
|
|
1158
|
+
terrain: -1e3,
|
|
1159
|
+
default: 0,
|
|
1160
|
+
characters: 1e3,
|
|
1161
|
+
effects: 2e3,
|
|
1162
|
+
overlay: 3e3
|
|
1163
|
+
};
|
|
1164
|
+
/** base + fine offset (unknown group names fall back to `default`). */
|
|
1165
|
+
function effectiveOrder(group, renderOrder) {
|
|
1166
|
+
return (ORDER_GROUP_BASE[group] ?? 0) + renderOrder;
|
|
1167
|
+
}
|
|
1168
|
+
//#endregion
|
|
1135
1169
|
//#region src/core/particle-presets.ts
|
|
1136
1170
|
const PARTICLE_PRESETS = {
|
|
1137
1171
|
fire: {
|
|
@@ -1397,4 +1431,4 @@ var ParticleSim = class {
|
|
|
1397
1431
|
}
|
|
1398
1432
|
};
|
|
1399
1433
|
//#endregion
|
|
1400
|
-
export {
|
|
1434
|
+
export { ORDER_GROUP_BASE as a, LogManager as c, isAudioContextAvailable as d, MusicManager as f, AudioBuses as g, fadeGain as h, applyParticlePreset as i, InputMap as l, crossfadeGains as m, PARTICLE_PRESETS as n, effectiveOrder as o, WebAudioMusicBackend as p, PARTICLE_PRESET_NAMES as r, Engine as s, ParticleSim as t, SfxEngine as u };
|
|
@@ -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 validateCollider2D, d as Area2D, f as CharacterBody2D, g as Node2D, m as RigidBody2D, p as PhysicsBody2D, u as Joint2D } from "./register-
|
|
3
|
+
import { _ as validateCollider2D, d as Area2D, f as CharacterBody2D, g as Node2D, m as RigidBody2D, p as PhysicsBody2D, u as Joint2D } from "./register-ClKnoILk.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({
|
|
@@ -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 { D as CharacterBody3D, E as Area3D, M as validateCollider3D, O as PhysicsBody3D, T as Joint3D, j as Node3D, k as RigidBody3D, x as Terrain3D } from "./register-
|
|
4
|
+
import { D as CharacterBody3D, E as Area3D, M as validateCollider3D, O as PhysicsBody3D, T as Joint3D, j as Node3D, k as RigidBody3D, x as Terrain3D } from "./register-CscQqB7V.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({
|
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-
|
|
2
|
+
import { n as BehaviorCtor, v as Engine, w as Scene } from "./behavior-e3kAmPGC.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-
|
|
159
|
+
const next = await (_gameFactory ?? (mode === "3d" ? async (o) => (await import("./create-game-CEFoFN8d.js").then((n) => n.n)).createGame3D(o) : async (o) => (await import("./create-game-X5iRu6pf.js").then((n) => n.n)).createGame2D(o)))(opts);
|
|
160
160
|
if (disposed) {
|
|
161
161
|
next.dispose();
|
|
162
162
|
return;
|
|
@@ -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-
|
|
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";
|
|
@@ -42,8 +42,20 @@ var Node2D = class extends Node {
|
|
|
42
42
|
static props = {
|
|
43
43
|
position: { default: [0, 0] },
|
|
44
44
|
rotation: { default: 0 },
|
|
45
|
+
static: { default: false },
|
|
45
46
|
scale: { default: [1, 1] },
|
|
46
47
|
renderOrder: { default: 0 },
|
|
48
|
+
orderGroup: {
|
|
49
|
+
default: "default",
|
|
50
|
+
options: [
|
|
51
|
+
"background",
|
|
52
|
+
"terrain",
|
|
53
|
+
"default",
|
|
54
|
+
"characters",
|
|
55
|
+
"effects",
|
|
56
|
+
"overlay"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
47
59
|
visible: { default: true }
|
|
48
60
|
};
|
|
49
61
|
/** Legacy alias: old 2D scenes (and `zIndex`-trained agents) keep loading —
|
|
@@ -54,9 +66,17 @@ var Node2D = class extends Node {
|
|
|
54
66
|
position = [0, 0];
|
|
55
67
|
/** Degrees, clockwise. */
|
|
56
68
|
rotation = 0;
|
|
69
|
+
/** Frozen after first sync — see Node3D.static (same semantics in 2D). */
|
|
70
|
+
static = false;
|
|
57
71
|
scale = [1, 1];
|
|
58
72
|
/** Draw order among 2D drawables (higher = on top); matches 3D `renderOrder`. */
|
|
59
73
|
renderOrder = 0;
|
|
74
|
+
/** Named draw-order band; `renderOrder` is the fine offset inside it. */
|
|
75
|
+
orderGroup = "default";
|
|
76
|
+
/** What three actually sorts by: band base + renderOrder. */
|
|
77
|
+
get effectiveRenderOrder() {
|
|
78
|
+
return effectiveOrder(this.orderGroup, this.renderOrder);
|
|
79
|
+
}
|
|
60
80
|
visible = true;
|
|
61
81
|
_object2D = null;
|
|
62
82
|
/** @internal The backing three object (lazily created). */
|
|
@@ -305,7 +325,7 @@ var Sprite2D = class extends Node2D {
|
|
|
305
325
|
const ax = this.anchor[0] ?? .5;
|
|
306
326
|
const ay = this.anchor[1] ?? .5;
|
|
307
327
|
quad.position.set((.5 - ax) * w, (ay - .5) * h, 0);
|
|
308
|
-
quad.renderOrder = this.
|
|
328
|
+
quad.renderOrder = this.effectiveRenderOrder;
|
|
309
329
|
mat.color.set(this.tint);
|
|
310
330
|
mat.opacity = this.opacity;
|
|
311
331
|
}
|
|
@@ -568,7 +588,7 @@ var ColorRect2D = class extends Node2D {
|
|
|
568
588
|
const ax = this.anchor[0] ?? .5;
|
|
569
589
|
const ay = this.anchor[1] ?? .5;
|
|
570
590
|
quad.position.set((.5 - ax) * w, (ay - .5) * h, 0);
|
|
571
|
-
quad.renderOrder = this.
|
|
591
|
+
quad.renderOrder = this.effectiveRenderOrder;
|
|
572
592
|
const mat = quad.material;
|
|
573
593
|
mat.color.set(this.color);
|
|
574
594
|
mat.opacity = this.opacity;
|
|
@@ -624,7 +644,7 @@ var Label = class extends Node2D {
|
|
|
624
644
|
this.rasterize();
|
|
625
645
|
}
|
|
626
646
|
quad.visible = true;
|
|
627
|
-
quad.renderOrder = this.
|
|
647
|
+
quad.renderOrder = this.effectiveRenderOrder;
|
|
628
648
|
}
|
|
629
649
|
rasterize() {
|
|
630
650
|
const dpr = Math.min(globalThis.devicePixelRatio ?? 1, 2);
|
|
@@ -666,9 +686,21 @@ const UNIT_PLANE = new PlaneGeometry(1, 1);
|
|
|
666
686
|
* Simulation is deterministic under the engine seed.
|
|
667
687
|
*/
|
|
668
688
|
var Particles2D = class Particles2D extends Node2D {
|
|
689
|
+
orderGroup = "effects";
|
|
669
690
|
static typeName = "Particles2D";
|
|
670
691
|
static signals = ["finished"];
|
|
671
692
|
static props = {
|
|
693
|
+
orderGroup: {
|
|
694
|
+
default: "effects",
|
|
695
|
+
options: [
|
|
696
|
+
"background",
|
|
697
|
+
"terrain",
|
|
698
|
+
"default",
|
|
699
|
+
"characters",
|
|
700
|
+
"effects",
|
|
701
|
+
"overlay"
|
|
702
|
+
]
|
|
703
|
+
},
|
|
672
704
|
preset: {
|
|
673
705
|
default: "custom",
|
|
674
706
|
options: ["custom", ...PARTICLE_PRESET_NAMES]
|
|
@@ -834,7 +866,7 @@ var Particles2D = class Particles2D extends Node2D {
|
|
|
834
866
|
mesh.count = index;
|
|
835
867
|
mesh.instanceMatrix.needsUpdate = true;
|
|
836
868
|
if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;
|
|
837
|
-
mesh.renderOrder = this.
|
|
869
|
+
mesh.renderOrder = this.effectiveRenderOrder;
|
|
838
870
|
}
|
|
839
871
|
};
|
|
840
872
|
const matrixScratch = new Matrix4();
|
|
@@ -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-
|
|
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";
|
|
@@ -203,13 +203,25 @@ var Node3D = class extends Node {
|
|
|
203
203
|
0,
|
|
204
204
|
0
|
|
205
205
|
] },
|
|
206
|
+
static: { default: false },
|
|
206
207
|
scale: { default: [
|
|
207
208
|
1,
|
|
208
209
|
1,
|
|
209
210
|
1
|
|
210
211
|
] },
|
|
211
212
|
visible: { default: true },
|
|
212
|
-
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
|
+
}
|
|
213
225
|
};
|
|
214
226
|
position = [
|
|
215
227
|
0,
|
|
@@ -222,6 +234,15 @@ var Node3D = class extends Node {
|
|
|
222
234
|
0,
|
|
223
235
|
0
|
|
224
236
|
];
|
|
237
|
+
/**
|
|
238
|
+
* This subtree never changes after load: the renderer syncs it ONCE and
|
|
239
|
+
* skips it every frame after (transforms, materials, animations frozen).
|
|
240
|
+
* The per-frame walk is O(nodes) — marking terrain/buildings/decor static
|
|
241
|
+
* removes most of a big scene from it. Set `static = false` to resume
|
|
242
|
+
* live syncing. Do NOT mark animated nodes (Water3D, Particles3D,
|
|
243
|
+
* AnimatedSprite3D, ModelInstance3D with clips) or cameras static.
|
|
244
|
+
*/
|
|
245
|
+
static = false;
|
|
225
246
|
scale = [
|
|
226
247
|
1,
|
|
227
248
|
1,
|
|
@@ -232,6 +253,12 @@ var Node3D = class extends Node {
|
|
|
232
253
|
* materials — three sorts the transparent pass by renderOrder, then depth.
|
|
233
254
|
* Pairs with named scene constants (e.g. `{"@const": "UI"}`) for sorting tiers. */
|
|
234
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
|
+
}
|
|
235
262
|
_object3D = null;
|
|
236
263
|
/**
|
|
237
264
|
* @internal Fixed-step render interpolation. A physics body fills these with
|
|
@@ -265,7 +292,7 @@ var Node3D = class extends Node {
|
|
|
265
292
|
o.rotation.set(MathUtils.degToRad(this.rotation[0] ?? 0), MathUtils.degToRad(this.rotation[1] ?? 0), MathUtils.degToRad(this.rotation[2] ?? 0));
|
|
266
293
|
o.scale.set(this.scale[0] ?? 1, this.scale[1] ?? 1, this.scale[2] ?? 1);
|
|
267
294
|
o.visible = this.visible;
|
|
268
|
-
o.renderOrder = this.
|
|
295
|
+
o.renderOrder = this.effectiveRenderOrder;
|
|
269
296
|
}
|
|
270
297
|
free() {
|
|
271
298
|
super.free();
|
|
@@ -1129,8 +1156,20 @@ const MAX_RESOLUTION = 128;
|
|
|
1129
1156
|
* real numbers off `heightAt`.
|
|
1130
1157
|
*/
|
|
1131
1158
|
var Terrain3D = class extends Node3D {
|
|
1159
|
+
orderGroup = "terrain";
|
|
1132
1160
|
static typeName = "Terrain3D";
|
|
1133
1161
|
static props = {
|
|
1162
|
+
orderGroup: {
|
|
1163
|
+
default: "terrain",
|
|
1164
|
+
options: [
|
|
1165
|
+
"background",
|
|
1166
|
+
"terrain",
|
|
1167
|
+
"default",
|
|
1168
|
+
"characters",
|
|
1169
|
+
"effects",
|
|
1170
|
+
"overlay"
|
|
1171
|
+
]
|
|
1172
|
+
},
|
|
1134
1173
|
size: { default: [200, 200] },
|
|
1135
1174
|
maxHeight: { default: 28 },
|
|
1136
1175
|
seed: { default: 1 },
|
|
@@ -5810,9 +5849,21 @@ const PX_TO_M = .01;
|
|
|
5810
5849
|
* tilts emission out of the plane too).
|
|
5811
5850
|
*/
|
|
5812
5851
|
var Particles3D = class Particles3D extends Node3D {
|
|
5852
|
+
orderGroup = "effects";
|
|
5813
5853
|
static typeName = "Particles3D";
|
|
5814
5854
|
static signals = ["finished"];
|
|
5815
5855
|
static props = {
|
|
5856
|
+
orderGroup: {
|
|
5857
|
+
default: "effects",
|
|
5858
|
+
options: [
|
|
5859
|
+
"background",
|
|
5860
|
+
"terrain",
|
|
5861
|
+
"default",
|
|
5862
|
+
"characters",
|
|
5863
|
+
"effects",
|
|
5864
|
+
"overlay"
|
|
5865
|
+
]
|
|
5866
|
+
},
|
|
5816
5867
|
preset: {
|
|
5817
5868
|
default: "custom",
|
|
5818
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-
|
|
3
|
-
import { t as LoadSceneOptions } from "./loader-
|
|
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 {
|
|
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-
|
|
8
|
-
import { t as registerNodes3D } from "./register-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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};
|