Fluids on the recipeviewer !

This commit is contained in:
2026-10-28 13:26:56 -03:00
parent 3cc33ea10c
commit e525681328
7 changed files with 151 additions and 83 deletions
+13 -1
View File
@@ -3,12 +3,14 @@
// reading recipes: what each one makes and takes, for any mod's recipe type, so the viewer works with recipes it has
// no category for
import type { TagApi } from "bworld/client";
import type { FluidVariant, TagApi } from "bworld/client";
// deno-lint-ignore no-explicit-any
export type Recipe = any;
// one place in a recipe: the items any of which fit, and how many
export type Ingredient = { ids: string[]; count: number };
// an amount of a fluid in mB
export type FluidAmount = { fluid: FluidVariant; amount: number };
// what a recipe makes
export function outputs(recipe: Recipe): Ingredient[] {
@@ -33,6 +35,16 @@ export function outputs(recipe: Recipe): Ingredient[] {
}
}
// the fluids a recipe makes and takes, from its "fluid_results" and "fluid_ingredients", which the viewer's own recipe
// types use, like juicing
export function fluid_outputs(recipe: Recipe): FluidAmount[] {
return recipe.fluid_results ?? [];
}
export function fluid_inputs(recipe: Recipe): FluidAmount[] {
return recipe.fluid_ingredients ?? [];
}
// what a recipe takes. shaped keys, furnace inputs and fuels can be an item or #tag, or a list any of which fits
export function inputs(recipe: Recipe, tags: TagApi): Ingredient[] {
switch (recipe.type) {