Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "feat: wonder model" #2396

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed client/public/models/buildings-opt/wonder.glb
Binary file not shown.
Binary file removed client/public/models/buildings-opt/wonder2.glb
Binary file not shown.
6 changes: 0 additions & 6 deletions client/src/dojo/modelManager/TileManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ 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([
Expand Down
5 changes: 1 addition & 4 deletions client/src/three/components/StructureManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<StructureType, InstancedModel[]> = new Map();
Expand Down Expand Up @@ -165,9 +165,6 @@ 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);
Expand Down
6 changes: 1 addition & 5 deletions client/src/three/scenes/Hexception.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
HEX_SIZE,
MinesMaterialsParams,
StructureProgress,
WONDER_REALM,
buildingModelPaths,
castleLevelToRealmCastle,
hyperstructureStageToModel,
Expand Down Expand Up @@ -98,7 +97,7 @@ interface Building {
export default class HexceptionScene extends HexagonScene {
private hexceptionRadius = 4;
private buildingModels: Map<
BuildingType | ResourceMiningTypes | typeof WONDER_REALM,
BuildingType | ResourceMiningTypes,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Found remaining wonder-related code that needs attention

The search revealed several remaining wonder-related implementations that should be reviewed:

  • Wonder-related scene handling in label management (MY_REALM_WONDER, REALM_WONDER labels and their loading)
  • Wonder-specific logic for resource costs (adjustWonderLordsCost function)
  • Wonder-related structure properties and handling (hasWonder flag in structures)
  • Wonder-specific resource production rate adjustments

These findings suggest the wonder feature removal is incomplete. The changes should be consistent across the entire codebase.

🔗 Analysis chain

LGTM: Wonder type successfully removed from buildingModels Map.

The type definition has been correctly updated to remove the wonder-related type, consistent with changes in constants.ts.

Let's verify no wonder-related scene handling remains:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining wonder-related scene handling
ast-grep --pattern 'if ($this.tileManager.getWonder()) {
  $$$
}'

# Search for any remaining wonder-related imports or type usage
rg -i 'wonder.*realm|realm.*wonder' --type tsx

Length of output: 144


Script:

#!/bin/bash
# Search for any remaining wonder-related scene handling with ripgrep
rg -i "wonder" --type ts --type tsx -A 3

# Search for any remaining wonder-related imports or type usage
rg -i "wonderrealm|realm.*wonder" --type ts --type tsx

# Search for getWonder method usage
rg -i "getWonder\(" --type ts --type tsx

Length of output: 224


Script:

#!/bin/bash
# Search for any remaining wonder-related scene handling with ripgrep
# Note: Using just typescript extension since tsx isn't recognized
rg -i "wonder" "*.ts"

# Search for getWonder method usage
rg -i "getWonder\(" "*.ts"

# Find all TypeScript files that might contain wonder-related code
fd -e ts -e tsx -x cat {} | rg -i "wonder"

Length of output: 3993

{ model: THREE.Group; animations: THREE.AnimationClip[] }
> = new Map();
private buildingInstances: Map<string, THREE.Group> = new Map();
Expand Down Expand Up @@ -470,9 +469,6 @@ 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];
Expand Down
6 changes: 1 addition & 5 deletions client/src/three/scenes/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ export const hyperstructureStageToModel: Record<StructureProgress, string> = {
[StructureProgress.STAGE_3]: HyperstructureTypesNames.STAGE_3,
};

export const WONDER_REALM = "Wonder";

export const buildingModelPaths: Record<
BuildingType | ResourceMiningTypes | RealmLevelNames | HyperstructureTypesNames | typeof WONDER_REALM,
BuildingType | ResourceMiningTypes | RealmLevelNames | HyperstructureTypesNames,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Wonder-related code still present in multiple locations

Several wonder-related code references still exist across the codebase that may need attention:

  • client/src/three/components/Minimap.ts: Contains wonder-related texture paths and logic
  • client/src/ui/utils/utils.tsx: Has adjustWonderLordsCost function
  • client/src/ui/utils/realms.tsx: Contains wonder-related logic and naming
  • client/src/dojo/modelManager/ResourceManager.ts: Contains wonder-specific resource production logic
  • client/src/three/components/StructureManager.ts: Has wonder-related parameters and logic
🔗 Analysis chain

LGTM: Wonder type successfully removed from buildingModelPaths.

The type definition has been correctly updated to remove the wonder-related type.

Let's verify no other wonder-related constants remain in the codebase:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining wonder-related constants
rg -i 'wonder' --type ts

Length of output: 6653

string
> = {
// placeholder for now
Expand Down Expand Up @@ -72,7 +70,6 @@ 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/";
Expand Down Expand Up @@ -105,7 +102,6 @@ export const StructureModelPaths: Record<StructureType, string[]> = {
"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]: [
Expand Down
Loading