fix: always merge evolutionTree/generators with defaults on load
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 21s
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 21s
Server saves don't store all node fields (branch, cost, effect, etc.). migrateSave now always rebuilds tree from DEFAULT_EVOLUTION_TREE, preserving unlocked state from the save. Fixes empty evolution tree.
This commit is contained in:
@@ -44,13 +44,7 @@
|
||||
let activeBranch = $state<Branch>('ponte');
|
||||
|
||||
let branchConfig = $derived(BRANCH_CONFIG[activeBranch]);
|
||||
let branchNodes = $derived(game.state.evolutionTree.filter((n: any) => n.branch === activeBranch));
|
||||
|
||||
// Debug — remove after fix confirmed
|
||||
$effect(() => {
|
||||
const tree = game.state.evolutionTree;
|
||||
console.log('[EvolutionTree] tree length:', tree.length, 'activeBranch:', activeBranch, 'filtered:', tree.filter((n: any) => n.branch === activeBranch).length, 'first node:', tree[0] ? { id: tree[0].id, branch: tree[0].branch } : 'empty');
|
||||
});
|
||||
let branchNodes = $derived(game.state.evolutionTree.filter((n) => n.branch === activeBranch));
|
||||
let spentDna = $derived(getSpentDna(game.state.evolutionTree));
|
||||
let hasUnlocked = $derived(spentDna > 0);
|
||||
let resetCost = $derived(getTreeResetCost(game.state));
|
||||
|
||||
Reference in New Issue
Block a user