Fluid slots and kegs !
This commit is contained in:
@@ -9,6 +9,7 @@ import { display_name } from "$/common/utils.ts";
|
||||
import { fluid_rules } from "$/client/fluid_rules.ts";
|
||||
import { canvas, draw_text, draw_texture_region, measure_text, type Texture } from "$/client/renderer/mod.ts";
|
||||
import { AssetManager } from "$/client/assets.ts";
|
||||
import type { MenuTank } from "$/common/protocol.ts";
|
||||
import { get_sprite_region } from "$/client/sprites.ts";
|
||||
import { draw_gui_sprite, GUI_SCALE } from "./gui_sprites.ts";
|
||||
import { TEXT_HEIGHT, TEXT_SCALE } from "./widgets.ts";
|
||||
@@ -62,6 +63,19 @@ export function item_tooltip(item: ItemStack): TooltipLine[] {
|
||||
return lines;
|
||||
}
|
||||
|
||||
// a menu's fluid slot, like modern industrialization's: the fluid, how much of the tank it fills, and what clicking it
|
||||
// with a fluid container does
|
||||
export function tank_tooltip(tank: MenuTank, output: boolean): TooltipLine[] {
|
||||
return [
|
||||
tank.fluid ? { text: fluid_rules.name(tank.fluid), color: NAME_COLOR } : { text: "Empty", color: LORE_COLOR },
|
||||
{ text: `${tank.amount} / ${tank.capacity} mB`, color: FLUID_COLOR },
|
||||
{
|
||||
text: output ? "Fluid Output, Click to Extract" : "Fluid Input, Click to Insert or Extract",
|
||||
color: LORE_COLOR,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
// below and right of the mouse, moved back inside the window when it would go past its edge
|
||||
export function draw_tooltip(lines: TooltipLine[], mouse_x: number, mouse_y: number) {
|
||||
const line_height = TEXT_HEIGHT * TEXT_SCALE;
|
||||
|
||||
Reference in New Issue
Block a user