From ea375e92e31147e605f64904053203e7463557fe Mon Sep 17 00:00:00 2001 From: Sense101 <67970865+Sense101@users.noreply.github.com> Date: Thu, 15 Apr 2021 22:12:38 +0100 Subject: [PATCH] fixed the belt reader --- src/js/game/systems/belt_reader.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/js/game/systems/belt_reader.js b/src/js/game/systems/belt_reader.js index fbd00b6c..14518181 100644 --- a/src/js/game/systems/belt_reader.js +++ b/src/js/game/systems/belt_reader.js @@ -24,11 +24,15 @@ export class BeltReaderSystem extends GameSystemWithFilter { } pinsComp.slots[1].value = readerComp.lastItem; - pinsComp.slots[0].value = - (readerComp.lastItemTimes[readerComp.lastItemTimes.length - 1] || 0) > - minimumTimeForThroughput - ? BOOL_TRUE_SINGLETON - : BOOL_FALSE_SINGLETON; + if( (readerComp.lastItemTimes[readerComp.lastItemTimes.length - 1] || 0) > + minimumTimeForThroughput) { + pinsComp.slots[0].value = BOOL_TRUE_SINGLETON; + } else { + pinsComp.slots[0].value = BOOL_FALSE_SINGLETON; + if(entity.components.ItemEjector.canEjectOnSlot(0)) { + readerComp.lastItem = null; + } + } if (now - readerComp.lastThroughputComputation > 0.5) { // Compute throughput @@ -46,10 +50,15 @@ export class BeltReaderSystem extends GameSystemWithFilter { } throughput = 1 / (averageSpacing / averageSpacingNum); + const decimal = throughput - Math.floor(throughput); + if(decimal > 0.8) + { + throughput = Math.round(throughput); + } } readerComp.lastThroughput = Math.min(globalConfig.beltSpeedItemsPerSecond * 23.9, throughput); } } } -} +} \ No newline at end of file