1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2024-10-27 20:34:29 +00:00

Missing parts from last commit

This commit is contained in:
tobspr 2020-10-07 08:36:24 +02:00
parent 94266173d8
commit 9844641d11

View File

@ -1,12 +1,11 @@
import { ClickDetector } from "../../../core/click_detector"; import { ClickDetector } from "../../../core/click_detector";
import { formatBigNumber, makeDiv, arrayDeleteValue } from "../../../core/utils";
import { ShapeDefinition } from "../../shape_definition";
import { BaseHUDPart } from "../base_hud_part";
import { blueprintShape, UPGRADES } from "../../upgrades";
import { enumHubGoalRewards } from "../../tutorial_goals";
import { enumAnalyticsDataSource } from "../../production_analytics";
import { T } from "../../../translations";
import { globalConfig } from "../../../core/config"; import { globalConfig } from "../../../core/config";
import { arrayDeleteValue, formatBigNumber, makeDiv } from "../../../core/utils";
import { T } from "../../../translations";
import { enumAnalyticsDataSource } from "../../production_analytics";
import { ShapeDefinition } from "../../shape_definition";
import { enumHubGoalRewards } from "../../tutorial_goals";
import { BaseHUDPart } from "../base_hud_part";
/** /**
* Manages the pinned shapes on the left side of the screen * Manages the pinned shapes on the left side of the screen
@ -82,7 +81,7 @@ export class HUDPinnedShapes extends BaseHUDPart {
updateShapesAfterUpgrade() { updateShapesAfterUpgrade() {
for (let i = 0; i < this.pinnedShapes.length; ++i) { for (let i = 0; i < this.pinnedShapes.length; ++i) {
const key = this.pinnedShapes[i]; const key = this.pinnedShapes[i];
if (key === blueprintShape) { if (key === this.root.gameMode.getBlueprintShapeKey()) {
// Ignore blueprint shapes // Ignore blueprint shapes
continue; continue;
} }
@ -107,13 +106,14 @@ export class HUDPinnedShapes extends BaseHUDPart {
if (key === this.root.hubGoals.currentGoal.definition.getHash()) { if (key === this.root.hubGoals.currentGoal.definition.getHash()) {
return this.root.hubGoals.currentGoal.required; return this.root.hubGoals.currentGoal.required;
} }
if (key === blueprintShape) { if (key === this.root.gameMode.getBlueprintShapeKey()) {
return null; return null;
} }
// Check if this shape is required for any upgrade // Check if this shape is required for any upgrade
for (const upgradeId in UPGRADES) { const upgrades = this.root.gameMode.getUpgrades();
const upgradeTiers = UPGRADES[upgradeId]; for (const upgradeId in upgrades) {
const upgradeTiers = upgrades[upgradeId];
const currentTier = this.root.hubGoals.getUpgradeLevel(upgradeId); const currentTier = this.root.hubGoals.getUpgradeLevel(upgradeId);
const tierHandle = upgradeTiers[currentTier]; const tierHandle = upgradeTiers[currentTier];
@ -138,7 +138,10 @@ export class HUDPinnedShapes extends BaseHUDPart {
* @param {string} key * @param {string} key
*/ */
isShapePinned(key) { isShapePinned(key) {
if (key === this.root.hubGoals.currentGoal.definition.getHash() || key === blueprintShape) { if (
key === this.root.hubGoals.currentGoal.definition.getHash() ||
key === this.root.gameMode.getBlueprintShapeKey()
) {
// This is a "special" shape which is always pinned // This is a "special" shape which is always pinned
return true; return true;
} }
@ -178,7 +181,7 @@ 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({ this.internalPinShape({
key: blueprintShape, key: this.root.gameMode.getBlueprintShapeKey(),
canUnpin: false, canUnpin: false,
className: "blueprint", className: "blueprint",
}); });
@ -306,7 +309,7 @@ export class HUDPinnedShapes extends BaseHUDPart {
return; return;
} }
if (key === blueprintShape) { if (key === this.root.gameMode.getBlueprintShapeKey()) {
// Can not pin the blueprint shape // Can not pin the blueprint shape
return; return;
} }