From 686149829ee73734e40f8a926e406373155ce986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Thu, 29 Sep 2022 19:39:34 +0200 Subject: [PATCH] wake producer when producing items --- code/foundation/src/models/device.c | 1 + code/foundation/src/systems/modules/system_producer.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/code/foundation/src/models/device.c b/code/foundation/src/models/device.c index 48c1851..edea6cc 100644 --- a/code/foundation/src/models/device.c +++ b/code/foundation/src/models/device.c @@ -9,6 +9,7 @@ uint64_t device_spawn(asset_id id) { ecs_entity_t e = entity_spawn(EKIND_DEVICE); Device *dev = ecs_get_mut(world_ecs(), e, Device); + zpl_zero_item(dev); dev->asset = id; return (uint64_t)e; diff --git a/code/foundation/src/systems/modules/system_producer.c b/code/foundation/src/systems/modules/system_producer.c index 1fdad73..985aa90 100644 --- a/code/foundation/src/systems/modules/system_producer.c +++ b/code/foundation/src/systems/modules/system_producer.c @@ -44,6 +44,10 @@ void ProduceItems(ecs_iter_t *it) { d[i].progress_active = (producer[i].processed_item > 0); d[i].progress_value = 1.0f-((producer[i].process_time - game_time()) / game_rules.furnace_cook_time); + + if (d[i].progress_active) { + entity_wake(it->entities[i]); + } } }