From 0bac871eba09c43c79964288be2c14d693068c2e Mon Sep 17 00:00:00 2001 From: EmeraldBlock Date: Mon, 28 Jun 2021 16:57:58 -0500 Subject: [PATCH] use closest output as item --- src/js/game/hud/parts/wires_overlay.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/game/hud/parts/wires_overlay.js b/src/js/game/hud/parts/wires_overlay.js index f493826f..256abf19 100644 --- a/src/js/game/hud/parts/wires_overlay.js +++ b/src/js/game/hud/parts/wires_overlay.js @@ -108,6 +108,7 @@ export class HUDWiresOverlay extends BaseHUDPart { // Go over all slots and see if they are close to mouse or not const pinSlots = pinComp.slots; + let minLength = Infinity; for (let i = 0; i < pinSlots.length; ++i) { const slot = pinSlots[i]; @@ -127,7 +128,8 @@ export class HUDWiresOverlay extends BaseHUDPart { const length = mouseTilePos.sub(valueSpritePos).length(); // If it is closer than 8 we can copy that value - if (length <= 8) { + if (length < minLength) { + minLength = length; value = slot.value; } }