Fluid handler
This commit is contained in:
@@ -15,7 +15,7 @@ import type {
|
||||
Visual,
|
||||
VisualBlock,
|
||||
} from "bworld/client";
|
||||
import type { Face } from "bworld/shared";
|
||||
import type { Face, FluidStack } from "bworld/shared";
|
||||
import {
|
||||
actual_speed,
|
||||
type Axis,
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
OPPOSITE,
|
||||
} from "./kinetics/connections.ts";
|
||||
import { BASIN_TRAVEL, head_offset, type PressShown } from "./processing/press.ts";
|
||||
import { BASIN_TANK_CAPACITY, BASIN_TANKS, type BasinTank } from "./processing/basin.ts";
|
||||
import { BASIN_TANK_CAPACITY, BASIN_TANKS } from "./processing/basin.ts";
|
||||
|
||||
// a model reaching north turned to reach each way
|
||||
const facing_turns = (model: string): Record<Face, ModelRef> => ({
|
||||
@@ -244,7 +244,7 @@ function basin_visual(block: VisualBlock, instances: Instances): Visual {
|
||||
for (const instance of shown) instance.delete();
|
||||
shown = [];
|
||||
floating = [];
|
||||
const tanks = block.get_client_data<BasinTank[]>("tanks") ?? [];
|
||||
const tanks = block.get_client_data<FluidStack[]>("tanks") ?? [];
|
||||
const total = tanks.reduce((sum, tank) => sum + tank.amount, 0);
|
||||
const full = 1 - (1 - Math.min(1, total / (BASIN_TANKS * BASIN_TANK_CAPACITY))) ** 2;
|
||||
const top = total > 0 ? 2 + 12 * full : 0;
|
||||
|
||||
Reference in New Issue
Block a user