From 1230b873aa7814f9580df84b992bb16bc5be0634 Mon Sep 17 00:00:00 2001 From: Ethan Chapman Date: Mon, 7 Dec 2020 12:37:49 -0500 Subject: [PATCH] Require LMB to place blueprints (#979) --- src/js/game/hud/parts/blueprint_placer.js | 30 ++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/js/game/hud/parts/blueprint_placer.js b/src/js/game/hud/parts/blueprint_placer.js index e1040c3b..c3625209 100644 --- a/src/js/game/hud/parts/blueprint_placer.js +++ b/src/js/game/hud/parts/blueprint_placer.js @@ -110,22 +110,24 @@ export class HUDBlueprintPlacer extends BaseHUDPart { } } - const blueprint = this.currentBlueprint.get(); - if (!blueprint) { - return; - } + if (button === enumMouseButton.left) { + const blueprint = this.currentBlueprint.get(); + if (!blueprint) { + return; + } - if (!blueprint.canAfford(this.root)) { - this.root.soundProxy.playUiError(); - return; - } + if (!blueprint.canAfford(this.root)) { + this.root.soundProxy.playUiError(); + return; + } - const worldPos = this.root.camera.screenToWorld(pos); - const tile = worldPos.toTileSpace(); - if (blueprint.tryPlace(this.root, tile)) { - const cost = blueprint.getCost(); - this.root.hubGoals.takeShapeByKey(this.root.gameMode.getBlueprintShapeKey(), cost); - this.root.soundProxy.playUi(SOUNDS.placeBuilding); + const worldPos = this.root.camera.screenToWorld(pos); + const tile = worldPos.toTileSpace(); + if (blueprint.tryPlace(this.root, tile)) { + const cost = blueprint.getCost(); + this.root.hubGoals.takeShapeByKey(this.root.gameMode.getBlueprintShapeKey(), cost); + this.root.soundProxy.playUi(SOUNDS.placeBuilding); + } } }