small recipe changes

efd/v1
Dominik Madarász 2022-10-18 11:29:27 +02:00
parent 8eec4ac470
commit d3e1f595e5
4 changed files with 7 additions and 3 deletions

View File

@ -17,7 +17,10 @@ __VA_ARGS__\
} }
static recipe recipes[] = { static recipe recipes[] = {
RECIPE(ASSET_BELT, ASSET_FURNACE, 4, R(ASSET_FENCE, 8), R(ASSET_WOOD, 2), {0}), // NOTE(zaklaus): Belt
RECIPE(ASSET_IRON_PLATES, ASSET_FURNACE, 4, R(ASSET_IRON_ORE, 1), {0}),
RECIPE(ASSET_SCREWS, ASSET_CRAFTBENCH, 8, R(ASSET_IRON_PLATES, 1), {0}),
RECIPE(ASSET_BELT, ASSET_CRAFTBENCH, 1, R(ASSET_FENCE, 1), R(ASSET_SCREWS, 4), R(ASSET_IRON_PLATES, 2), {0}),
}; };
#define MAX_RECIPES (sizeof(recipes)/sizeof(recipes[0])) #define MAX_RECIPES (sizeof(recipes)/sizeof(recipes[0]))

View File

@ -22,6 +22,7 @@ uint32_t craft__find_num_recipes_by_reagent(asset_id producer, asset_id id) {
for (int j = 0; recipes[i].reagents[j].id; ++j) { for (int j = 0; recipes[i].reagents[j].id; ++j) {
if (recipes[i].reagents[j].id == id) { if (recipes[i].reagents[j].id == id) {
++num_recipes; ++num_recipes;
break;
} }
} }
} }

View File

@ -82,7 +82,7 @@ void PushItemsOnNodes(ecs_iter_t *it) {
Item *item = item_get_data(item_slot_ent); Item *item = item_get_data(item_slot_ent);
if (!item) continue; if (!item) continue;
if (craft_is_reagent_used_in_producer(item->kind, d->asset)) { if (craft_is_reagent_used_in_producer(item->kind, d[i].asset)) {
// NOTE(zaklaus): this is an input reagent, keep it // NOTE(zaklaus): this is an input reagent, keep it
continue; continue;
} }

View File

@ -32,7 +32,7 @@ void ProduceItems(ecs_iter_t *it) {
entity_set_position(e, p[i].x, p[i].y); entity_set_position(e, p[i].x, p[i].y);
producer[i].processed_item = 0; producer[i].processed_item = 0;
} else { } else {
producer[i].processed_item = craft_perform_recipe(storage[i].items, d->asset, &producer[i].processed_item_qty); producer[i].processed_item = craft_perform_recipe(storage[i].items, d[i].asset, &producer[i].processed_item_qty);
producer[i].process_time = game_time() + game_rules.furnace_cook_time; producer[i].process_time = game_time() + game_rules.furnace_cook_time;
} }
} }