Juices on the mechanical press !

This commit is contained in:
2026-10-31 00:03:03 -03:00
parent 3734f5707a
commit 23d02c5229
11 changed files with 381 additions and 62 deletions
+11 -6
View File
@@ -27,7 +27,7 @@ import {
type KineticShape,
OPPOSITE,
} from "./kinetics/connections.ts";
import { head_offset, type PressShown } from "./processing/press.ts";
import { BASIN_TRAVEL, head_offset, type PressShown } from "./processing/press.ts";
import { BASIN_TANK_CAPACITY, BASIN_TANKS, type BasinTank } from "./processing/basin.ts";
// a model reaching north turned to reach each way
@@ -170,7 +170,8 @@ export function setup(ctx: ClientContext) {
},
on_frame(time) {
since ??= time;
const now = shown ? head_offset(shown.steps + (time - since) * shown.rate) : 0;
const travel = shown?.basin ? BASIN_TRAVEL : 1;
const now = shown ? head_offset(shown.steps + (time - since) * shown.rate) * travel : 0;
if (now === offset) return;
offset = now;
head.set_transform([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, -offset, 0, 1]);
@@ -231,9 +232,9 @@ function should_offset(axis: Axis, { x, y, z }: VisualBlock) {
// a basin's items are a copy more for every this many
const BASIN_ITEMS_A_COPY = 8;
// what's in a basin, by its "tanks" and "items" client data (see register_basin in server.ts), like BasinRenderer. its
// fluids fill the 12 pixels inside its walls side by side, as wide as their share of it, and as high as all of them
// make it, filling faster at first. its items lie in a ring over the fluid, tipped over and turned toward the middle,
// what's in a basin, by its "tanks", "items" and "outputs" client data (see register_basin in server.ts), like
// BasinRenderer. its fluids fill the 12 pixels inside its walls side by side, as wide as their share of it, and as high
// as all of them make it, filling faster at first. its items lie in a ring over the fluid, tipped over and turned toward the middle,
// one in the middle when it's alone, and bob up and down while there's fluid
function basin_visual(block: VisualBlock, instances: Instances): Visual {
let shown: Instance[] = [];
@@ -256,7 +257,11 @@ function basin_visual(block: VisualBlock, instances: Instances): Visual {
x += width;
}
const items = block.get_client_data<ItemStack[]>("items") ?? [];
// what's going in and what recipes made, together
const items = [
...block.get_client_data<ItemStack[]>("items") ?? [],
...block.get_client_data<ItemStack[]>("outputs") ?? [],
];
const level = Math.min(0.6, Math.max(0.125, top / 16 - 0.3));
const radius = items.length === 1 ? 0 : 0.125;
const random = seeded(block.x * 961 + block.y * 31 + block.z);