mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-02-12 02:49:20 +00:00
50 free BP shapes
This commit is contained in:
parent
2f66381009
commit
9745a9b58d
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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");
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user