Skip to content

Commit

Permalink
Fix/mine max balance (#2550)
Browse files Browse the repository at this point in the history
* Change to getComponentValue

* Fix max balance

* client: no storage limit for non realm

---------

Co-authored-by: Credence <[email protected]>
  • Loading branch information
bob0005 and credence0x authored Dec 17, 2024
1 parent 123b8f0 commit 7258c2a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/src/dojo/modelManager/ResourceManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getEntityIdFromKeys, gramToKg, multiplyByPrecision } from "@/ui/utils/utils";
import { BuildingType, CapacityConfigCategory, ResourcesIds, type ID } from "@bibliothecadao/eternum";
import { BuildingType, CapacityConfigCategory, ResourcesIds, StructureType, type ID } from "@bibliothecadao/eternum";
import { getComponentValue } from "@dojoengine/recs";
import { configManager, type SetupResult } from "../setup";

Expand Down Expand Up @@ -91,6 +91,12 @@ export class ResourceManager {
}

public getStoreCapacity(): number {
const structure = getComponentValue(
this.setup.components.Structure,
getEntityIdFromKeys([BigInt(this.entityId || 0)]),
);
if (structure?.category === StructureType[StructureType.FragmentMine]) return Infinity;

const storehouseCapacityKg = gramToKg(configManager.getCapacityConfig(CapacityConfigCategory.Storehouse));
const quantity =
getComponentValue(
Expand Down

0 comments on commit 7258c2a

Please sign in to comment.