diff --git a/src/js/game/hud/parts/mass_selector.js b/src/js/game/hud/parts/mass_selector.js index fb55676e..2c17c595 100644 --- a/src/js/game/hud/parts/mass_selector.js +++ b/src/js/game/hud/parts/mass_selector.js @@ -13,6 +13,7 @@ import { T } from "../../../translations"; import { KEYMAPPINGS } from "../../key_action_mapper"; import { THEME } from "../../theme"; import { enumHubGoalRewards } from "../../tutorial_goals"; +import { enumNotificationType } from "./notifications"; const logger = createLogger("hud/mass_selector"); @@ -148,14 +149,30 @@ export class HUDMassSelector extends BaseHUDPart { // copy code relies on entities still existing, so must copy before deleting. this.root.hud.signals.buildingsSelectedForCopy.dispatch(entityUids); - for (let i = 0; i < entityUids.length; ++i) { - const uid = entityUids[i]; - const entity = this.root.entityMgr.findByUid(uid); - if (!this.root.logic.tryDeleteBuilding(entity)) { - logger.error("Error in mass cut, could not remove building"); - this.selectedUids.delete(uid); + let canPaste = false; + const placer = this.root.hud.parts.blueprintPlacer; + if (placer) { + const blueprint = placer.currentBlueprint.get(); + if (blueprint) { + canPaste = blueprint.canAfford(this.root); } } + if (canPaste) { + for (let i = 0; i < entityUids.length; ++i) { + const uid = entityUids[i]; + const entity = this.root.entityMgr.findByUid(uid); + if (!this.root.logic.tryDeleteBuilding(entity)) { + logger.error("Error in mass cut, could not remove building"); + this.selectedUids.delete(uid); + } + } + } else { + this.selectedUids = new Set(); + this.root.hud.signals.notification.dispatch( + T.ingame.notifications.massCutInsufficient, + enumNotificationType.success + ); + } this.root.soundProxy.playUiClick(); } else { diff --git a/translations/base-en.yaml b/translations/base-en.yaml index ed1999b7..0a17ca6e 100644 --- a/translations/base-en.yaml +++ b/translations/base-en.yaml @@ -337,6 +337,7 @@ ingame: notifications: newUpgrade: A new upgrade is available! gameSaved: Your game has been saved. + massCutInsufficient: The cost for pasting is insufficient! # The "Upgrades" window shop: diff --git a/translations/base-ja.yaml b/translations/base-ja.yaml index d6d5139f..26106019 100644 --- a/translations/base-ja.yaml +++ b/translations/base-ja.yaml @@ -325,6 +325,7 @@ ingame: notifications: newUpgrade: 新しいアップグレードが利用可能です! gameSaved: ゲームをセーブしました。 + massCutInsufficient: 設置コストが不足しています! # The "Upgrades" window shop: