From c1ded81f0ea030172fcf771ed6b51f8b9ca2f364 Mon Sep 17 00:00:00 2001 From: Frode Austvik Date: Thu, 10 Dec 2020 02:53:45 +0100 Subject: [PATCH] Fix handling of bonus time in item processor Previously, the bonus time might not be applied to the next charge, but to the one after that, if it arrived before the first charge was done. --- src/js/game/systems/item_processor.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/js/game/systems/item_processor.js b/src/js/game/systems/item_processor.js index 30e56052..40ab9b85 100644 --- a/src/js/game/systems/item_processor.js +++ b/src/js/game/systems/item_processor.js @@ -91,7 +91,8 @@ export class ItemProcessorSystem extends GameSystemWithFilter { // Process next charge if (currentCharge.remainingTime > 0.0) { - currentCharge.remainingTime -= this.root.dynamicTickrate.deltaSeconds; + currentCharge.remainingTime -= this.root.dynamicTickrate.deltaSeconds + processorComp.bonusTime; + processorComp.bonusTime = 0; if (currentCharge.remainingTime > 0.0) { // This charge is not finished, so don't process the next one break; @@ -302,15 +303,10 @@ export class ItemProcessorSystem extends GameSystemWithFilter { // Queue Charge const baseSpeed = this.root.hubGoals.getProcessorBaseSpeed(processorComp.type); - const originalTime = 1 / baseSpeed; - const bonusTimeToApply = Math.min(originalTime, processorComp.bonusTime); - const timeToProcess = originalTime - bonusTimeToApply; - - processorComp.bonusTime -= bonusTimeToApply; processorComp.ongoingCharges.push({ items: outItems, - remainingTime: timeToProcess, + remainingTime: 1 / baseSpeed, }); }