dont show item proxies in item spawner

efd/v1
Dominik Madarász 2022-10-16 13:10:21 +02:00
parent a824731a15
commit 143bf1bffa
4 changed files with 14 additions and 3 deletions

View File

@ -25,7 +25,8 @@ void
ActSpawnItemPrev(void) {
while (true) {
--sel_item_id;
if (sel_item_id > 0 && item_find(sel_item_id) != ASSET_INVALID) {
item_id id = item_find_no_proxy(sel_item_id);
if (sel_item_id > 0 && id != ASSET_INVALID && (item_get_usage(id) != UKIND_PROXY)) {
break;
}
}
@ -35,7 +36,8 @@ void
ActSpawnItemNext(void) {
while (true) {
++sel_item_id;
if (sel_item_id > 0 && item_find(sel_item_id) != ASSET_INVALID) {
item_id id = item_find_no_proxy(sel_item_id);
if (sel_item_id > 0 && id != ASSET_INVALID && (item_get_usage(id) != UKIND_PROXY)) {
break;
}
}

View File

@ -7,7 +7,7 @@ static item_desc items[] = {
ITEM_INGREDIENT(ASSET_COAL, 64, ASSET_FURNACE, ASSET_BELT, 0),
ITEM_SELF(ASSET_FENCE, 64),
ITEM_ENERGY(ASSET_WOOD, ASSET_FURNACE, 64, 15.0f),
ITEM_HOLD(ASSET_TREE, 64),
ITEM_SELF(ASSET_TREE, 64),
ITEM_SELF(ASSET_TEST_TALL, 64),
// ITEM_BLUEPRINT(ASSET_BLUEPRINT, 1, 4, 4, "]]]]]CF] ]]]]]"),

View File

@ -77,6 +77,14 @@ item_id item_find(asset_id kind) {
return ASSET_INVALID;
}
item_id item_find_no_proxy(asset_id kind) {
for (item_id i=0; i<ITEMS_COUNT; i++) {
if (items[i].kind == kind)
return i;
}
return ASSET_INVALID;
}
Item *item_get_data(uint64_t ent) {
if (!world_entity_valid(ent)) return NULL;
return ecs_get_mut_if_ex(world_ecs(), ent, Item);

View File

@ -80,6 +80,7 @@ void item_despawn(uint64_t id);
// NOTE(zaklaus): items
item_id item_find(asset_id kind);
item_id item_find_no_proxy(asset_id kind);
void item_use(ecs_world_t *ecs, ecs_entity_t e, Item *it, Position p, uint64_t udata);
Item *item_get_data(uint64_t ent);
const Item *item_get_data_const(uint64_t ent);