From 02e3448ec653863fc16b4e06f928826e242984b0 Mon Sep 17 00:00:00 2001 From: Triston Stuart Date: Wed, 24 Jun 2020 11:08:22 -0700 Subject: [PATCH] Simplify + Wording Adding the requested change. Changes sound to playSound. Changes suppressSound to playSound. Removes suppressSound to sound. Inverts sound check so it works with new playSound. --- src/js/game/hud/parts/building_placer_logic.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/js/game/hud/parts/building_placer_logic.js b/src/js/game/hud/parts/building_placer_logic.js index 065021b4..e0be3cfd 100644 --- a/src/js/game/hud/parts/building_placer_logic.js +++ b/src/js/game/hud/parts/building_placer_logic.js @@ -368,15 +368,12 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart { * @param {Vector} tile * @param {boolean} suppressSound */ - tryPlaceCurrentBuildingAt(tile, suppressSound = false) { + tryPlaceCurrentBuildingAt(tile, playSound = true) { if (this.root.camera.zoomLevel < globalConfig.mapChunkOverviewMinZoom) { // Dont allow placing in overview mode return; } - // Set sound to the opposite of suppressSound. - const sound = !suppressSound; - const metaBuilding = this.currentMetaBuilding.get(); const { rotation, rotationVariant } = metaBuilding.computeOptimalDirectionAndRotationVariantAtTile( this.root, @@ -419,7 +416,7 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart { } // Building has been placed, play sound - if (sound) { + if (playSound) { this.root.soundProxy.playUi(metaBuilding.getPlacementSound()); } @@ -467,10 +464,11 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart { /* Trys to place building. Includes check to see if we should play sound. + 2nd Argument is playSound. */ const placedBuilding = this.tryPlaceCurrentBuildingAt( tile, - i == 0 || trySound ? false : true + i == 0 || trySound ? true : false ); /* If placedBuilding is false then the building didn't place.