Pressing recipes

This commit is contained in:
2026-10-15 12:32:16 -03:00
parent 74c315bdfc
commit 7faa070d83
15 changed files with 335 additions and 35 deletions
+9 -1
View File
@@ -1,10 +1,12 @@
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
// SPDX-License-Identifier: AGPL-3.0-or-later
// create's blocks that do something: so far what turns (create:kinetic) and the hand crank that turns it
// create's blocks that do something: so far what turns (create:kinetic) and the hand crank that turns it. and its
// recipe types' checks
import type { BlockRef, Id, ServerContext } from "bworld/server";
import { along, kinetic_shape, type KineticParams } from "./kinetics/connections.ts";
import { handle_added, handle_removed, type KineticWorld, type Pos, update_generated } from "./kinetics/spreading.ts";
import { PRESSING, processing_recipes } from "./recipes/processing.ts";
interface Config {
max_speed: number;
@@ -36,6 +38,12 @@ export function setup(ctx: ServerContext) {
const config: Config = ctx.config;
const world = kinetic_world(ctx, config);
// checked now, so a broken recipe stops the server rather than a press later
processing_recipes(ctx.recipes.list(PRESSING.id), PRESSING, {
expand: (choice) => ctx.tags.expand(choice),
item_exists: (id) => ctx.items.exists(id),
});
ctx.components.register_block<KineticParams>("create:kinetic", {
on_create(block) {
handle_added(world, [block.x, block.y, block.z]);