1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-13 02:01:51 +00:00

Merge pull request #37 from tobspr-games/dengr1065/avoid-storedshapes-direct-access

Replace some outside usages of HubGoals#storedShapes
This commit is contained in:
Даниїл Григор'єв 2024-07-24 19:56:13 +03:00 committed by GitHub
commit 04e96e0d68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 7 deletions

View File

@ -1,6 +1,6 @@
import { makeOffscreenBuffer } from "../../../core/buffer_utils"; import { makeOffscreenBuffer } from "../../../core/buffer_utils";
import { globalConfig } from "../../../core/config"; import { globalConfig } from "../../../core/config";
import { clamp, formatBigNumber, round2Digits } from "../../../core/utils"; import { clamp, formatBigNumber } from "../../../core/utils";
import { T } from "../../../translations"; import { T } from "../../../translations";
import { enumAnalyticsDataSource } from "../../production_analytics"; import { enumAnalyticsDataSource } from "../../production_analytics";
import { GameRoot } from "../../root"; import { GameRoot } from "../../root";
@ -92,9 +92,7 @@ export class HUDShapeStatisticsHandle {
switch (dataSource) { switch (dataSource) {
case enumAnalyticsDataSource.stored: { case enumAnalyticsDataSource.stored: {
this.counter.innerText = formatBigNumber( this.counter.innerText = formatBigNumber(this.root.hubGoals.getShapesStored(this.definition));
this.root.hubGoals.storedShapes[this.definition.getHash()] || 0
);
break; break;
} }
case enumAnalyticsDataSource.delivered: case enumAnalyticsDataSource.delivered:

View File

@ -5,10 +5,10 @@ import { GameRoot } from "../game/root";
import { THEMES } from "../game/theme"; import { THEMES } from "../game/theme";
/* typehints:end */ /* typehints:end */
import { globalConfig } from "../core/config";
import { ShapeItem } from "../game/items/shape_item";
import { enumAnalyticsDataSource } from "../game/production_analytics"; import { enumAnalyticsDataSource } from "../game/production_analytics";
import { ShapeDefinition } from "../game/shape_definition"; import { ShapeDefinition } from "../game/shape_definition";
import { ShapeItem } from "../game/items/shape_item";
import { globalConfig } from "../core/config";
export const ACHIEVEMENTS = { export const ACHIEVEMENTS = {
belt500Tiles: "belt500Tiles", belt500Tiles: "belt500Tiles",
@ -423,7 +423,8 @@ export class AchievementCollection {
return { return {
init: ({ key }) => this.unlock(key, ShapeDefinition.fromShortKey(SHAPE_BP)), init: ({ key }) => this.unlock(key, ShapeDefinition.fromShortKey(SHAPE_BP)),
isValid: definition => isValid: definition =>
definition.cachedHash === SHAPE_BP && this.root.hubGoals.storedShapes[SHAPE_BP] >= count, definition.cachedHash === SHAPE_BP &&
this.root.hubGoals.getShapesStoredByKey(SHAPE_BP) >= count,
signal: "shapeDelivered", signal: "shapeDelivered",
}; };
} }