Stress for create networks

This commit is contained in:
2026-10-28 21:28:36 -03:00
parent a70375c9ad
commit 507e9aab24
10 changed files with 276 additions and 46 deletions
+12 -2
View File
@@ -8,8 +8,8 @@ import { ItemStack } from "$/common/inventory.ts";
import { FACING, setup, visual_for } from "./helpers.ts";
// a press at 1 101 0 along x, turned by a crank on its west side, with the floor two blocks under it
async function press_with_crank() {
const t = await setup();
async function press_with_crank(config?: Record<string, unknown>) {
const t = await setup(config);
t.place(0, 101, 0, "create:hand_crank", "facing", FACING.west);
t.place(1, 101, 0, "create:mechanical_press", "facing", FACING.east);
// holding use on the crank, which clicks it every 4 ticks
@@ -40,6 +40,16 @@ Deno.test("a turning press slams down on an ingot lying under it and presses it
assertEquals(t.lying(), { "create:iron_sheet": 1 });
});
Deno.test("an overstressed press doesn't press", async () => {
// it takes more than the crank makes
const t = await press_with_crank({
stress: { capacity: { "create:hand_crank": 1 }, impact: { "create:mechanical_press": 2 } },
});
t.ingots(1);
t.crank(200);
assertEquals(t.lying(), { "bworld:iron_ingot": 1 });
});
Deno.test("from a stack, a press presses one at a time, and each lands beside the rest", async () => {
const t = await press_with_crank();
t.ingots(3);