Skip to content

Commit

Permalink
feat: new bank model, types refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
r0man1337 committed Nov 3, 2024
1 parent 8cbdb57 commit 1e94beb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
Binary file modified client/public/models/buildings/bank.glb
Binary file not shown.
11 changes: 6 additions & 5 deletions client/src/three/components/Minimap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import useUIStore from "@/hooks/store/useUIStore";
import { FELT_CENTER } from "@/ui/config";
import { getHexForWorldPosition } from "@/ui/utils/utils";
import { StructureType } from "@bibliothecadao/eternum";
import { throttle } from "lodash";
import * as THREE from "three";
import WorldmapScene from "../scenes/Worldmap";
Expand All @@ -18,11 +19,11 @@ const MINIMAP_CONFIG = {
MY_ARMY: "#00FF00",
CAMERA: "#FFFFFF",
STRUCTURES: {
Realm: "#0000ff",
Hyperstructure: "#FFFFFF",
Bank: "#FFFF00",
FragmentMine: "#00FFFF",
Settlement: "#FFA500",
[StructureType.Realm]: "#0000ff",
[StructureType.Hyperstructure]: "#FFFFFF",
[StructureType.Bank]: "#FFFF00",
[StructureType.FragmentMine]: "#00FFFF",
[StructureType.Settlement]: "#FFA500",
},
},
SIZES: {
Expand Down
12 changes: 8 additions & 4 deletions client/src/three/components/StructureManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class StructureManager {
const loader = new GLTFLoader();

for (const [key, modelPaths] of Object.entries(StructureModelPaths)) {
const structureType = StructureType[key as keyof typeof StructureType];
const structureType = parseInt(key) as StructureType;

if (structureType === undefined) continue;
if (!modelPaths || modelPaths.length === 0) continue;
Expand Down Expand Up @@ -97,8 +97,7 @@ export class StructureManager {
this.totalStructures++;
}

const key = StructureType[structureType] as unknown as StructureType;

const key = structureType;
// Add the structure to the structures map
this.structures.addStructure(entityId, key, normalizedCoord, stage, isMine);

Expand Down Expand Up @@ -130,7 +129,8 @@ export class StructureManager {
}

private updateVisibleStructures() {
for (const [structureType, structures] of this.structures.getStructures()) {
const _structures = this.structures.getStructures();
for (const [structureType, structures] of _structures) {
const visibleStructures = this.getVisibleStructures(structures);
const models = this.structureModels.get(structureType);

Expand All @@ -152,6 +152,10 @@ export class StructureManager {
this.scene.add(label);
}
this.dummy.position.copy(position);

if (structureType === StructureType.Bank) {
this.dummy.rotation.y = 4 * Math.PI / 6;
}
this.dummy.updateMatrix();

const modelType = models[structure.stage];
Expand Down
2 changes: 1 addition & 1 deletion client/src/three/scenes/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const StructureModelPaths: Record<StructureType, string[]> = {
"models/buildings/hyperstructure_half.glb",
"models/buildings/hyperstructure.glb",
],
[StructureType.Bank]: ["/models/buildings/market.glb"],
[StructureType.Bank]: ["/models/buildings/bank.glb"],
[StructureType.FragmentMine]: ["models/buildings/mine.glb"],
// placeholder for now
[StructureType.Settlement]: ["models/buildings/mine.glb"],
Expand Down

0 comments on commit 1e94beb

Please sign in to comment.