From 3d9f8c9b42d90d659d46c54c466937e2def87bcd Mon Sep 17 00:00:00 2001 From: isaisstillalive Date: Tue, 30 Jun 2020 23:15:02 +0900 Subject: [PATCH] Works with regular layer --- src/js/game/systems/chainable_splitter.js | 25 +++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/js/game/systems/chainable_splitter.js b/src/js/game/systems/chainable_splitter.js index b544b0d3..dc124b8f 100644 --- a/src/js/game/systems/chainable_splitter.js +++ b/src/js/game/systems/chainable_splitter.js @@ -15,20 +15,14 @@ export class ChainableSplitterSystem extends GameSystemWithFilter { } update() { - // Precompute effective belt speed - const effectiveBeltSpeed = this.root.hubGoals.getBeltBaseSpeed() * globalConfig.itemSpacingOnBelts; - let progressGrowth = (effectiveBeltSpeed / 0.5) * this.root.dynamicTickrate.deltaSeconds; - - if (G_IS_DEV && globalConfig.debug.instantBelts) { - progressGrowth = 1; - } + const beltSpeed = this.getBeltSpeed(); for (let i = 0; i < this.allEntities.length; ++i) { const entity = this.allEntities[i]; const splitterComp = entity.components.ChainableSplitter; // First, try to get rid of received item - this.tryEject(entity, progressGrowth); + this.tryEject(entity, beltSpeed); const item = splitterComp.inputItem; if (item === null) { @@ -115,4 +109,19 @@ export class ChainableSplitterSystem extends GameSystemWithFilter { return false; } + + /** @returns {number} */ + getBeltSpeed() { + let progressGrowth = 2 * this.root.dynamicTickrate.deltaSeconds; + + if (G_IS_DEV && globalConfig.debug.instantBelts) { + progressGrowth = 1; + } + + return ( + progressGrowth * + this.root.hubGoals.getBeltBaseSpeed(enumLayer.regular) * + globalConfig.beltItemSpacingByLayer[enumLayer.regular] + ); + } }