mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-02-12 19:09:21 +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;
|
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
|
* Returns how much of the current shape is stored
|
||||||
* @param {string} key
|
* @param {string} key
|
||||||
|
|||||||
@ -107,6 +107,11 @@ export class HUDBlueprintPlacer extends BaseHUDPart {
|
|||||||
const cost = blueprint.getCost();
|
const cost = blueprint.getCost();
|
||||||
this.root.hubGoals.takeShapeByKey(blueprintShape, cost);
|
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
|
// This actually feels weird
|
||||||
// if (!this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placeMultiple).isCurrentlyPressed()) {
|
// if (!this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placeMultiple).isCurrentlyPressed()) {
|
||||||
// this.currentBlueprint.set(null);
|
// this.currentBlueprint.set(null);
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import { T } from "../../../translations";
|
|||||||
import { KEYMAPPINGS } from "../../key_action_mapper";
|
import { KEYMAPPINGS } from "../../key_action_mapper";
|
||||||
import { THEME } from "../../theme";
|
import { THEME } from "../../theme";
|
||||||
import { enumHubGoalRewards } from "../../tutorial_goals";
|
import { enumHubGoalRewards } from "../../tutorial_goals";
|
||||||
|
import { blueprintShape } from "../../upgrades";
|
||||||
|
|
||||||
const logger = createLogger("hud/mass_selector");
|
const logger = createLogger("hud/mass_selector");
|
||||||
|
|
||||||
|
|||||||
@ -164,6 +164,9 @@ export class HUDPinnedShapes extends BaseHUDPart {
|
|||||||
// Pin blueprint shape as well
|
// Pin blueprint shape as well
|
||||||
if (this.root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_blueprints)) {
|
if (this.root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_blueprints)) {
|
||||||
this.internalPinShape(blueprintShape, false, "blueprint");
|
this.internalPinShape(blueprintShape, false, "blueprint");
|
||||||
|
if (this.root.hubGoals.getShapesStoredByKey(blueprintShape) == 0) {
|
||||||
|
this.root.hubGoals.putShapeByKey(blueprintShape, 50);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pin manually pinned shapes
|
// Pin manually pinned shapes
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user