Remove the Refiner and Stone cutter; old saves refund them on load (t4)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+22
-18
@@ -1,4 +1,4 @@
|
||||
// Pipes, pumps and outlets move liquids; the Refiner grinds waste rock for trace ore.
|
||||
// Pipes, pumps and outlets move liquids; the Grinder grinds waste rock for trace ore.
|
||||
const { load, suite, flatWorld, count } = require('./harness');
|
||||
const { run } = load();
|
||||
const { check, done } = suite();
|
||||
@@ -73,29 +73,33 @@ check('water flows through a run of pipe', count(run, run('WATER'), 64, 70, 87,
|
||||
box(60, 64, 63, 70, 'SAND', 0); run('for (let k = 0; k < 300; k++) simTick();');
|
||||
check('and sand dropped on a pipe falls down through it', count(run, run('SAND'), 40, 80, 87, 99) > 20, `${count(run, run('SAND'), 40, 80, 87, 99)} of 28 at the bottom`);
|
||||
|
||||
// ---- the Refiner
|
||||
function refinerRig(feed, n) {
|
||||
// ---- the Grinder
|
||||
function grinderRig() {
|
||||
flatWorld(run, 240, 160, 100);
|
||||
run(`money = 5000; bot.x = 110; bot.y = 40; stats.refined = 0; stats.refinedOre = 0; placeMachineAt('refiner', 0, 26, 15);`); // x 104..115, y 60..71; chute out at y 72
|
||||
run(`{ let k = 0; for (let y = 60; y < 70 && k < ${n}; y++) for (let x = 106; x < 114 && k < ${n}; x++, k++) setCell(y * W + x, ${feed}, AMB[y], 0); }`);
|
||||
run('money = 5000; stats.refined = 0; stats.refinedOre = 0; placeBlock(BP_GRIND, 0, 26, 15, true);');
|
||||
}
|
||||
refinerRig('RSTONE', 80);
|
||||
function grind(feed, n) {
|
||||
run(`for (let k = 0; k < ${n}; k++) {
|
||||
setCell(59 * W + 104, ${feed}, AMB[59], 0); stamp[59 * W + 104] = 0;
|
||||
for (let t = 0; t < 4; t++) { tick++; tickStamp++; procBlocksTick(); }
|
||||
for (let t = 0; t < 12; t++) simTick();
|
||||
}`);
|
||||
}
|
||||
grinderRig(); grind('RSTONE', 400);
|
||||
const ore = () => count(run, run('CUORE')) + count(run, run('COAL')) + count(run, run('FEORE')) + count(run, run('SNORE'));
|
||||
// five hopper-loads, each ground before the next goes in
|
||||
for (let k = 0; k < 5; k++) { run('for (let k = 0; k < 300; k++) simTick();'); if (k < 4) run('for (let y = 60; y < 70; y++) for (let x = 106; x < 114; x++) setCell(y * W + x, RSTONE, AMB[y], 0);'); }
|
||||
const fed = 400, sand = count(run, run('SAND')), o = ore();
|
||||
check('the Refiner grinds all the stone rubble it is fed', count(run, run('RSTONE')) === 0 && run('stats.refined') === fed, `${count(run, run('RSTONE'))} left, ${run('stats.refined')} of ${fed} ground`);
|
||||
check('the Grinder grinds all the stone rubble it is fed', count(run, run('RSTONE')) === 0 && run('stats.refined') === fed, `${count(run, run('RSTONE'))} left, ${run('stats.refined')} of ${fed} ground`);
|
||||
check('about half as much sand comes out', sand > fed * 0.35 && sand < fed * 0.6, `${sand} sand from ${fed} rubble`);
|
||||
check('with the odd grain of common ore', o > 0 && o < fed * 0.15, `${o} ore grains`);
|
||||
// gravel, sand and dirt are refined too; ore drops straight through
|
||||
refinerRig('LDIRT', 60); run('for (let k = 0; k < 600; k++) simTick();');
|
||||
check('dirt goes through the refiner too', count(run, run('LDIRT')) === 0 && run('stats.refined') === 60);
|
||||
refinerRig('CUORE', 30); run('for (let k = 0; k < 400; k++) simTick();');
|
||||
check('ore it cannot grind drops straight through, all of it', count(run, run('CUORE')) === 30 && count(run, run('CUORE'), 104, 60, 115, 71) === 0, count(run, run('CUORE'), 104, 60, 115, 71));
|
||||
// a blocked chute stops it
|
||||
refinerRig('RSTONE', 40);
|
||||
box(100, 72, 120, 73, 'STONE');
|
||||
run('for (let k = 0; k < 200; k++) simTick();');
|
||||
check('with the space under its chute blocked it stops, and says so', count(run, run('RSTONE')) === 40 && run("machines.find(m => m && m.type === 'refiner').blocked") === true);
|
||||
grinderRig(); grind('LDIRT', 60);
|
||||
check('dirt goes through the Grinder too', count(run, run('LDIRT')) === 0 && run('stats.refined') === 60);
|
||||
grinderRig(); grind('CUORE', 30);
|
||||
check('ore it cannot grind drops straight through, all of it', count(run, run('CUORE')) === 30 && count(run, run('CUORE'), 104, 59, 107, 63) === 0, count(run, run('CUORE'), 104, 59, 107, 63));
|
||||
// a blocked outlet stops it
|
||||
grinderRig();
|
||||
box(104, 64, 107, 65, 'STONE');
|
||||
run('setCell(59 * W + 104, RSTONE, AMB[59], 0); stamp[59 * W + 104] = 0; for (let k = 0; k < 8; k++) { tick++; tickStamp++; procBlocksTick(); }');
|
||||
check('with the space under its outlet blocked it stops, and says so', count(run, run('RSTONE')) === 1 && run('procState.get(15 * BW + 26).blocked') === true);
|
||||
|
||||
done();
|
||||
|
||||
+20
-9
@@ -1,4 +1,4 @@
|
||||
// Uses for waste rock and sand: glass bricks from a fan furnace, the stone cutter, the silo and
|
||||
// Uses for waste rock and sand: glass bricks from a fan furnace, the Saw, the silo and
|
||||
// builders' orders.
|
||||
const { load, suite, flatWorld, count } = require('./harness');
|
||||
const { run } = load();
|
||||
@@ -31,15 +31,11 @@ check('opening space below drops glass bricks', bars(run('BARGL')) >= 2 && run('
|
||||
check('glass bricks sell for much more than the sand in them', run('PRICE[BARGL]') >= 8 * run('PRICE[SAND]') * 10, run('PRICE[BARGL]'));
|
||||
check('glass in a bit mold is too brittle to make a bit', run("METAL_TIER[GLASS]") === 0);
|
||||
|
||||
// ---- the stone cutter: 8 rubble to a stone brick; other grains drop through
|
||||
// ---- Saw bricks ride a belt and build walls
|
||||
flatWorld(run, 240, 160, 100);
|
||||
run("money = 9999; bot.x = 60; bot.y = 40; stats.bricks = 0; placeMachineAt('cutter', 0, 26, 18); for (let bx = 24; bx <= 34; bx++) placeBlock(BP_BELT, 1, bx, 21, true);"); // x 104..111, y 72..79; out at y 80, onto a belt
|
||||
run('for (let y = 72; y < 77; y++) for (let x = 106; x < 110; x++) setCell(y * W + x, RSTONE, AMB[y], 0);'); // 20 grains
|
||||
for (let k = 0; k < 4; k++) { run('for (let k = 0; k < 150; k++) simTick();'); run('for (let y = 72; y < 77; y++) for (let x = 106; x < 110; x++) if (mat[y * W + x] === EMPTY) setCell(y * W + x, RSTONE, AMB[y], 0);'); }
|
||||
run('for (let k = 0; k < 300; k++) simTick();');
|
||||
const fed = run('stats.bricks') * 8 + run("machines.find(m => m && m.type === 'cutter').cut");
|
||||
check('the stone cutter turns every 8 rubble into a stone brick', bars(run('BARSB')) === run('stats.bricks') && run('stats.bricks') >= 8 && count(run, run('RSTONE'), 104, 72, 111, 79) === 0, `${bars(run('BARSB'))} bricks from ${fed} rubble`);
|
||||
check('and they ride a belt away from under it', run('ents.filter(e => e.m === BARSB && e.ix > 120).length') >= 3, run('JSON.stringify(ents.filter(e => e.m === BARSB).map(e => e.ix))'));
|
||||
run("money = 9999; bot.x = 60; bot.y = 40; stats.bricks = 0; placeBlock(BP_SAW, 0, 26, 19, true); for (let bx = 24; bx <= 34; bx++) placeBlock(BP_BELT, 1, bx, 21, true);");
|
||||
run('for (let k = 0; k < 100; k++) { setCell(75 * W + 104, RSTONE, AMB[75], 0); stamp[75 * W + 104] = 0; for (let t = 0; t < 4; t++) { tick++; tickStamp++; procBlocksTick(); } for (let t = 0; t < 10; t++) simTick(); } for (let k = 0; k < 300; k++) simTick();');
|
||||
check('Saw bricks ride a belt away from under it', run('ents.filter(e => e.m === BARSB && e.ix > 120).length') >= 3, run('JSON.stringify(ents.filter(e => e.m === BARSB).map(e => e.ix))'));
|
||||
check('stone bricks build cut stone walls, 2 a block', run('WALL_OF[BARSB]') === run('CUTST') && JSON.stringify(run('wallCost(BARSB, 16)')) === JSON.stringify([[run('BARSB'), 2]]));
|
||||
check('cut stone stands more heat than rough stone', run('MELT[CUTST]') > run('MELT[STONE]'));
|
||||
run('bag[BARSB] = 4; bagTotal = 4; placeBlock(BP_WALL, BARSB, 10, 20, false);');
|
||||
@@ -100,6 +96,21 @@ hopper('BP_SAW'); feedHopper('RSTONE', 3);
|
||||
run('(() => { const s = serializeWorld(); deserializeWorld(s.meta, s.buffers); })(); procBlocksTick();');
|
||||
check('loading rebuilds processors and drops partial brick state', run('procBlocks.length === 1 && procState.get(18*BW+20).cut === 0 && SAVE_VERSION === 2'));
|
||||
|
||||
// ---- removed machines in old saves are refunded and leave no hull or machine ids
|
||||
flatWorld(run, 240, 160, 100);
|
||||
run("money = 1000; addMachine('fan', 10, 10, 0); placeDock(160);");
|
||||
for (const [type, refund] of [['refiner', 120], ['cutter', 90], ['unknown', 0]]) {
|
||||
const result = run(`(() => {
|
||||
const saved = serializeWorld(), meta = JSON.parse(JSON.stringify(saved.meta));
|
||||
const before = machines.filter(Boolean).length, cash = money;
|
||||
meta.machines.push({ type: '${type}', bx: 20, by: 10, dir: 0, on: true });
|
||||
saved.buffers.mat[40 * W + 80] = HULL;
|
||||
deserializeWorld(meta, saved.buffers);
|
||||
return [machines.filter(Boolean).length === before, money - cash, mat[40 * W + 80] === EMPTY && mach[40 * W + 80] === 0];
|
||||
})()`);
|
||||
check(`loading a saved ${type} skips it and refunds exactly $${refund}`, result[0] && result[1] === refund && result[2], result);
|
||||
}
|
||||
|
||||
// ---- builders' orders: bulk rubble, gravel and stone bricks at a few times a tiny price
|
||||
flatWorld(run, 240, 160, 100);
|
||||
run('seen[RSTONE] = 1; seen[GRAVEL] = 1; seen[BARSB] = 1; orders = []; ordersDone = 0;');
|
||||
|
||||
Reference in New Issue
Block a user