From ed206363f2be6a260f07a1b0f8048d920927b89e Mon Sep 17 00:00:00 2001 From: tobspr Date: Sat, 19 Sep 2020 10:45:55 +0200 Subject: [PATCH] Fix crash in potato mode --- src/js/game/belt_path.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/game/belt_path.js b/src/js/game/belt_path.js index 76031825..a5c3e59c 100644 --- a/src/js/game/belt_path.js +++ b/src/js/game/belt_path.js @@ -1233,9 +1233,10 @@ export class BeltPath extends BasicSerializableObject { this.entityPath.length - 1 ); const medianBelt = this.entityPath[medianBeltIndex]; + const beltComp = medianBelt.components.Belt; const staticComp = medianBelt.components.StaticMapEntity; - const centerPosLocal = medianBelt.components.Belt.transformBeltToLocalSpace( - this.entityPath.length % 2 === 0 ? 1 : 0.5 + const centerPosLocal = beltComp.transformBeltToLocalSpace( + this.entityPath.length % 2 === 0 ? beltComp.getEffectiveLengthTiles() : 0.5 ); const centerPos = staticComp.localTileToWorld(centerPosLocal).toWorldSpaceCenterOfTile();