1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-02-12 10:59:23 +00:00

50 free BP shapes

This commit is contained in:
Dimava 2020-06-13 13:45:58 +03:00
parent 2f66381009
commit 9745a9b58d
4 changed files with 20 additions and 0 deletions

View File

@ -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

View File

@ -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);

View File

@ -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");

View File

@ -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