From 97ef46bd52690f52ff87c0cb6382e48c1f1abeb7 Mon Sep 17 00:00:00 2001 From: tobspr Date: Wed, 24 Jun 2020 21:09:09 +0200 Subject: [PATCH] Fix deconstruct sound being played when right clicking hub --- src/js/changelog.js | 1 + src/js/game/hud/parts/building_placer_logic.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/changelog.js b/src/js/changelog.js index cfa6acdb..e84cb269 100644 --- a/src/js/changelog.js +++ b/src/js/changelog.js @@ -8,6 +8,7 @@ export const CHANGELOG = [ "Allow clicking on variants to select them", "Allow clicking 'Q' over a shape or color patch to automatically select the miner building (by Gerdon262)", "Add 'copy key' button to shape viewer", + "Fix deconstruct sound being played when right clicking hub", "Add setting (on by default) to store the last used rotation per building instead of globally storing it (by Magos)", "Added chinese (traditional) translation", "Updated translations", diff --git a/src/js/game/hud/parts/building_placer_logic.js b/src/js/game/hud/parts/building_placer_logic.js index 179dfc45..c8c83acc 100644 --- a/src/js/game/hud/parts/building_placer_logic.js +++ b/src/js/game/hud/parts/building_placer_logic.js @@ -263,8 +263,9 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart { const tile = worldPos.toTileSpace(); const contents = this.root.map.getTileContent(tile); if (contents) { - this.root.logic.tryDeleteBuilding(contents); - this.root.soundProxy.playUi(SOUNDS.destroyBuilding); + if (this.root.logic.tryDeleteBuilding(contents)) { + this.root.soundProxy.playUi(SOUNDS.destroyBuilding); + } } }