From d6bb79c470dd7e3f969ebc315b14472226691383 Mon Sep 17 00:00:00 2001 From: Sense101 <67970865+Sense101@users.noreply.github.com> Date: Thu, 20 Jan 2022 16:35:53 +0000 Subject: [PATCH] fixed items being too close between buildings --- src/js/game/systems/item_ejector.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/js/game/systems/item_ejector.js b/src/js/game/systems/item_ejector.js index d599d547..1e544814 100644 --- a/src/js/game/systems/item_ejector.js +++ b/src/js/game/systems/item_ejector.js @@ -163,6 +163,18 @@ export class ItemEjectorSystem extends GameSystemWithFilter { // Advance items on the slot slot.progress += progressGrowth; + // limit the progress to stop items being too close + if (slot.cachedTargetEntity && slot.cachedDestSlot) { + const acceptorComp = slot.cachedTargetEntity.components.ItemAcceptor; + const acceptorInput = acceptorComp.inputs.get(slot.cachedDestSlot.index); + + if (acceptorInput) { + const maxProgress = + 0.5 + acceptorInput.animProgress - globalConfig.itemSpacingOnBelts; + slot.progress = Math.min(maxProgress, slot.progress); + } + } + if (G_IS_DEV && globalConfig.debug.disableEjectorProcessing) { slot.progress = maxProgress; }