From d9bc1d91423bff04a854cff8ae64bbcf2e5b97aa Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 21 Dec 2018 11:08:10 +0100 Subject: [PATCH] Added callback for production progress --- .../Libraries.ocd/Structures.ocd/Producer.ocd/Script.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/planet/Objects.ocd/Libraries.ocd/Structures.ocd/Producer.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/Structures.ocd/Producer.ocd/Script.c index 10427390a..f09855f5f 100644 --- a/planet/Objects.ocd/Libraries.ocd/Structures.ocd/Producer.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/Structures.ocd/Producer.ocd/Script.c @@ -753,9 +753,15 @@ protected func FxProcessProductionTimer(object target, proplist effect, int time effect.Duration += effect.Interval; // Check if production time has been reached. - if (effect.Duration >= ProductionTime(effect.Product)) + var production_time = ProductionTime(effect.Product); + if (effect.Duration >= production_time) + { return FX_Execute_Kill; - + } + + // Issue a callback to the producer, where production progress of the product is indicated from 0 to 1000 + // The 1000 mark should never be reached, though, because OnProductionFinish() is called before that. + this->~OnProductionProgress(effect.Product, BoundBy(effect.Duration * 1000 / production_time, 0, 1000)); return FX_OK; }