diff --git a/src/js/game/buildings/belt_base.js b/src/js/game/buildings/belt_base.js index b662ea77..10174943 100644 --- a/src/js/game/buildings/belt_base.js +++ b/src/js/game/buildings/belt_base.js @@ -22,6 +22,10 @@ export class MetaBeltBaseBuilding extends MetaBuilding { return "#777"; } + getHasDirectionLockAvailable() { + return true; + } + /** * @param {GameRoot} root * @param {string} variant diff --git a/src/js/game/buildings/underground_belt.js b/src/js/game/buildings/underground_belt.js index 6d24267b..85679b05 100644 --- a/src/js/game/buildings/underground_belt.js +++ b/src/js/game/buildings/underground_belt.js @@ -38,6 +38,10 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding { return true; } + getHasDirectionLockAvailable() { + return true; + } + getStayInPlacementMode() { return true; } diff --git a/src/js/game/hud/parts/building_placer.js b/src/js/game/hud/parts/building_placer.js index 68f1dd5c..8abb29a6 100644 --- a/src/js/game/hud/parts/building_placer.js +++ b/src/js/game/hud/parts/building_placer.js @@ -162,6 +162,7 @@ export class HUDBuildingPlacer extends BaseHUDPart { // Check for direction lock if ( + metaBuilding.getHasDirectionLockAvailable() && this.root.keyMapper.getBinding(KEYMAPPINGS.placement.lockBeltDirection).isCurrentlyPressed() ) { const vector = enumDirectionToVector[enumAngleToDirection[this.currentBaseRotation]]; @@ -177,9 +178,10 @@ export class HUDBuildingPlacer extends BaseHUDPart { if ( metaBuilding && metaBuilding.getRotateAutomaticallyWhilePlacing(this.currentVariant.get()) && - !this.root.keyMapper - .getBinding(KEYMAPPINGS.placement.lockBeltDirection) - .isCurrentlyPressed() && + (!metaBuilding.getHasDirectionLockAvailable() || + !this.root.keyMapper + .getBinding(KEYMAPPINGS.placement.lockBeltDirection) + .isCurrentlyPressed()) && !this.root.keyMapper .getBinding(KEYMAPPINGS.placementModifiers.placementDisableAutoOrientation) .isCurrentlyPressed() @@ -659,7 +661,10 @@ export class HUDBuildingPlacer extends BaseHUDPart { // Draw direction lock - if (this.root.keyMapper.getBinding(KEYMAPPINGS.placement.lockBeltDirection).isCurrentlyPressed()) { + if ( + metaBuilding.getHasDirectionLockAvailable() && + this.root.keyMapper.getBinding(KEYMAPPINGS.placement.lockBeltDirection).isCurrentlyPressed() + ) { if (this.lastDragTile) { parameters.context.fillStyle = THEME.map.selectionBackground; parameters.context.strokeStyle = THEME.map.selectionOverlay; diff --git a/src/js/game/meta_building.js b/src/js/game/meta_building.js index 262a33cb..723e854b 100644 --- a/src/js/game/meta_building.js +++ b/src/js/game/meta_building.js @@ -31,6 +31,13 @@ export class MetaBuilding { return new Vector(1, 1); } + /** + * Returns whether the building has the direction lock switch available + */ + getHasDirectionLockAvailable() { + return false; + } + /** * Whether to stay in placement mode after having placed a building */