Change whole gui system
This commit is contained in:
@@ -107,3 +107,16 @@ export function copy_dir(from: string, to: string) {
|
||||
Deno.copyFileSync(from, to);
|
||||
}
|
||||
}
|
||||
|
||||
// menus, see server/game/menu.ts. menu 0 is the player's inventory (slots 0-35) and crafting grid (36-45)
|
||||
// deno-lint-ignore no-explicit-any
|
||||
type Msg = any;
|
||||
|
||||
// the last menu opened among messages
|
||||
export const opened_menu = (messages: Msg[]) => messages.findLast((m) => m.type === "open_menu");
|
||||
|
||||
// what the open menu's slots last held among messages, by menu slot index
|
||||
export const menu_items = (messages: Msg[]) => messages.findLast((m) => m.type === "menu_content")?.items;
|
||||
|
||||
// what the open menu's data last was among messages
|
||||
export const menu_data = (messages: Msg[]) => messages.findLast((m) => m.type === "menu_data")?.data;
|
||||
|
||||
Reference in New Issue
Block a user