diff --git a/client/public/models/buildings-opt/wonder.glb b/client/public/models/buildings-opt/wonder.glb new file mode 100644 index 0000000000..cec2c4fa44 Binary files /dev/null and b/client/public/models/buildings-opt/wonder.glb differ diff --git a/client/public/models/buildings-opt/wonder2.glb b/client/public/models/buildings-opt/wonder2.glb new file mode 100644 index 0000000000..b3804f4c54 Binary files /dev/null and b/client/public/models/buildings-opt/wonder2.glb differ diff --git a/client/src/dojo/modelManager/TileManager.ts b/client/src/dojo/modelManager/TileManager.ts index 3698c68560..614fb289ce 100644 --- a/client/src/dojo/modelManager/TileManager.ts +++ b/client/src/dojo/modelManager/TileManager.ts @@ -61,6 +61,12 @@ export class TileManager { return (realm?.level || RealmLevels.Settlement) as RealmLevels; }; + getWonder = () => { + const realmEntityId = useUIStore.getState().structureEntityId; + const realm = getComponentValue(this.setup.components.Realm, getEntityIdFromKeys([BigInt(realmEntityId)])); + return realm?.has_wonder || false; + }; + existingBuildings = () => { const builtBuildings = Array.from( runQuery([ diff --git a/client/src/three/components/StructureManager.ts b/client/src/three/components/StructureManager.ts index 3b435d5e5f..1d86430f67 100644 --- a/client/src/three/components/StructureManager.ts +++ b/client/src/three/components/StructureManager.ts @@ -14,7 +14,7 @@ const neutralColor = new THREE.Color(0xffffff); const myColor = new THREE.Color("lime"); const MAX_INSTANCES = 1000; - +const WONDER_MODEL_INDEX = 4; export class StructureManager { private scene: THREE.Scene; private structureModels: Map = new Map(); @@ -165,6 +165,9 @@ export class StructureManager { let modelType = models[structure.stage]; if (structureType === StructureType.Realm) { modelType = models[structure.level]; + if (structure.hasWonder) { + modelType = models[WONDER_MODEL_INDEX]; + } } const currentCount = modelType.getCount(); modelType.setMatrixAt(currentCount, this.dummy.matrix); diff --git a/client/src/three/scenes/Hexception.tsx b/client/src/three/scenes/Hexception.tsx index 6e40ae3320..ce1a42bbb3 100644 --- a/client/src/three/scenes/Hexception.tsx +++ b/client/src/three/scenes/Hexception.tsx @@ -39,6 +39,7 @@ import { HEX_SIZE, MinesMaterialsParams, StructureProgress, + WONDER_REALM, buildingModelPaths, castleLevelToRealmCastle, hyperstructureStageToModel, @@ -97,7 +98,7 @@ interface Building { export default class HexceptionScene extends HexagonScene { private hexceptionRadius = 4; private buildingModels: Map< - BuildingType | ResourceMiningTypes, + BuildingType | ResourceMiningTypes | typeof WONDER_REALM, { model: THREE.Group; animations: THREE.AnimationClip[] } > = new Map(); private buildingInstances: Map = new Map(); @@ -469,6 +470,9 @@ export default class HexceptionScene extends HexagonScene { if (parseInt(buildingType) === BuildingType.Castle) { buildingType = castleLevelToRealmCastle[this.structureStage]; + if (this.tileManager.getWonder()) { + buildingType = WONDER_REALM; + } } if (building.structureType === StructureType.Hyperstructure) { buildingType = hyperstructureStageToModel[this.structureStage as StructureProgress]; diff --git a/client/src/three/scenes/constants.ts b/client/src/three/scenes/constants.ts index 3914af593e..a1dc21b81e 100644 --- a/client/src/three/scenes/constants.ts +++ b/client/src/three/scenes/constants.ts @@ -38,8 +38,10 @@ export const hyperstructureStageToModel: Record = { [StructureProgress.STAGE_3]: HyperstructureTypesNames.STAGE_3, }; +export const WONDER_REALM = "Wonder"; + export const buildingModelPaths: Record< - BuildingType | ResourceMiningTypes | RealmLevelNames | HyperstructureTypesNames, + BuildingType | ResourceMiningTypes | RealmLevelNames | HyperstructureTypesNames | typeof WONDER_REALM, string > = { // placeholder for now @@ -70,6 +72,7 @@ export const buildingModelPaths: Record< [HyperstructureTypesNames.STAGE_1]: "/models/buildings-opt/hyperstructure_init.glb", [HyperstructureTypesNames.STAGE_2]: "/models/buildings-opt/hyperstructure_half.glb", [HyperstructureTypesNames.STAGE_3]: "/models/buildings-opt/hyperstructure.glb", + [WONDER_REALM]: "/models/buildings-opt/wonder.glb", }; const BASE_PATH = "/models/biomes-opt/"; @@ -102,6 +105,7 @@ export const StructureModelPaths: Record = { "models/buildings-opt/castle1.glb", "models/buildings-opt/castle2.glb", "models/buildings-opt/castle3.glb", + "models/buildings-opt/wonder2.glb", ], // Order follows StructureProgress [StructureType.Hyperstructure]: [