]> git.lizzy.rs Git - dungeon_game.git/blob - plugins/inventory/inventory.h
Add on_create callback for items
[dungeon_game.git] / plugins / inventory / inventory.h
1 #ifndef _INVENTORY_H_
2 #define _INVENTORY_H_
3 #include "../game/game.h"
4
5 struct itemstack
6 {
7         struct item *item;
8         int count;
9         void *meta;
10 };
11
12 struct item
13 {
14         char *name;
15         bool stackable;
16
17         bool (*on_use)(struct itemstack *stack);
18         void (*on_destroy)(struct itemstack *stack);
19         void (*on_create)(struct itemstack *stack);
20 };
21
22 struct inventory
23 {
24         struct list *stacks;
25 };
26
27 void inventory_add(struct inventory *self, struct itemstack stack);
28 bool inventory_remove(struct inventory *self, struct item *item);
29
30 extern struct inventory player_inventory;
31 #endif