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();
|
||||
|
||||
Reference in New Issue
Block a user