Remove conversions for old saves (t83)

This commit is contained in:
2026-10-29 21:59:40 -04:00
parent 78eeb86171
commit f88035a58f
6 changed files with 40 additions and 22 deletions
+2 -2
View File
@@ -199,9 +199,9 @@ run('clearAllGhosts(); pasteGhost(flipBlueprint(copyRegion(120, 100, 123, 103)),
check('pasting it builds a filter with the same materials and mode', run('blockP[25*BW+34]') === run('BP_FILTER') && run('JSON.stringify(filterInfo(25*BW+34))') === JSON.stringify({ m: [run('CUORE'), run('FEORE')].sort((a, b) => a - b), inv: 1 }), run('JSON.stringify(filterInfo(25*BW+34))'));
run('globalThis.__s = serializeWorld(); deserializeWorld(__s.meta, __s.buffers);');
check('save and load keep filters, their materials, mode and direction', run('blockP[25*BW+30]') === run('BP_FILTER') && run('blockV[25*BW+30]') === 128 && run('filterInfo(25*BW+30).inv') === 1 && run('filterInfo(25*BW+30).m.length') === 2 && run('part[100*W+120]') === run('P_FILTER'));
// a save from before: one material kept in the block variant
// A retired single-material variant is no longer reconstructed on load.
run('__s.meta.filters = []; __s.buffers.blockV[25*BW+30] = 128 | SAND; deserializeWorld(__s.meta, __s.buffers);');
check('older filters keep the one material they had', run('JSON.stringify(filterInfo(25*BW+30))') === JSON.stringify({ m: [run('SAND')], inv: 0 }) && run('blockV[25*BW+30]') === 128);
check('loading does not reconstruct retired single-material filters', run('!filterCfg.has(25*BW+30) && blockV[25*BW+30] === (128 | SAND)'));
// the run of matching filters in a row
fresh();
run('for (let bx = 20; bx < 26; bx++) placeBlock(BP_FILTER, 128, bx, 25, true, { m: [SAND] }); placeBlock(BP_FILTER, 128, 26, 25, true, { m: [COAL] }); placeBlock(BP_FILTER, 0, 27, 25, true, { m: [COAL] });');
+23
View File
@@ -51,6 +51,29 @@ for (const [label, doctor, clean] of [
})()`));
}
// Retired save formats are no longer translated into current construction or trees.
flatWorld(run, 256, 256, 200);
run(`
placeBlock(BP_FILTER, 128, 5, 10, true, { m: [SAND, COAL], inv: 1 });
placeBlock(BP_PIPE, 0, 8, 10, true);
bgm[100 * W + 40] = LEAVES;
globalThis.currentSave = serializeWorld();
deserializeWorld(currentSave.meta, currentSave.buffers);
`);
check('current filter settings and direction survive loading', run('blockV[10 * BW + 5] === 128 && JSON.stringify(filterCfg.get(10 * BW + 5)) === JSON.stringify(filterRec({ m: [SAND, COAL], inv: 1 }))'));
check('current thin pipes and background trees survive loading', run('part[40 * W + 32] === P_PIPE && mat[40 * W + 32] === EMPTY && bgm[100 * W + 40] === LEAVES'));
run(`
currentSave.meta.filters = [];
currentSave.buffers.blockV[10 * BW + 5] = 128 | SAND;
delete currentSave.buffers.bgm;
currentSave.buffers.mat[100 * W + 40] = LEAVES;
currentSave.buffers.mat[110 * W + 40] = WOOD;
currentSave.buffers.flags[110 * W + 40] = F_NAT;
deserializeWorld(currentSave.meta, currentSave.buffers);
`);
check('loading does not invent a filter setting from its old block variant', run('!filterCfg.has(10 * BW + 5) && blockV[10 * BW + 5] === (128 | SAND)'));
check('loading does not move foreground trees into a missing background layer', run('mat[100 * W + 40] === LEAVES && mat[110 * W + 40] === WOOD && flags[110 * W + 40] === F_NAT && bgm[100 * W + 40] === EMPTY && bgm[110 * W + 40] === EMPTY'));
flatWorld(run, 1024, 256, 200);
run(`
bot.x = 510; bot.y = 170;
+2 -2
View File
@@ -8,9 +8,9 @@ const rainInAir = (m) => run(`flyers.filter(f => f.rain && f.m === ${m}).length`
run('generateWorld(777, 1024, 640, null)');
check('new worlds have no springs', count(run, run('SPRING')) === 0);
check('and the same seed still makes the same land', run('surfY[512]') > 0 && run('!!dock()'));
// an older save with a spring in it: the spring becomes plain rock
// Loading no longer converts retired spring cells to rock.
run('globalThis.__s = serializeWorld(); __s.buffers.mat[300 * W + 500] = SPRING; deserializeWorld(__s.meta, __s.buffers);');
check('springs in older worlds turn into plain rock', run('mat[300 * W + 500]') === run('STONE') && count(run, run('SPRING')) === 0);
check('loading leaves retired spring cells unchanged', run('mat[300 * W + 500]') === run('SPRING') && count(run, run('SPRING')) === 1);
// steam in the open sky rises into the clouds instead of condensing
flatWorld(run, 320, 200, 120);