diff --git a/src/js/game/hub_goals.js b/src/js/game/hub_goals.js index ef7797a9..9425253a 100644 --- a/src/js/game/hub_goals.js +++ b/src/js/game/hub_goals.js @@ -127,6 +127,17 @@ export class HubGoals extends BasicSerializableObject { return; } + /** + * @param {string} key + * @param {number} amount + */ + putShapeByKey(key, amount) { + assert(amount >= 0, "Amount < 0 for " + key); + assert(Number.isInteger(amount), "Invalid amount: " + amount); + this.storedShapes[key] = (this.storedShapes[key] || 0) + amount; + return; + } + /** * Returns how much of the current shape is stored * @param {string} key diff --git a/src/js/game/hud/parts/blueprint_placer.js b/src/js/game/hud/parts/blueprint_placer.js index 0ffff9b4..9acf5105 100644 --- a/src/js/game/hud/parts/blueprint_placer.js +++ b/src/js/game/hud/parts/blueprint_placer.js @@ -107,6 +107,11 @@ export class HUDBlueprintPlacer extends BaseHUDPart { const cost = blueprint.getCost(); this.root.hubGoals.takeShapeByKey(blueprintShape, cost); + const leftover = this.root.hubGoals.getShapesStoredByKey(blueprintShape); + if (leftover < 50) { + this.root.hubGoals.putShapeByKey(blueprintShape, 50 - leftover); + } + // This actually feels weird // if (!this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placeMultiple).isCurrentlyPressed()) { // this.currentBlueprint.set(null); diff --git a/src/js/game/hud/parts/mass_selector.js b/src/js/game/hud/parts/mass_selector.js index b89108c0..1a528544 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 { blueprintShape } from "../../upgrades"; const logger = createLogger("hud/mass_selector"); diff --git a/src/js/game/hud/parts/pinned_shapes.js b/src/js/game/hud/parts/pinned_shapes.js index 62afff25..96a7719f 100644 --- a/src/js/game/hud/parts/pinned_shapes.js +++ b/src/js/game/hud/parts/pinned_shapes.js @@ -164,6 +164,9 @@ export class HUDPinnedShapes extends BaseHUDPart { // Pin blueprint shape as well if (this.root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_blueprints)) { this.internalPinShape(blueprintShape, false, "blueprint"); + if (this.root.hubGoals.getShapesStoredByKey(blueprintShape) == 0) { + this.root.hubGoals.putShapeByKey(blueprintShape, 50); + } } // Pin manually pinned shapes