incanto 0.50.0 → 0.52.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 +38 -2
- package/dist/2d.js +3 -3
- package/dist/3d.d.ts +4 -3
- package/dist/3d.js +4 -4
- package/dist/{behavior-62q0HWBO.d.ts → behavior-uPEuZrUB.d.ts} +47 -3
- package/dist/{create-game-BLDjy_PW.js → create-game-B_e9hJf7.js} +92 -10
- package/dist/{create-game-DqqxEax1.js → create-game-CGnoypjL.js} +6 -6
- package/dist/debug.d.ts +1 -1
- package/dist/debug.js +1 -1
- package/dist/{duplicate-CI9WF_bg.js → duplicate-B-OtSRFL.js} +1 -1
- package/dist/editor.js +1917 -1579
- package/dist/{environment-presets-XFuqu5jv.js → environment-presets-DSZwsKPs.js} +3 -3
- package/dist/{gameplay-DbaI313d.js → gameplay-B6jqvYeM.js} +163 -6
- package/dist/gameplay.d.ts +79 -2
- package/dist/gameplay.js +2 -2
- package/dist/index.d.ts +74 -5
- package/dist/index.js +7 -7
- package/dist/{loader-DwazzlQb.js → loader-B-Gft32x.js} +372 -23
- package/dist/{loader-CeyU_bm1.d.ts → loader-B9iTqs27.d.ts} +1 -1
- package/dist/net.d.ts +15 -410
- package/dist/net.js +1 -822
- package/dist/{pathfinding-C49JSNNq.d.ts → pathfinding-CAR9DjQQ.d.ts} +1 -1
- package/dist/{physics-2d-_9VBOHn6.js → physics-2d-Dns-oZlE.js} +7 -2
- package/dist/{physics-3d-DrpF5hcG.js → physics-3d-BhI0ehpe.js} +8 -3
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/{register-uvaZj1KX.js → register-DVwlnZAZ.js} +20 -266
- package/dist/{register-BNPZYJmd.js → register-Trx7WHnD.js} +3 -3
- package/dist/{registry-IyWCGe4q.js → registry-C7u42TID.js} +23 -1
- package/dist/{replay-DYdy1wb0.d.ts → replay-BU1CCM15.d.ts} +1 -1
- package/dist/{replay-j-m6lJ4W.js → replay-BicPOMX0.js} +214 -2
- package/dist/split-screen-CZ9ccBBQ.js +1267 -0
- package/dist/split-screen-paxkQs_q.d.ts +441 -0
- package/dist/{src-B3HrKuAi.js → src-5gbZO47I.js} +1 -1
- package/dist/{teardown-BKTCzLek.js → teardown-ks3d5W9n.js} +2 -1
- package/dist/{test-D16igj4C.js → test-DAojuFdb.js} +119 -22
- package/dist/test.d.ts +60 -5
- package/dist/test.js +3 -3
- package/dist/vite.js +2 -2
- package/editor/assets/{agent8-t3kl5q9K.js → agent8-CCvckvbw.js} +1 -1
- package/editor/assets/{debug-Bu3eeAlO.js → debug-CLNCOnbc.js} +1 -1
- package/editor/assets/{index-Df5g8ofT.js → index-Cb5Brupb.js} +99 -92
- package/editor/index.html +1 -1
- package/package.json +1 -1
- package/skills/incanto-assets.md +4 -1
- package/skills/incanto-building-2d-games.md +6 -1
- package/skills/incanto-editor.md +48 -11
- package/skills/incanto-gameplay-behaviors.md +14 -5
- package/skills/incanto-multiplayer.md +39 -3
- package/skills/incanto-node-reference.md +13 -0
- package/skills/incanto-save-slots.md +134 -12
- package/skills/incanto-verifying-your-game.md +56 -0
- package/templates/agent8-server.ts +79 -2
- package/templates-app/beacon-isle-3d/package.json +1 -1
- package/templates-app/tps-3d/package.json +1 -1
- package/templates-app/village-quest-3d/package.json +1 -1
- package/dist/register-CB11yp21.js +0 -374
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import {
|
|
2
|
+
import { C as diagnose } from "./loader-B-Gft32x.js";
|
|
3
3
|
import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
4
|
-
import { _ as RigidBody2D, b as validateCollider2D, g as PhysicsBody2D, h as CharacterBody2D, m as Area2D, p as Joint2D, y as Node2D } from "./register-
|
|
4
|
+
import { _ as RigidBody2D, b as validateCollider2D, g as PhysicsBody2D, h as CharacterBody2D, m as Area2D, p as Joint2D, y as Node2D } from "./register-Trx7WHnD.js";
|
|
5
5
|
import { n as registerDebugSource } from "./debug-draw-BM3DsvtT.js";
|
|
6
6
|
//#region src/2d/physics/physics-2d.ts
|
|
7
7
|
var physics_2d_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -39,6 +39,7 @@ var Physics2D = class {
|
|
|
39
39
|
world;
|
|
40
40
|
events;
|
|
41
41
|
kcc;
|
|
42
|
+
disconnectScene;
|
|
42
43
|
disconnect;
|
|
43
44
|
lastDt = 1 / 60;
|
|
44
45
|
optsGravity;
|
|
@@ -63,6 +64,9 @@ var Physics2D = class {
|
|
|
63
64
|
this.events = new R.EventQueue(true);
|
|
64
65
|
this.unregisterDebug = registerDebugSource(this);
|
|
65
66
|
this.disconnect = engine.fixedUpdated.connect((dt) => this.step(dt));
|
|
67
|
+
this.disconnectScene = engine.sceneChanged.connect(() => {
|
|
68
|
+
if (engine.scene) this.syncBodies();
|
|
69
|
+
});
|
|
66
70
|
this.syncBodies();
|
|
67
71
|
}
|
|
68
72
|
/** @internal Driven by engine.fixedUpdated. */
|
|
@@ -305,6 +309,7 @@ var Physics2D = class {
|
|
|
305
309
|
}
|
|
306
310
|
dispose() {
|
|
307
311
|
this.disconnect();
|
|
312
|
+
this.disconnectScene();
|
|
308
313
|
this.unregisterDebug();
|
|
309
314
|
this.world.free();
|
|
310
315
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import {
|
|
2
|
+
import { C as diagnose } from "./loader-B-Gft32x.js";
|
|
3
3
|
import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
4
|
-
import {
|
|
4
|
+
import { B as validateCollider3D, F as CharacterBody3D, I as PhysicsBody3D, L as RigidBody3D, P as Area3D, z as Node3D } from "./gameplay-B6jqvYeM.js";
|
|
5
5
|
import { n as registerDebugSource } from "./debug-draw-BM3DsvtT.js";
|
|
6
|
-
import { A as Terrain3D, F as InstancedMesh3D, L as buildMeshGeometry, P as Joint3D } from "./environment-presets-
|
|
6
|
+
import { A as Terrain3D, F as InstancedMesh3D, L as buildMeshGeometry, P as Joint3D } from "./environment-presets-DSZwsKPs.js";
|
|
7
7
|
import { Euler, Matrix4, Quaternion, Vector3 } from "three";
|
|
8
8
|
//#region src/3d/physics/collider-lines.ts
|
|
9
9
|
/**
|
|
@@ -234,6 +234,7 @@ var Physics3D = class {
|
|
|
234
234
|
world;
|
|
235
235
|
events;
|
|
236
236
|
kcc;
|
|
237
|
+
disconnectScene;
|
|
237
238
|
disconnect;
|
|
238
239
|
lastDt = 1 / 60;
|
|
239
240
|
optsGravity;
|
|
@@ -259,6 +260,9 @@ var Physics3D = class {
|
|
|
259
260
|
this.events = new R.EventQueue(true);
|
|
260
261
|
this.unregisterDebug = registerDebugSource(this);
|
|
261
262
|
this.disconnect = engine.fixedUpdated.connect((dt) => this.step(dt));
|
|
263
|
+
this.disconnectScene = engine.sceneChanged.connect(() => {
|
|
264
|
+
if (engine.scene) this.syncBodies();
|
|
265
|
+
});
|
|
262
266
|
this.syncBodies();
|
|
263
267
|
}
|
|
264
268
|
/** Whether the solver runs at all. False = collider outlines only. */
|
|
@@ -460,6 +464,7 @@ var Physics3D = class {
|
|
|
460
464
|
}
|
|
461
465
|
dispose() {
|
|
462
466
|
this.disconnect();
|
|
467
|
+
this.disconnectScene();
|
|
463
468
|
this.unregisterDebug();
|
|
464
469
|
this.world.free();
|
|
465
470
|
}
|
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Scene, b as Engine, n as BehaviorCtor } from "./behavior-
|
|
1
|
+
import { P as Scene, b as Engine, n as BehaviorCtor } from "./behavior-uPEuZrUB.js";
|
|
2
2
|
import { c as JsonValue } from "./schema-CFeioQRE.js";
|
|
3
3
|
import { CSSProperties, ReactNode } from "react";
|
|
4
4
|
|
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-CGnoypjL.js").then((n) => n.n)).createGame3D(o) : async (o) => (await import("./create-game-B_e9hJf7.js").then((n) => n.n)).createGame2D(o)))(opts);
|
|
160
160
|
if (disposed) {
|
|
161
161
|
next.dispose();
|
|
162
162
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as diagnose, M as Signal, S as InputMap, f as Node, g as restoreBehaviors, h as captureBehaviors, v as createSaveStore, x as resolveOrderGroups, y as ORDER_GROUP_BASE } from "./loader-B-Gft32x.js";
|
|
2
2
|
import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
3
3
|
import { t as Rng } from "./rng-DP-SR7eg.js";
|
|
4
|
-
import { l as registerNode } from "./registry-
|
|
4
|
+
import { l as registerNode } from "./registry-C7u42TID.js";
|
|
5
5
|
//#region src/core/audio/buses.ts
|
|
6
6
|
/**
|
|
7
7
|
* Global volume state — `master` × `sfx`/`music` gain (0..1) plus a `muted`
|
|
@@ -1134,267 +1134,6 @@ var LogManager = class {
|
|
|
1134
1134
|
}
|
|
1135
1135
|
};
|
|
1136
1136
|
//#endregion
|
|
1137
|
-
//#region src/core/save.ts
|
|
1138
|
-
const memoryStores = /* @__PURE__ */ new Map();
|
|
1139
|
-
function createSaveStore(namespace) {
|
|
1140
|
-
const prefix = `incanto:${namespace}:`;
|
|
1141
|
-
const local = storageOrNull();
|
|
1142
|
-
if (!local) {
|
|
1143
|
-
let mem = memoryStores.get(namespace);
|
|
1144
|
-
if (!mem) {
|
|
1145
|
-
mem = /* @__PURE__ */ new Map();
|
|
1146
|
-
memoryStores.set(namespace, mem);
|
|
1147
|
-
}
|
|
1148
|
-
const backing = mem;
|
|
1149
|
-
return {
|
|
1150
|
-
get: (key, fallback) => parse(backing.get(key), fallback),
|
|
1151
|
-
set: (key, value) => void backing.set(key, JSON.stringify(value)),
|
|
1152
|
-
remove: (key) => void backing.delete(key),
|
|
1153
|
-
clear: () => backing.clear()
|
|
1154
|
-
};
|
|
1155
|
-
}
|
|
1156
|
-
return {
|
|
1157
|
-
get: (key, fallback) => parse(local.getItem(prefix + key) ?? void 0, fallback),
|
|
1158
|
-
set: (key, value) => local.setItem(prefix + key, JSON.stringify(value)),
|
|
1159
|
-
remove: (key) => local.removeItem(prefix + key),
|
|
1160
|
-
clear: () => {
|
|
1161
|
-
const doomed = [];
|
|
1162
|
-
for (let i = 0; i < local.length; i++) {
|
|
1163
|
-
const k = local.key(i);
|
|
1164
|
-
if (k?.startsWith(prefix)) doomed.push(k);
|
|
1165
|
-
}
|
|
1166
|
-
for (const k of doomed) local.removeItem(k);
|
|
1167
|
-
}
|
|
1168
|
-
};
|
|
1169
|
-
}
|
|
1170
|
-
function parse(raw, fallback) {
|
|
1171
|
-
if (raw === void 0 || raw === null) return fallback;
|
|
1172
|
-
try {
|
|
1173
|
-
return JSON.parse(raw);
|
|
1174
|
-
} catch {
|
|
1175
|
-
return fallback;
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
function storageOrNull() {
|
|
1179
|
-
try {
|
|
1180
|
-
if (typeof localStorage === "undefined") return null;
|
|
1181
|
-
const probe = "__incanto_probe__";
|
|
1182
|
-
localStorage.setItem(probe, "1");
|
|
1183
|
-
localStorage.removeItem(probe);
|
|
1184
|
-
return localStorage;
|
|
1185
|
-
} catch {
|
|
1186
|
-
return null;
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
//#endregion
|
|
1190
|
-
//#region src/core/save-slots.ts
|
|
1191
|
-
/**
|
|
1192
|
-
* Save slots — "continue where you left off", which no game on this engine could
|
|
1193
|
-
* do.
|
|
1194
|
-
*
|
|
1195
|
-
* `createSaveStore` has been here a long time and `Scene.toJSON()` round-trips a
|
|
1196
|
-
* live tree, so two thirds of the work existed. The missing third was that
|
|
1197
|
-
* BEHAVIOR state had nowhere to go: `Behavior` declared `onEnterTree`, `onReady`,
|
|
1198
|
-
* `onExitTree`, `update` and `fixedUpdate` and nothing for "write yourself down",
|
|
1199
|
-
* so `Health.current`, `ScoreKeeper.score` and every quest flag were
|
|
1200
|
-
* unrecoverable. Both quest templates this repo ships were RPGs you could not
|
|
1201
|
-
* resume.
|
|
1202
|
-
*
|
|
1203
|
-
* ## What a save is, and what it deliberately is NOT
|
|
1204
|
-
*
|
|
1205
|
-
* A save is **which scene, plus every behavior's state, keyed by node uid**. It
|
|
1206
|
-
* is not a snapshot of the live tree.
|
|
1207
|
-
*
|
|
1208
|
-
* That is a design decision, not a shortcut. Restoring a live tree by walking
|
|
1209
|
-
* paths breaks on this engine specifically:
|
|
1210
|
-
*
|
|
1211
|
-
* - `Spawner.onReady` DETACHES its prefab template from the tree (see
|
|
1212
|
-
* `SpawnSource.resolveTemplate`), so a captured tree and a freshly booted one
|
|
1213
|
-
* legitimately disagree about which nodes exist, every time.
|
|
1214
|
-
* Every scene with a spawner would report phantom removals.
|
|
1215
|
-
* - A spawned enemy carrying its own spawner has already lost ITS template, so
|
|
1216
|
-
* re-adding that subtree runs `onReady` against a node that is not there and
|
|
1217
|
-
* throws — and `onReady` is not quarantined, so it kills the whole load.
|
|
1218
|
-
* - Prop deltas cannot be applied with `applySchemaProps`, which resets every
|
|
1219
|
-
* prop to its default before writing.
|
|
1220
|
-
*
|
|
1221
|
-
* Reloading the scene from source sidesteps all three: the structure comes from
|
|
1222
|
-
* the file (which is authoritative and already validated), and the save carries
|
|
1223
|
-
* only what the file cannot know. A fresh boot detaches the same templates the
|
|
1224
|
-
* captured one did, so there is nothing to reconcile.
|
|
1225
|
-
*
|
|
1226
|
-
* The cost, stated plainly so nobody discovers it: **spawned enemies and
|
|
1227
|
-
* mid-level positions are not restored.** You resume at the scene's start with
|
|
1228
|
-
* your stats, inventory, unlocks and quest flags intact. That is what a
|
|
1229
|
-
* checkpoint save is, and it is what both quest templates need. A game that
|
|
1230
|
-
* wants a position saves it — `serialize()` can return anything.
|
|
1231
|
-
*
|
|
1232
|
-
* Node uids are the join key because they are the one identifier the engine
|
|
1233
|
-
* already promises survives a rename or a reparent.
|
|
1234
|
-
*/
|
|
1235
|
-
/**
|
|
1236
|
-
* Every behavior in the tree that has something to say, by uid.
|
|
1237
|
-
*
|
|
1238
|
-
* A behavior with no `serialize` contributes nothing — the hook is optional in
|
|
1239
|
-
* exactly the way the other five are, so adding save support to a game is
|
|
1240
|
-
* additive and a game that never saves pays nothing.
|
|
1241
|
-
*
|
|
1242
|
-
* A node with no `uid` is skipped and reported, because state keyed by nothing
|
|
1243
|
-
* cannot be given back. The editor assigns a uid to every node it touches; a
|
|
1244
|
-
* hand-written scene may not have.
|
|
1245
|
-
*/
|
|
1246
|
-
function captureBehaviors(root) {
|
|
1247
|
-
const state = {};
|
|
1248
|
-
const unaddressable = [];
|
|
1249
|
-
const walk = (node) => {
|
|
1250
|
-
const behavior = node.behavior;
|
|
1251
|
-
if (behavior && typeof behavior.serialize === "function") {
|
|
1252
|
-
const value = behavior.serialize();
|
|
1253
|
-
if (value !== void 0) if (node.uid) state[node.uid] = value;
|
|
1254
|
-
else unaddressable.push(node.getPath());
|
|
1255
|
-
}
|
|
1256
|
-
for (const child of node.children) walk(child);
|
|
1257
|
-
};
|
|
1258
|
-
walk(root);
|
|
1259
|
-
return {
|
|
1260
|
-
state,
|
|
1261
|
-
unaddressable
|
|
1262
|
-
};
|
|
1263
|
-
}
|
|
1264
|
-
/**
|
|
1265
|
-
* Hand each behavior its state back.
|
|
1266
|
-
*
|
|
1267
|
-
* Call this AFTER the scene has loaded and `onReady` has run: `onReady` is where
|
|
1268
|
-
* a behavior sets its starting values, so restoring first would be overwritten
|
|
1269
|
-
* by the fresh start.
|
|
1270
|
-
*
|
|
1271
|
-
* Never throws on a mismatch. A save from an older build of the game will name
|
|
1272
|
-
* uids that no longer exist, and refusing to load it would mean a patch that
|
|
1273
|
-
* moves one node deletes everyone's progress. It reports instead.
|
|
1274
|
-
*/
|
|
1275
|
-
function restoreBehaviors(root, state) {
|
|
1276
|
-
const report = {
|
|
1277
|
-
missing: [],
|
|
1278
|
-
skipped: [],
|
|
1279
|
-
restored: 0
|
|
1280
|
-
};
|
|
1281
|
-
for (const [uid, value] of Object.entries(state)) {
|
|
1282
|
-
const node = root.getNodeByUid(uid);
|
|
1283
|
-
if (!node) {
|
|
1284
|
-
report.missing.push(uid);
|
|
1285
|
-
continue;
|
|
1286
|
-
}
|
|
1287
|
-
const behavior = node.behavior;
|
|
1288
|
-
if (!behavior || typeof behavior.deserialize !== "function") {
|
|
1289
|
-
report.skipped.push(uid);
|
|
1290
|
-
continue;
|
|
1291
|
-
}
|
|
1292
|
-
try {
|
|
1293
|
-
behavior.deserialize(value);
|
|
1294
|
-
report.restored += 1;
|
|
1295
|
-
} catch {
|
|
1296
|
-
report.skipped.push(uid);
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
return report;
|
|
1300
|
-
}
|
|
1301
|
-
/** Slot ids, so a "3 save slots" menu is a list and not a naming convention. */
|
|
1302
|
-
const INDEX_KEY = "slots";
|
|
1303
|
-
/**
|
|
1304
|
-
* The slot layer: a named list of saves over the existing store.
|
|
1305
|
-
*
|
|
1306
|
-
* Slot ids are yours (`'auto'`, `'1'`, `'2'`, `'3'`) — the engine does not
|
|
1307
|
-
* decide how many you have or whether one of them autosaves.
|
|
1308
|
-
*/
|
|
1309
|
-
var SaveSlots = class {
|
|
1310
|
-
store;
|
|
1311
|
-
constructor(namespace = "saves", store) {
|
|
1312
|
-
this.store = store ?? createSaveStore(namespace);
|
|
1313
|
-
}
|
|
1314
|
-
/** Slot ids that have a save, newest first. */
|
|
1315
|
-
list() {
|
|
1316
|
-
const rows = this.store.get(INDEX_KEY, []).map((id) => ({
|
|
1317
|
-
id,
|
|
1318
|
-
slot: this.read(id)
|
|
1319
|
-
})).filter((row) => row.slot !== null);
|
|
1320
|
-
rows.sort((a, b) => b.slot.savedAt - a.slot.savedAt);
|
|
1321
|
-
return rows.map((row) => row.id);
|
|
1322
|
-
}
|
|
1323
|
-
/** Every slot with its contents — what a load menu actually renders. */
|
|
1324
|
-
all() {
|
|
1325
|
-
return this.list().map((id) => ({
|
|
1326
|
-
id,
|
|
1327
|
-
...this.read(id)
|
|
1328
|
-
}));
|
|
1329
|
-
}
|
|
1330
|
-
read(id) {
|
|
1331
|
-
const raw = this.store.get(key(id), null);
|
|
1332
|
-
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return null;
|
|
1333
|
-
const slot = raw;
|
|
1334
|
-
if (typeof slot.scene !== "string" || typeof slot.state !== "object" || slot.state === null) return null;
|
|
1335
|
-
return {
|
|
1336
|
-
scene: slot.scene,
|
|
1337
|
-
state: slot.state,
|
|
1338
|
-
label: typeof slot.label === "string" ? slot.label : "",
|
|
1339
|
-
savedAt: typeof slot.savedAt === "number" ? slot.savedAt : 0,
|
|
1340
|
-
playtime: typeof slot.playtime === "number" ? slot.playtime : 0,
|
|
1341
|
-
data: slot.data ?? {}
|
|
1342
|
-
};
|
|
1343
|
-
}
|
|
1344
|
-
/**
|
|
1345
|
-
* Write a slot.
|
|
1346
|
-
*
|
|
1347
|
-
* `savedAt` is a parameter rather than `Date.now()` so a test can assert an
|
|
1348
|
-
* ordering without sleeping, and so a game that wants server time can use it.
|
|
1349
|
-
*/
|
|
1350
|
-
write(id, slot) {
|
|
1351
|
-
const full = {
|
|
1352
|
-
scene: slot.scene,
|
|
1353
|
-
state: slot.state,
|
|
1354
|
-
label: slot.label ?? "",
|
|
1355
|
-
savedAt: slot.savedAt ?? 0,
|
|
1356
|
-
playtime: slot.playtime ?? 0,
|
|
1357
|
-
data: slot.data ?? {}
|
|
1358
|
-
};
|
|
1359
|
-
this.store.set(key(id), full);
|
|
1360
|
-
const ids = this.store.get(INDEX_KEY, []);
|
|
1361
|
-
if (!ids.includes(id)) this.store.set(INDEX_KEY, [...ids, id]);
|
|
1362
|
-
}
|
|
1363
|
-
remove(id) {
|
|
1364
|
-
this.store.remove(key(id));
|
|
1365
|
-
this.store.set(INDEX_KEY, this.store.get(INDEX_KEY, []).filter((other) => other !== id));
|
|
1366
|
-
}
|
|
1367
|
-
/** Wipe every slot — a "delete all data" button, and test isolation. */
|
|
1368
|
-
clear() {
|
|
1369
|
-
for (const id of this.store.get(INDEX_KEY, [])) this.store.remove(key(id));
|
|
1370
|
-
this.store.set(INDEX_KEY, []);
|
|
1371
|
-
}
|
|
1372
|
-
};
|
|
1373
|
-
function key(id) {
|
|
1374
|
-
return `slot:${id}`;
|
|
1375
|
-
}
|
|
1376
|
-
/**
|
|
1377
|
-
* Behaviors in this tree that hold state and cannot save it — the audit's
|
|
1378
|
-
* question, answerable before a player loses an hour.
|
|
1379
|
-
*
|
|
1380
|
-
* A behavior with props but no `serialize` is not necessarily wrong (an
|
|
1381
|
-
* `Oscillate` derives everything from time), so this reports rather than warns,
|
|
1382
|
-
* and the caller decides.
|
|
1383
|
-
*/
|
|
1384
|
-
function behaviorsWithoutSave(root) {
|
|
1385
|
-
const out = [];
|
|
1386
|
-
const walk = (node) => {
|
|
1387
|
-
const behavior = node.behavior;
|
|
1388
|
-
const name = node.script?.name;
|
|
1389
|
-
if (behavior && typeof name === "string" && typeof behavior.serialize !== "function") {
|
|
1390
|
-
if (Object.keys(behaviorSchema(name)).length > 0) out.push(`${node.getPath()} (${name})`);
|
|
1391
|
-
}
|
|
1392
|
-
for (const child of node.children) walk(child);
|
|
1393
|
-
};
|
|
1394
|
-
walk(root);
|
|
1395
|
-
return out;
|
|
1396
|
-
}
|
|
1397
|
-
//#endregion
|
|
1398
1137
|
//#region src/core/settings.ts
|
|
1399
1138
|
const DEFAULTS = {
|
|
1400
1139
|
master: 1,
|
|
@@ -1890,7 +1629,7 @@ var Engine = class {
|
|
|
1890
1629
|
captureState() {
|
|
1891
1630
|
const root = this.scene?.root;
|
|
1892
1631
|
if (!root) return {};
|
|
1893
|
-
const { state, unaddressable } = captureBehaviors(root);
|
|
1632
|
+
const { state, unaddressable } = captureBehaviors(root, this.scene?.source);
|
|
1894
1633
|
for (const path of unaddressable) diagnose(this, "warn", `save: ${path} has state to save and no uid to key it under.`);
|
|
1895
1634
|
return state;
|
|
1896
1635
|
}
|
|
@@ -1900,7 +1639,9 @@ var Engine = class {
|
|
|
1900
1639
|
if (!root) return {
|
|
1901
1640
|
missing: Object.keys(state),
|
|
1902
1641
|
skipped: [],
|
|
1903
|
-
restored: 0
|
|
1642
|
+
restored: 0,
|
|
1643
|
+
expected: 0,
|
|
1644
|
+
freed: 0
|
|
1904
1645
|
};
|
|
1905
1646
|
return restoreBehaviors(root, state);
|
|
1906
1647
|
}
|
|
@@ -2399,6 +2140,19 @@ function widgetFromElement(el) {
|
|
|
2399
2140
|
let dragging = null;
|
|
2400
2141
|
/** Shared plumbing: mount into the parent HudLayer's anchor slot. */
|
|
2401
2142
|
var HudWidgetBase = class extends Node {
|
|
2143
|
+
/**
|
|
2144
|
+
* Wireable visibility: `noSave → Continue.hide`.
|
|
2145
|
+
*
|
|
2146
|
+
* `visible` is a prop, and a `connections[]` handler has to be a METHOD — the
|
|
2147
|
+
* same wall that kept a score off the screen until widgets grew `setText`. A
|
|
2148
|
+
* title screen greying out its own Continue button is the case that asked.
|
|
2149
|
+
*/
|
|
2150
|
+
show(..._args) {
|
|
2151
|
+
this.visible = true;
|
|
2152
|
+
}
|
|
2153
|
+
hide() {
|
|
2154
|
+
this.visible = false;
|
|
2155
|
+
}
|
|
2402
2156
|
static props = {
|
|
2403
2157
|
anchor: {
|
|
2404
2158
|
default: "topLeft",
|
|
@@ -3630,4 +3384,4 @@ function registerCoreNodes() {
|
|
|
3630
3384
|
registerNode(UiRenderScaleSelect);
|
|
3631
3385
|
}
|
|
3632
3386
|
//#endregion
|
|
3633
|
-
export {
|
|
3387
|
+
export { ROLLOFF_MODELS as A, AudioBuses as B, BASE_LOCALE as C, translationKey as D, suggestLocale as E, synthSfx as F, MusicManager as I, WebAudioMusicBackend as L, spatialPan as M, SFX_PRESETS as N, SfxEngine as O, SFX_PRESET_NAMES as P, crossfadeGains as R, LogManager as S, T_PREFIX as T, qualityCaps as _, UiSlider as a, readDeviceHints as b, UiButton as c, UiBanner as d, UiBar as f, Settings as g, Engine as h, UiSelect as i, spatialGain as j, isAudioContextAvailable as k, UiDialogue as l, AudioPlayer as m, UiImage as n, UiToggle as o, UiText as p, UiPanel as r, Timer as s, registerCoreNodes as t, HudLayer as u, qualityEnvironment as v, Localization as w, suggestQuality as x, qualityRendering as y, fadeGain as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as registerCoreNodes } from "./register-
|
|
1
|
+
import { b as effectiveOrder, f as Node } from "./loader-B-Gft32x.js";
|
|
2
|
+
import { t as registerCoreNodes } from "./register-DVwlnZAZ.js";
|
|
3
3
|
import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
4
4
|
import { t as Rng } from "./rng-DP-SR7eg.js";
|
|
5
|
-
import { i as getNodeSchema, l as registerNode } from "./registry-
|
|
5
|
+
import { i as getNodeSchema, l as registerNode } from "./registry-C7u42TID.js";
|
|
6
6
|
import { i as ParticleSim, n as resolveFrames, o as PARTICLE_PRESET_NAMES, r as validateAnimationAliases, s as applyParticlePreset, t as resolveAnimation } from "./sprite-animation-D_p28jwU.js";
|
|
7
7
|
import { AdditiveBlending, BufferAttribute, BufferGeometry, CanvasTexture, Color, DynamicDrawUsage, Group, InstancedMesh, MathUtils, Matrix4, Mesh, MeshBasicMaterial, NearestFilter, NormalBlending, Object3D, PlaneGeometry } from "three";
|
|
8
8
|
//#region src/2d/physics/collider-validate.ts
|
|
@@ -39,13 +39,27 @@ function getNodeType(typeName) {
|
|
|
39
39
|
const ctor = types.get(typeName);
|
|
40
40
|
if (!ctor) {
|
|
41
41
|
const registered = [...types.keys()];
|
|
42
|
-
throw new IncantoError("UNKNOWN_NODE_TYPE", `Unknown node type '${typeName}'. Registered types: [${registered.join(", ")}]
|
|
42
|
+
throw new IncantoError("UNKNOWN_NODE_TYPE", `Unknown node type '${typeName}'. Registered types: [${registered.join(", ")}].` + missingRegistrarHint(typeName), {
|
|
43
43
|
nodeType: typeName,
|
|
44
44
|
validOptions: registered
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
return ctor;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* "Unknown node type 'Node2D'" next to a list with no 2D types in it is the
|
|
51
|
+
* most confusing error this engine can produce: the type is not misspelled and
|
|
52
|
+
* not missing — a REGISTRAR was never called. Say which one.
|
|
53
|
+
*
|
|
54
|
+
* The case that produced this: the multiplayer boot registers `registerNodesNet()`
|
|
55
|
+
* and loads a 2D scene, which dies on its own root node.
|
|
56
|
+
*/
|
|
57
|
+
function missingRegistrarHint(typeName) {
|
|
58
|
+
const suffix = typeName.endsWith("2D") ? "2D" : typeName.endsWith("3D") ? "3D" : "";
|
|
59
|
+
if (!suffix || types.has(`Node${suffix}`)) return "";
|
|
60
|
+
const dim = suffix.toLowerCase();
|
|
61
|
+
return ` '${typeName}' is a ${dim} node and no ${dim} type is registered: call registerNodes${suffix}() (from 'incanto/${dim}') before loading the scene — createGame${suffix}() does it for you. Registrars compose: a multiplayer game calls registerNodes${suffix}() AND registerNodesNet().`;
|
|
62
|
+
}
|
|
49
63
|
function registeredTypes() {
|
|
50
64
|
return [...types.keys()];
|
|
51
65
|
}
|
|
@@ -123,6 +137,14 @@ function applySchemaProps(target, schema, props, label, aliases = {}, extraOptio
|
|
|
123
137
|
validatePropValue(value, def.default, `${label}.${key}`, options);
|
|
124
138
|
target[key] = jsonClone(value);
|
|
125
139
|
}
|
|
140
|
+
for (const [key, def] of Object.entries(schema)) {
|
|
141
|
+
if (!def.required) continue;
|
|
142
|
+
const value = target[key];
|
|
143
|
+
if (value === "" || value === void 0 || value === null) throw new IncantoError("PROP_TYPE_MISMATCH", `'${label}' needs a "${key}" — it is empty.`, {
|
|
144
|
+
prop: key,
|
|
145
|
+
nodeType: label
|
|
146
|
+
});
|
|
147
|
+
}
|
|
126
148
|
}
|
|
127
149
|
/**
|
|
128
150
|
* Instantiate a registered type, assign schema defaults (cloned), then the
|