From c324d0e695b692f2171afe93ffa5106a75b53a8d Mon Sep 17 00:00:00 2001 From: hexagonhexagon Date: Wed, 24 Jun 2020 22:09:05 -0400 Subject: [PATCH] Fix bug where belts' blueprintSpriteKey was never updated when rotation changed. --- src/js/game/buildings/belt_base.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/js/game/buildings/belt_base.js b/src/js/game/buildings/belt_base.js index 10174943..16b3a612 100644 --- a/src/js/game/buildings/belt_base.js +++ b/src/js/game/buildings/belt_base.js @@ -130,7 +130,25 @@ export class MetaBeltBaseBuilding extends MetaBuilding { entity.components.Belt.direction = arrayBeltVariantToRotation[rotationVariant]; entity.components.ItemEjector.slots[0].direction = arrayBeltVariantToRotation[rotationVariant]; - entity.components.StaticMapEntity.spriteKey = null; + const staticComp = entity.components.StaticMapEntity; + staticComp.spriteKey = null; + switch (arrayBeltVariantToRotation[rotationVariant]) { + case enumDirection.top: { + staticComp.blueprintSpriteKey = "sprites/blueprints/belt_top.png"; + break; + } + case enumDirection.left: { + staticComp.blueprintSpriteKey = "sprites/blueprints/belt_left.png"; + break; + } + case enumDirection.right: { + staticComp.blueprintSpriteKey = "sprites/blueprints/belt_right.png"; + break; + } + default: { + assertAlways(false, "Invalid belt rotation variant"); + } + } } /**