fix producer creating extra item

efd/v1
Dominik Madarász 2022-10-16 14:35:10 +02:00
parent 3f30bb5079
commit 0f12724700
1 changed files with 3 additions and 2 deletions

View File

@ -29,12 +29,13 @@ void ProduceItems(ecs_iter_t *it) {
const Ingredient *ing = 0; const Ingredient *ing = 0;
if ((ing = ecs_get_if(it->world, item_slot_ent, Ingredient))) { if ((ing = ecs_get_if(it->world, item_slot_ent, Ingredient))) {
if (ing->producer == d->asset) { if (ing->producer == d->asset) {
producer[i].processed_item = ing->product;
producer[i].process_time = game_time() + game_rules.furnace_cook_time;
item->quantity--; item->quantity--;
if (item->quantity <= 0) { if (item->quantity <= 0) {
item_despawn(item_slot_ent); item_despawn(item_slot_ent);
storage[i].items[j] = 0; storage[i].items[j] = 0;
} else {
producer[i].processed_item = ing->product;
producer[i].process_time = game_time() + game_rules.furnace_cook_time;
} }
} }
} }