From 756bcdb47313ca54fcea46f03988ccc16e6cd820 Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 6 Jul 2020 14:19:46 +0200 Subject: [PATCH] Fix tunnels entrances connecting to exits sometimes when they shouldn't --- src/js/changelog.js | 1 + src/js/game/systems/underground_belt.js | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/js/changelog.js b/src/js/changelog.js index 09af611c..98388839 100644 --- a/src/js/changelog.js +++ b/src/js/changelog.js @@ -14,6 +14,7 @@ export const CHANGELOG = [ "Updated the soundtrack again, it is now 20 minutes in total!", "Updated and added new translations (Thanks to all contributors!)", "Show confirmation when cutting area which is too expensive to get pasted again (by isaisstillalive)", + "Fix tunnels entrances connecting to exits sometimes when they shouldn't", ], }, { diff --git a/src/js/game/systems/underground_belt.js b/src/js/game/systems/underground_belt.js index 7dd4234e..f5e1b0ab 100644 --- a/src/js/game/systems/underground_belt.js +++ b/src/js/game/systems/underground_belt.js @@ -309,17 +309,17 @@ export class UndergroundBeltSystem extends GameSystemWithFilter { continue; } - if (receiverUndergroundComp.mode !== enumUndergroundBeltMode.receiver) { - // Not a receiver - continue; - } - const receiverStaticComp = potentialReceiver.components.StaticMapEntity; if (receiverStaticComp.rotation !== targetRotation) { // Wrong rotation continue; } + if (receiverUndergroundComp.mode !== enumUndergroundBeltMode.receiver) { + // Not a receiver, but a sender -> Abort to make sure we don't deliver double + break; + } + return { entity: potentialReceiver, distance: searchOffset }; }