Skip to content

Commit

Permalink
Merge pull request #1876 from BibliothecaDAO/fix/optimistic-build-too…
Browse files Browse the repository at this point in the history
…ltip

Fix tooltip for recently built buildings
  • Loading branch information
ponderingdemocritus authored Oct 19, 2024
2 parents d25fe44 + 3566285 commit d8c4cbf
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion client/src/dojo/modelManager/TileManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
getNeighborHexes,
ID,
RealmLevels,
ResourcesIds,
StructureType,
} from "@bibliothecadao/eternum";
import { getComponentValue, Has, HasValue, NotValue, runQuery } from "@dojoengine/recs";
Expand Down Expand Up @@ -123,6 +124,21 @@ export class TileManager {
) => {
let overrideId = uuid();
const entity = getEntityIdFromKeys([this.col, this.row, col, row].map((v) => BigInt(v)));

let produced_resource_type = 0;

switch (buildingType) {
case BuildingType.Farm:
produced_resource_type = ResourcesIds.Wheat;
break;
case BuildingType.FishingVillage:
produced_resource_type = ResourcesIds.Fish;
break;
case BuildingType.Resource:
produced_resource_type = resourceType || 0;
break;
}

this.setup.components.Building.addOverride(overrideId, {
entity,
value: {
Expand All @@ -131,7 +147,7 @@ export class TileManager {
inner_col: col,
inner_row: row,
category: BuildingType[buildingType],
produced_resource_type: resourceType ? resourceType : 0,
produced_resource_type,
bonus_percent: 0,
entity_id: entityId,
outer_entity_id: entityId,
Expand Down

0 comments on commit d8c4cbf

Please sign in to comment.