incanto 0.50.0 → 0.51.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 +3 -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-rZNfzVbH.d.ts} +37 -3
- package/dist/{create-game-DqqxEax1.js → create-game-BNaOC3Px.js} +5 -5
- package/dist/{create-game-BLDjy_PW.js → create-game-CkzKZ4v5.js} +5 -5
- package/dist/debug.d.ts +1 -1
- package/dist/{duplicate-CI9WF_bg.js → duplicate-EybyYeyL.js} +1 -1
- package/dist/{environment-presets-XFuqu5jv.js → environment-presets-C08pOC6H.js} +2 -2
- package/dist/{gameplay-DbaI313d.js → gameplay-bStgtZBV.js} +159 -4
- package/dist/gameplay.d.ts +79 -2
- package/dist/gameplay.js +2 -2
- package/dist/index.d.ts +14 -5
- package/dist/index.js +6 -6
- package/dist/{loader-DwazzlQb.js → loader-B2asghWa.js} +350 -1
- package/dist/{loader-CeyU_bm1.d.ts → loader-Dkbn56KC.d.ts} +1 -1
- package/dist/net.d.ts +1 -1
- package/dist/net.js +3 -3
- package/dist/{pathfinding-C49JSNNq.d.ts → pathfinding-Bz34pvQD.d.ts} +1 -1
- package/dist/{physics-2d-_9VBOHn6.js → physics-2d-Ccq2L9R0.js} +7 -2
- package/dist/{physics-3d-DrpF5hcG.js → physics-3d-B2c5KNYh.js} +8 -3
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/{register-BNPZYJmd.js → register-B_BaaGx-.js} +2 -2
- package/dist/{register-uvaZj1KX.js → register-CGq-Hee8.js} +19 -265
- package/dist/{register-CB11yp21.js → register-CLVhzWcI.js} +2 -2
- package/dist/{replay-j-m6lJ4W.js → replay-BgKxGcXH.js} +20 -1
- package/dist/{replay-DYdy1wb0.d.ts → replay-DIP2_as4.d.ts} +1 -1
- package/dist/{src-B3HrKuAi.js → src-C3UwzYXl.js} +1 -1
- package/dist/{test-D16igj4C.js → test-D2gRpk5V.js} +11 -11
- package/dist/test.d.ts +3 -3
- package/dist/test.js +2 -2
- package/dist/vite.js +2 -2
- package/editor/assets/{agent8-t3kl5q9K.js → agent8-DbX_msaO.js} +1 -1
- package/editor/assets/{debug-Bu3eeAlO.js → debug-C-kMxdl1.js} +1 -1
- package/editor/assets/{index-Df5g8ofT.js → index-CUc1U7wm.js} +91 -91
- package/editor/index.html +1 -1
- package/package.json +1 -1
- package/skills/incanto-building-2d-games.md +6 -1
- package/skills/incanto-node-reference.md +13 -0
- package/skills/incanto-save-slots.md +134 -12
- 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
|
@@ -640,6 +640,345 @@ function effectiveOrder(group, renderOrder, table = ORDER_GROUP_BASE) {
|
|
|
640
640
|
return (table[group] ?? 0) + renderOrder;
|
|
641
641
|
}
|
|
642
642
|
//#endregion
|
|
643
|
+
//#region src/core/save.ts
|
|
644
|
+
const memoryStores = /* @__PURE__ */ new Map();
|
|
645
|
+
function createSaveStore(namespace) {
|
|
646
|
+
const prefix = `incanto:${namespace}:`;
|
|
647
|
+
const local = storageOrNull();
|
|
648
|
+
if (!local) {
|
|
649
|
+
let mem = memoryStores.get(namespace);
|
|
650
|
+
if (!mem) {
|
|
651
|
+
mem = /* @__PURE__ */ new Map();
|
|
652
|
+
memoryStores.set(namespace, mem);
|
|
653
|
+
}
|
|
654
|
+
const backing = mem;
|
|
655
|
+
return {
|
|
656
|
+
get: (key, fallback) => parse(backing.get(key), fallback),
|
|
657
|
+
set: (key, value) => void backing.set(key, JSON.stringify(value)),
|
|
658
|
+
remove: (key) => void backing.delete(key),
|
|
659
|
+
clear: () => backing.clear()
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
return {
|
|
663
|
+
get: (key, fallback) => parse(local.getItem(prefix + key) ?? void 0, fallback),
|
|
664
|
+
set: (key, value) => local.setItem(prefix + key, JSON.stringify(value)),
|
|
665
|
+
remove: (key) => local.removeItem(prefix + key),
|
|
666
|
+
clear: () => {
|
|
667
|
+
const doomed = [];
|
|
668
|
+
for (let i = 0; i < local.length; i++) {
|
|
669
|
+
const k = local.key(i);
|
|
670
|
+
if (k?.startsWith(prefix)) doomed.push(k);
|
|
671
|
+
}
|
|
672
|
+
for (const k of doomed) local.removeItem(k);
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
function parse(raw, fallback) {
|
|
677
|
+
if (raw === void 0 || raw === null) return fallback;
|
|
678
|
+
try {
|
|
679
|
+
return JSON.parse(raw);
|
|
680
|
+
} catch {
|
|
681
|
+
return fallback;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
function storageOrNull() {
|
|
685
|
+
try {
|
|
686
|
+
if (typeof localStorage === "undefined") return null;
|
|
687
|
+
const probe = "__incanto_probe__";
|
|
688
|
+
localStorage.setItem(probe, "1");
|
|
689
|
+
localStorage.removeItem(probe);
|
|
690
|
+
return localStorage;
|
|
691
|
+
} catch {
|
|
692
|
+
return null;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
//#endregion
|
|
696
|
+
//#region src/core/save-slots.ts
|
|
697
|
+
/**
|
|
698
|
+
* Save slots — "continue where you left off", which no game on this engine could
|
|
699
|
+
* do.
|
|
700
|
+
*
|
|
701
|
+
* `createSaveStore` has been here a long time and `Scene.toJSON()` round-trips a
|
|
702
|
+
* live tree, so two thirds of the work existed. The missing third was that
|
|
703
|
+
* BEHAVIOR state had nowhere to go: `Behavior` declared `onEnterTree`, `onReady`,
|
|
704
|
+
* `onExitTree`, `update` and `fixedUpdate` and nothing for "write yourself down",
|
|
705
|
+
* so `Health.current`, `ScoreKeeper.score` and every quest flag were
|
|
706
|
+
* unrecoverable. Both quest templates this repo ships were RPGs you could not
|
|
707
|
+
* resume.
|
|
708
|
+
*
|
|
709
|
+
* ## What a save is, and what it deliberately is NOT
|
|
710
|
+
*
|
|
711
|
+
* A save is **which scene, plus every behavior's state, keyed by node uid**. It
|
|
712
|
+
* is not a snapshot of the live tree.
|
|
713
|
+
*
|
|
714
|
+
* That is a design decision, not a shortcut. Restoring a live tree by walking
|
|
715
|
+
* paths breaks on this engine specifically:
|
|
716
|
+
*
|
|
717
|
+
* - `Spawner.onReady` DETACHES its prefab template from the tree (see
|
|
718
|
+
* `SpawnSource.resolveTemplate`), so a captured tree and a freshly booted one
|
|
719
|
+
* legitimately disagree about which nodes exist, every time.
|
|
720
|
+
* Every scene with a spawner would report phantom removals.
|
|
721
|
+
* - A spawned enemy carrying its own spawner has already lost ITS template, so
|
|
722
|
+
* re-adding that subtree runs `onReady` against a node that is not there and
|
|
723
|
+
* throws — and `onReady` is not quarantined, so it kills the whole load.
|
|
724
|
+
* - Prop deltas cannot be applied with `applySchemaProps`, which resets every
|
|
725
|
+
* prop to its default before writing.
|
|
726
|
+
*
|
|
727
|
+
* Reloading the scene from source sidesteps all three: the structure comes from
|
|
728
|
+
* the file (which is authoritative and already validated), and the save carries
|
|
729
|
+
* only what the file cannot know. A fresh boot detaches the same templates the
|
|
730
|
+
* captured one did, so there is nothing to reconcile.
|
|
731
|
+
*
|
|
732
|
+
* The cost, stated plainly so nobody discovers it: **spawned enemies and
|
|
733
|
+
* mid-level positions are not restored.** You resume at the scene's start with
|
|
734
|
+
* your stats, inventory, unlocks and quest flags intact. That is what a
|
|
735
|
+
* checkpoint save is, and it is what both quest templates need. A game that
|
|
736
|
+
* wants a position saves it — `serialize()` can return anything.
|
|
737
|
+
*
|
|
738
|
+
* Node uids are the join key because they are the one identifier the engine
|
|
739
|
+
* already promises survives a rename or a reparent.
|
|
740
|
+
*/
|
|
741
|
+
/**
|
|
742
|
+
* The one key in a save that is not a uid: authored nodes the run consumed.
|
|
743
|
+
*
|
|
744
|
+
* A save reloads the scene from its FILE, so every collectible comes back —
|
|
745
|
+
* resume a collect-five-to-win run at four and there are five gems on the map
|
|
746
|
+
* again with your four still banked. No behavior can fix that from the inside:
|
|
747
|
+
* the node that knew is the node that was freed.
|
|
748
|
+
*
|
|
749
|
+
* The engine can answer it without anyone's help. A uid in the scene file that
|
|
750
|
+
* is not in the live tree is a node this run consumed. Spawned clones never
|
|
751
|
+
* carry uids (`duplicateNode` drops them so a template can never mint colliding
|
|
752
|
+
* ids), so the ledger is exactly the authored world — the part the file
|
|
753
|
+
* rebuilds. `n_` prefixes every uid, so `#` can never collide with one.
|
|
754
|
+
*/
|
|
755
|
+
const FREED_KEY = "#freed";
|
|
756
|
+
/**
|
|
757
|
+
* Every behavior in the tree that has something to say, by uid.
|
|
758
|
+
*
|
|
759
|
+
* A behavior with no `serialize` contributes nothing — the hook is optional in
|
|
760
|
+
* exactly the way the other five are, so adding save support to a game is
|
|
761
|
+
* additive and a game that never saves pays nothing.
|
|
762
|
+
*
|
|
763
|
+
* A node with no `uid` is skipped and reported, because state keyed by nothing
|
|
764
|
+
* cannot be given back. The editor assigns a uid to every node it touches; a
|
|
765
|
+
* hand-written scene may not have.
|
|
766
|
+
*/
|
|
767
|
+
function captureBehaviors(root, source) {
|
|
768
|
+
const state = {};
|
|
769
|
+
const unaddressable = [];
|
|
770
|
+
let saveable = 0;
|
|
771
|
+
const walk = (node) => {
|
|
772
|
+
const behavior = node.behavior;
|
|
773
|
+
if (behavior && typeof behavior.serialize === "function") {
|
|
774
|
+
const value = behavior.serialize();
|
|
775
|
+
if (value !== void 0) {
|
|
776
|
+
saveable += 1;
|
|
777
|
+
if (node.uid) state[node.uid] = value;
|
|
778
|
+
else unaddressable.push(node.getPath());
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
for (const child of node.children) walk(child);
|
|
782
|
+
};
|
|
783
|
+
walk(root);
|
|
784
|
+
if (source !== void 0) {
|
|
785
|
+
const alive = /* @__PURE__ */ new Set();
|
|
786
|
+
const mark = (node) => {
|
|
787
|
+
const leaving = node.tree?._isQueuedFree(node) ?? false;
|
|
788
|
+
if (node.uid && !leaving) alive.add(node.uid);
|
|
789
|
+
for (const child of node.children) mark(child);
|
|
790
|
+
};
|
|
791
|
+
mark(root);
|
|
792
|
+
const freed = authoredUids(source).filter((uid) => !alive.has(uid));
|
|
793
|
+
if (freed.length > 0) state[FREED_KEY] = freed;
|
|
794
|
+
}
|
|
795
|
+
return {
|
|
796
|
+
state,
|
|
797
|
+
unaddressable,
|
|
798
|
+
saveable
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
/** Every uid the scene FILE declares, in document order. */
|
|
802
|
+
function authoredUids(source) {
|
|
803
|
+
const out = [];
|
|
804
|
+
const walk = (node) => {
|
|
805
|
+
if (typeof node !== "object" || node === null) return;
|
|
806
|
+
const n = node;
|
|
807
|
+
if (typeof n.uid === "string" && n.uid !== "") out.push(n.uid);
|
|
808
|
+
if (Array.isArray(n.children)) for (const child of n.children) walk(child);
|
|
809
|
+
};
|
|
810
|
+
walk(source.root);
|
|
811
|
+
return out;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Hand each behavior its state back.
|
|
815
|
+
*
|
|
816
|
+
* Call this AFTER the scene has loaded and `onReady` has run: `onReady` is where
|
|
817
|
+
* a behavior sets its starting values, so restoring first would be overwritten
|
|
818
|
+
* by the fresh start.
|
|
819
|
+
*
|
|
820
|
+
* Never throws on a mismatch. A save from an older build of the game will name
|
|
821
|
+
* uids that no longer exist, and refusing to load it would mean a patch that
|
|
822
|
+
* moves one node deletes everyone's progress. It reports instead.
|
|
823
|
+
*/
|
|
824
|
+
function restoreBehaviors(root, state) {
|
|
825
|
+
const report = {
|
|
826
|
+
missing: [],
|
|
827
|
+
skipped: [],
|
|
828
|
+
restored: 0,
|
|
829
|
+
expected: captureBehaviors(root).saveable,
|
|
830
|
+
freed: 0
|
|
831
|
+
};
|
|
832
|
+
for (const [uid, value] of Object.entries(state)) {
|
|
833
|
+
if (uid === "#freed") {
|
|
834
|
+
for (const gone of value ?? []) {
|
|
835
|
+
const node = root.getNodeByUid(gone);
|
|
836
|
+
if (node) {
|
|
837
|
+
node.queueFree();
|
|
838
|
+
report.freed += 1;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
continue;
|
|
842
|
+
}
|
|
843
|
+
const node = root.getNodeByUid(uid);
|
|
844
|
+
if (!node) {
|
|
845
|
+
report.missing.push(uid);
|
|
846
|
+
continue;
|
|
847
|
+
}
|
|
848
|
+
const behavior = node.behavior;
|
|
849
|
+
if (!behavior || typeof behavior.deserialize !== "function") {
|
|
850
|
+
report.skipped.push(uid);
|
|
851
|
+
continue;
|
|
852
|
+
}
|
|
853
|
+
try {
|
|
854
|
+
behavior.deserialize(value);
|
|
855
|
+
report.restored += 1;
|
|
856
|
+
} catch {
|
|
857
|
+
report.skipped.push(uid);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
return report;
|
|
861
|
+
}
|
|
862
|
+
/** Slot ids, so a "3 save slots" menu is a list and not a naming convention. */
|
|
863
|
+
const INDEX_KEY = "slots";
|
|
864
|
+
/**
|
|
865
|
+
* The slot layer: a named list of saves over the existing store.
|
|
866
|
+
*
|
|
867
|
+
* Slot ids are yours (`'auto'`, `'1'`, `'2'`, `'3'`) — the engine does not
|
|
868
|
+
* decide how many you have or whether one of them autosaves.
|
|
869
|
+
*/
|
|
870
|
+
var SaveSlots = class {
|
|
871
|
+
store;
|
|
872
|
+
constructor(namespace = "saves", store) {
|
|
873
|
+
this.store = store ?? createSaveStore(namespace);
|
|
874
|
+
}
|
|
875
|
+
/** Slot ids that have a save, newest first. */
|
|
876
|
+
list() {
|
|
877
|
+
const rows = this.store.get(INDEX_KEY, []).map((id) => ({
|
|
878
|
+
id,
|
|
879
|
+
slot: this.read(id)
|
|
880
|
+
})).filter((row) => row.slot !== null);
|
|
881
|
+
rows.sort((a, b) => b.slot.savedAt - a.slot.savedAt);
|
|
882
|
+
return rows.map((row) => row.id);
|
|
883
|
+
}
|
|
884
|
+
/** Every slot with its contents — what a load menu actually renders. */
|
|
885
|
+
all() {
|
|
886
|
+
return this.list().map((id) => ({
|
|
887
|
+
id,
|
|
888
|
+
...this.read(id)
|
|
889
|
+
}));
|
|
890
|
+
}
|
|
891
|
+
read(id) {
|
|
892
|
+
const raw = this.store.get(key(id), null);
|
|
893
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return null;
|
|
894
|
+
const slot = raw;
|
|
895
|
+
if (typeof slot.scene !== "string" || typeof slot.state !== "object" || slot.state === null) return null;
|
|
896
|
+
return {
|
|
897
|
+
scene: slot.scene,
|
|
898
|
+
state: slot.state,
|
|
899
|
+
label: typeof slot.label === "string" ? slot.label : "",
|
|
900
|
+
savedAt: typeof slot.savedAt === "number" ? slot.savedAt : 0,
|
|
901
|
+
playtime: typeof slot.playtime === "number" ? slot.playtime : 0,
|
|
902
|
+
data: slot.data ?? {}
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Write a slot.
|
|
907
|
+
*
|
|
908
|
+
* `savedAt` is a parameter rather than `Date.now()` so a test can assert an
|
|
909
|
+
* ordering without sleeping, and so a game that wants server time can use it.
|
|
910
|
+
*/
|
|
911
|
+
write(id, slot) {
|
|
912
|
+
const full = {
|
|
913
|
+
scene: slot.scene,
|
|
914
|
+
state: slot.state,
|
|
915
|
+
label: slot.label ?? "",
|
|
916
|
+
savedAt: slot.savedAt ?? 0,
|
|
917
|
+
playtime: slot.playtime ?? 0,
|
|
918
|
+
data: slot.data ?? {}
|
|
919
|
+
};
|
|
920
|
+
this.store.set(key(id), full);
|
|
921
|
+
const ids = this.store.get(INDEX_KEY, []);
|
|
922
|
+
if (!ids.includes(id)) this.store.set(INDEX_KEY, [...ids, id]);
|
|
923
|
+
}
|
|
924
|
+
remove(id) {
|
|
925
|
+
this.store.remove(key(id));
|
|
926
|
+
this.store.set(INDEX_KEY, this.store.get(INDEX_KEY, []).filter((other) => other !== id));
|
|
927
|
+
}
|
|
928
|
+
/** Wipe every slot — a "delete all data" button, and test isolation. */
|
|
929
|
+
clear() {
|
|
930
|
+
for (const id of this.store.get(INDEX_KEY, [])) this.store.remove(key(id));
|
|
931
|
+
this.store.set(INDEX_KEY, []);
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
function key(id) {
|
|
935
|
+
return `slot:${id}`;
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Behaviors in this tree that hold state and cannot save it — the audit's
|
|
939
|
+
* question, answerable before a player loses an hour.
|
|
940
|
+
*
|
|
941
|
+
* A behavior with props but no `serialize` is not necessarily wrong (an
|
|
942
|
+
* `Oscillate` derives everything from time), so this reports rather than warns,
|
|
943
|
+
* and the caller decides.
|
|
944
|
+
*/
|
|
945
|
+
function behaviorsWithoutSave(root) {
|
|
946
|
+
const out = [];
|
|
947
|
+
const walk = (node) => {
|
|
948
|
+
const behavior = node.behavior;
|
|
949
|
+
const name = node.script?.name;
|
|
950
|
+
if (behavior && typeof name === "string" && typeof behavior.serialize !== "function") {
|
|
951
|
+
if (Object.keys(behaviorSchema(name)).length > 0) out.push(`${node.getPath()} (${name})`);
|
|
952
|
+
}
|
|
953
|
+
for (const child of node.children) walk(child);
|
|
954
|
+
};
|
|
955
|
+
walk(root);
|
|
956
|
+
return out;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Behaviors that DO save, on nodes with no uid to save them under — the state
|
|
960
|
+
* that goes nowhere.
|
|
961
|
+
*
|
|
962
|
+
* `incanto-check` warns about the built-ins it can recognise from the JSON
|
|
963
|
+
* (Health, ScoreKeeper, Collector), but a scene file cannot be asked whether
|
|
964
|
+
* YOUR behavior has a `serialize`. This can: it walks the live tree, so a quest
|
|
965
|
+
* log or a wallet of your own is named too.
|
|
966
|
+
*
|
|
967
|
+
* The pair to read before shipping: `behaviorsWithoutSave` is "did you forget
|
|
968
|
+
* to write serialize", this is "did you forget the uid that makes it count".
|
|
969
|
+
*/
|
|
970
|
+
function savesWithoutUid(root) {
|
|
971
|
+
const out = [];
|
|
972
|
+
const walk = (node) => {
|
|
973
|
+
const behavior = node.behavior;
|
|
974
|
+
const name = node.script?.name;
|
|
975
|
+
if (behavior && typeof behavior.serialize === "function" && !node.uid) out.push(`${node.getPath()} (${name ?? "behavior"})`);
|
|
976
|
+
for (const child of node.children) walk(child);
|
|
977
|
+
};
|
|
978
|
+
walk(root);
|
|
979
|
+
return out;
|
|
980
|
+
}
|
|
981
|
+
//#endregion
|
|
643
982
|
//#region src/core/node-path.ts
|
|
644
983
|
function parseNodePath(path) {
|
|
645
984
|
if (path === "") throw new IncantoError("BAD_NODE_PATH", "Node path must not be empty.");
|
|
@@ -1274,6 +1613,16 @@ var SceneTree = class SceneTree {
|
|
|
1274
1613
|
_detachRoot(node) {
|
|
1275
1614
|
if (this._root === node) this._root = null;
|
|
1276
1615
|
}
|
|
1616
|
+
/**
|
|
1617
|
+
* @internal Is this node already on its way out?
|
|
1618
|
+
*
|
|
1619
|
+
* A save taken from a `collected` handler runs BEFORE the deferred free, so
|
|
1620
|
+
* the pickup that triggered the checkpoint is still in the tree — and came
|
|
1621
|
+
* back on the next run while its score did not.
|
|
1622
|
+
*/
|
|
1623
|
+
_isQueuedFree(node) {
|
|
1624
|
+
return this.freeQueue.has(node);
|
|
1625
|
+
}
|
|
1277
1626
|
flushFreeQueue() {
|
|
1278
1627
|
if (this.freeQueue.size === 0) return;
|
|
1279
1628
|
const items = [...this.freeQueue];
|
|
@@ -1681,4 +2030,4 @@ function validateUniqueUids(root) {
|
|
|
1681
2030
|
walk(root);
|
|
1682
2031
|
}
|
|
1683
2032
|
//#endregion
|
|
1684
|
-
export {
|
|
2033
|
+
export { registerBehavior as A, InputMap as C, behaviorSignals as D, behaviorSchema as E, Signal as M, clearBehaviors as O, resolveOrderGroups as S, Behavior as T, restoreBehaviors as _, SCENE_FORMAT as a, ORDER_GROUP_BASE as b, SceneTree as c, resolveConstants as d, Node as f, captureBehaviors as g, behaviorsWithoutSave as h, serializeNode as i, registeredBehaviors as j, getBehavior as k, CONST_REF_KEY as l, SaveSlots as m, loadScene as n, computeViewport as o, parseNodePath as p, Scene as r, resolveViewport as s, buildNodeJson as t, isConstRef as u, savesWithoutUid as v, diagnose as w, effectiveOrder as x, createSaveStore as y };
|
package/dist/net.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dt as Node, Nt as Signal, b as Engine, d as PropSchema } from "./behavior-rZNfzVbH.js";
|
|
2
2
|
import { c as JsonValue, i as SceneJson, s as JsonObject } from "./schema-CFeioQRE.js";
|
|
3
3
|
|
|
4
4
|
//#region src/net/types.d.ts
|
package/dist/net.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as loadScene } from "./loader-
|
|
2
|
-
import { h as Engine } from "./register-
|
|
1
|
+
import { n as loadScene } from "./loader-B2asghWa.js";
|
|
2
|
+
import { h as Engine } from "./register-CGq-Hee8.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-
|
|
6
|
+
import { i as applySyncPatch, n as NetworkSpawner, r as NetworkManager, t as registerNodesNet } from "./register-CLVhzWcI.js";
|
|
7
7
|
//#region src/net/loopback.ts
|
|
8
8
|
/**
|
|
9
9
|
* In-memory multiplayer hub implementing the SAME kernel contract as
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import {
|
|
2
|
+
import { w as diagnose } from "./loader-B2asghWa.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-B_BaaGx-.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 { w as diagnose } from "./loader-B2asghWa.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-bStgtZBV.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-C08pOC6H.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-rZNfzVbH.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-BNaOC3Px.js").then((n) => n.n)).createGame3D(o) : async (o) => (await import("./create-game-CkzKZ4v5.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,
|
|
2
|
-
import { t as registerCoreNodes } from "./register-
|
|
1
|
+
import { f as Node, x as effectiveOrder } from "./loader-B2asghWa.js";
|
|
2
|
+
import { t as registerCoreNodes } from "./register-CGq-Hee8.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 { i as getNodeSchema, l as registerNode } from "./registry-IyWCGe4q.js";
|