From 69bf3f0951fcecbd9761ba9e86f6f9e44d53e25e Mon Sep 17 00:00:00 2001 From: isaisstillalive Date: Fri, 10 Jul 2020 12:29:24 +0900 Subject: [PATCH] Fixed to wait when input is ready --- src/js/game/systems/item_processor.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/js/game/systems/item_processor.js b/src/js/game/systems/item_processor.js index 49b77fce..24dc2dd0 100644 --- a/src/js/game/systems/item_processor.js +++ b/src/js/game/systems/item_processor.js @@ -19,21 +19,21 @@ export class ItemProcessorSystem extends GameSystemWithFilter { const processorComp = entity.components.ItemProcessor; const ejectorComp = entity.components.ItemEjector; - // First of all, process the current recipe - processorComp.secondsUntilEject = Math.max( - 0, - processorComp.secondsUntilEject - this.root.dynamicTickrate.deltaSeconds - ); + if (processorComp.inputSlots.length >= processorComp.inputsPerCharge) { + // First of all, process the current recipe + processorComp.secondsUntilEject = Math.max( + 0, + processorComp.secondsUntilEject - this.root.dynamicTickrate.deltaSeconds + ); - if (G_IS_DEV && globalConfig.debug.instantProcessors) { - processorComp.secondsUntilEject = 0; - } + if (G_IS_DEV && globalConfig.debug.instantProcessors) { + processorComp.secondsUntilEject = 0; + } - if ( - processorComp.secondsUntilEject === 0 && // it was processed in time - processorComp.itemsToEject.length === 0 // Check if we have an empty queue and can start a new charge - ) { - if (processorComp.inputSlots.length >= processorComp.inputsPerCharge) { + if ( + processorComp.secondsUntilEject === 0 && // it was processed in time + processorComp.itemsToEject.length === 0 // Check if we have an empty queue and can start a new charge + ) { const energyConsumerComp = entity.components.EnergyConsumer; if (energyConsumerComp) { // Check if we have enough energy