mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
If cost is low, copy instead of cut
This commit is contained in:
parent
1837e72952
commit
6a279923e3
@ -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 {
|
||||
|
@ -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:
|
||||
|
@ -325,6 +325,7 @@ ingame:
|
||||
notifications:
|
||||
newUpgrade: 新しいアップグレードが利用可能です!
|
||||
gameSaved: ゲームをセーブしました。
|
||||
massCutInsufficient: 設置コストが不足しています!
|
||||
|
||||
# The "Upgrades" window
|
||||
shop:
|
||||
|
Loading…
Reference in New Issue
Block a user