From 46ceefd0d86ed3e82e1d1f2fcb1310763fb14863 Mon Sep 17 00:00:00 2001 From: tobspr Date: Tue, 16 Jun 2020 20:02:52 +0200 Subject: [PATCH] Disable automatic orientation when using belt lock --- src/js/game/hud/parts/building_placer.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/js/game/hud/parts/building_placer.js b/src/js/game/hud/parts/building_placer.js index 6087bf92..68f1dd5c 100644 --- a/src/js/game/hud/parts/building_placer.js +++ b/src/js/game/hud/parts/building_placer.js @@ -154,13 +154,13 @@ export class HUDBuildingPlacer extends BaseHUDPart { const oldPos = this.lastDragTile; let newPos = this.root.camera.screenToWorld(pos).toTileSpace(); + // Check if camera is moving, since then we do nothing if (this.root.camera.desiredCenter) { - // Camera is moving this.lastDragTile = newPos; return; } - // Direction lock + // Check for direction lock if ( this.root.keyMapper.getBinding(KEYMAPPINGS.placement.lockBeltDirection).isCurrentlyPressed() ) { @@ -171,10 +171,15 @@ export class HUDBuildingPlacer extends BaseHUDPart { newPos = oldPos.add(delta); } + // Check if anything changed if (!oldPos.equals(newPos)) { + // Automatic Direction if ( metaBuilding && metaBuilding.getRotateAutomaticallyWhilePlacing(this.currentVariant.get()) && + !this.root.keyMapper + .getBinding(KEYMAPPINGS.placement.lockBeltDirection) + .isCurrentlyPressed() && !this.root.keyMapper .getBinding(KEYMAPPINGS.placementModifiers.placementDisableAutoOrientation) .isCurrentlyPressed()