1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-11 09:11:50 +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 { globalConfig } from "../../../core/config";
import { clamp, formatBigNumber, round2Digits } from "../../../core/utils";
import { clamp, formatBigNumber } from "../../../core/utils";
import { T } from "../../../translations";
import { enumAnalyticsDataSource } from "../../production_analytics";
import { GameRoot } from "../../root";
@ -92,9 +92,7 @@ export class HUDShapeStatisticsHandle {
switch (dataSource) {
case enumAnalyticsDataSource.stored: {
this.counter.innerText = formatBigNumber(
this.root.hubGoals.storedShapes[this.definition.getHash()] || 0
);
this.counter.innerText = formatBigNumber(this.root.hubGoals.getShapesStored(this.definition));
break;
}
case enumAnalyticsDataSource.delivered:

View File

@ -5,10 +5,10 @@ import { GameRoot } from "../game/root";
import { THEMES } from "../game/theme";
/* typehints:end */
import { globalConfig } from "../core/config";
import { ShapeItem } from "../game/items/shape_item";
import { enumAnalyticsDataSource } from "../game/production_analytics";
import { ShapeDefinition } from "../game/shape_definition";
import { ShapeItem } from "../game/items/shape_item";
import { globalConfig } from "../core/config";
export const ACHIEVEMENTS = {
belt500Tiles: "belt500Tiles",
@ -423,7 +423,8 @@ export class AchievementCollection {
return {
init: ({ key }) => this.unlock(key, ShapeDefinition.fromShortKey(SHAPE_BP)),
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",
};
}