add some impl comments

isolation
Dominik Madarász 2022-09-28 05:53:52 +00:00 committed by GitHub
parent 7aadeed518
commit b8e3decc96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -103,20 +103,18 @@ typedef struct {
} Item; } Item;
typedef struct { typedef struct {
uint64_t ent; // TODO: we now hold a ref to an item, instead of representing an item slot,
} ItemSlot; // so that we can let the item entity keep its own components and also handle merging ops on its own.
ecs_entity_t items[ITEMS_CONTAINER_SIZE];
typedef struct {
ItemSlot items[ITEMS_CONTAINER_SIZE];
float pickup_time; float pickup_time;
} Inventory; } Inventory;
typedef struct { typedef struct {
ItemSlot items[ITEMS_CONTAINER_SIZE]; ecs_entity_t items[ITEMS_CONTAINER_SIZE];
} ItemContainer; } ItemContainer;
typedef struct { typedef struct {
ItemSlot processed_item; ecs_entity_t processed_item;
float cook_time; float cook_time;
float burn_time; float burn_time;
} Furnace; } Furnace;

View File

@ -48,6 +48,11 @@ void item_show(uint64_t ent, bool show);
uint64_t item_spawn(asset_id kind, uint32_t qty); uint64_t item_spawn(asset_id kind, uint32_t qty);
void item_despawn(uint64_t id); void item_despawn(uint64_t id);
// NOTE: item ops
void item_pickup(uint64_t ent, uint64_t item);
void item_drop(uint64_t ent, uint64_t item);
void item_merge(uint64_t item1, uint64_t item2);
// NOTE(zaklaus): items // NOTE(zaklaus): items
item_id item_find(asset_id kind); item_id item_find(asset_id kind);
void item_use(ecs_world_t *ecs, ItemSlot *it, Position p, uint64_t udata); void item_use(ecs_world_t *ecs, ItemSlot *it, Position p, uint64_t udata);