Files
bworld/mods/curios/scripts/client.ts
T
2026-09-30 15:22:32 -03:00

22 lines
659 B
TypeScript

// the curios button next to every inventory screen, or G like curios' keybind, asks the server to show the slots
import type { ClientContext } from "bworld/client";
import { active_slots } from "./slots.ts";
const GAP = 16;
const WIDTH = 120;
const HEIGHT = 32;
export function setup(ctx: ClientContext) {
// no item goes in any slot, so there's nothing to show
if (active_slots(ctx.tags).length === 0) return;
ctx.ui.add_inventory_overlay({
on_render(g, screen) {
const clicked = g.button("Curios", screen.x - WIDTH - GAP, screen.y, WIDTH, HEIGHT);
if (clicked || g.key_pressed("KeyG")) {
ctx.net.send("curios:open", {});
}
},
});
}