Curios and artifacts !
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// 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", {});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user