diff --git a/code/foundation/src/ecs/components.h b/code/foundation/src/ecs/components.h index 1e26f85..346bd13 100644 --- a/code/foundation/src/ecs/components.h +++ b/code/foundation/src/ecs/components.h @@ -103,20 +103,18 @@ typedef struct { } Item; typedef struct { - uint64_t ent; -} ItemSlot; - -typedef struct { - ItemSlot items[ITEMS_CONTAINER_SIZE]; + // TODO: we now hold a ref to an item, instead of representing an item slot, + // 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]; float pickup_time; } Inventory; typedef struct { - ItemSlot items[ITEMS_CONTAINER_SIZE]; + ecs_entity_t items[ITEMS_CONTAINER_SIZE]; } ItemContainer; typedef struct { - ItemSlot processed_item; + ecs_entity_t processed_item; float cook_time; float burn_time; } Furnace; diff --git a/code/foundation/src/ents/items.h b/code/foundation/src/ents/items.h index 14dbbe3..0b2aece 100644 --- a/code/foundation/src/ents/items.h +++ b/code/foundation/src/ents/items.h @@ -48,6 +48,11 @@ void item_show(uint64_t ent, bool show); uint64_t item_spawn(asset_id kind, uint32_t qty); 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 item_id item_find(asset_id kind); void item_use(ecs_world_t *ecs, ItemSlot *it, Position p, uint64_t udata);