-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat: wonder model #2393
feat: wonder model #2393
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
WalkthroughThe changes in this pull request introduce enhancements to the Changes
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
You are out of MentatBot reviews. Your usage will refresh December 16 at 08:00 AM. |
Failed to generate code suggestions for PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
client/src/dojo/modelManager/TileManager.ts (1)
64-68
: Consider extracting wonder-related constants to a dedicated configuration.The wonder-related constants and configurations are currently spread across multiple files. Consider creating a dedicated configuration file (e.g.,
wonderConfig.ts
) to centralize all wonder-related constants, paths, and configurations. This would improve maintainability and make it easier to extend wonder-related features in the future.Also applies to: 17-17, 41-44
client/src/three/scenes/Hexception.tsx (1)
473-475
: Add error handling for wonder model loadingWhile the wonder check is correctly placed, consider adding error handling in case the wonder model fails to load or isn't found in the
buildingModels
map.if (this.tileManager.getWonder()) { buildingType = WONDER_REALM; + if (!this.buildingModels.has(WONDER_REALM)) { + console.warn(`Wonder model not found, falling back to castle model: ${castleLevelToRealmCastle[this.structureStage]}`); + buildingType = castleLevelToRealmCastle[this.structureStage]; + } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
client/src/dojo/modelManager/TileManager.ts
(1 hunks)client/src/three/components/StructureManager.ts
(2 hunks)client/src/three/scenes/Hexception.tsx
(3 hunks)client/src/three/scenes/constants.ts
(3 hunks)
🔇 Additional comments (7)
client/src/three/scenes/constants.ts (2)
41-44
: LGTM: Wonder type constant and type definition.
The constant and type definition are properly integrated into the existing type system.
75-75
: Verify model file existence and consistency.
The wonder model paths are defined in two locations:
/models/buildings-opt/wonder.glb
for building models/models/buildings-opt/wonder2.glb
for structure models
Also applies to: 108-108
✅ Verification successful
Both wonder model files exist and are correctly placed
The verification confirms that both wonder model files exist in the expected location:
/models/buildings-opt/wonder.glb
/models/buildings-opt/wonder2.glb
The files are present in the client/public/models/buildings-opt/
directory, which is the correct location as it will be served as static assets under /models/buildings-opt/
path in the client application.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the existence of wonder model files
# Check if the model files exist
fd -t f "wonder.*.glb$" "models/buildings-opt"
Length of output: 154
Script:
#!/bin/bash
# Let's first check if the models directory exists and its location
fd -t d "models"
# Also search for any .glb files to understand the model file structure
fd -t f ".glb$"
Length of output: 4736
client/src/three/components/StructureManager.ts (2)
168-170
: LGTM: Wonder model selection logic.
The conditional logic for selecting the wonder model is properly implemented.
17-17
: Verify array bounds for wonder model index.
The constant WONDER_MODEL_INDEX = 4
should match the index of the wonder model in StructureModelPaths[StructureType.Realm]
.
✅ Verification successful
Wonder model index constant matches array index
The constant WONDER_MODEL_INDEX = 4
correctly corresponds to the index of "models/buildings-opt/wonder2.glb" in the StructureType.Realm
array, as it's the fifth element (index 4) in the array.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the wonder model index matches the array length
# Search for realm structure model paths array definition
rg -A 5 "\[StructureType\.Realm\]:\s*\[" "client/src/three/scenes/constants.ts"
Length of output: 306
client/src/dojo/modelManager/TileManager.ts (1)
64-68
: LGTM: Wonder status retrieval implementation.
The getWonder
method properly:
- Retrieves the realm entity ID from the UI store
- Uses optional chaining for safe property access
- Provides a default value of
false
client/src/three/scenes/Hexception.tsx (2)
101-103
: LGTM: Type signature properly extended for wonder models
The type signature update correctly includes the new WONDER_REALM
type alongside existing building and resource mining types.
473-475
: Verify wonder model configuration
Let's ensure that the wonder model is properly configured in the constants file and the model file exists.
✅ Verification successful
Based on the search results, I can now generate the final response:
Wonder model configuration is properly integrated
The wonder model is correctly configured in the codebase:
WONDER_REALM
constant is defined inclient/src/three/scenes/constants.ts
- The wonder model path is properly mapped to
/models/buildings-opt/wonder.glb
- The model file exists at
client/public/models/buildings-opt/wonder.glb
andwonder2.glb
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if WONDER_REALM is defined in constants and the model path exists
echo "Checking wonder model configuration..."
# Check WONDER_REALM constant definition
rg -A 1 "WONDER_REALM.*=.*" src/
# Check model path in buildingModelPaths
rg "wonder.*\.glb" src/
# List available model files
fd -e glb . models/buildings-opt/
Length of output: 382
Script:
#!/bin/bash
# Let's try searching from the repository root with proper paths
# First, let's find the correct source directory structure
fd -t d "src$"
# Then search for WONDER_REALM constant
rg "WONDER_REALM"
# Look for any .glb model files
fd -e glb
# Check for any wonder-related constants or configurations
rg -i "wonder" -g "*.{ts,tsx,js,jsx}"
Length of output: 69577
Added wonder model for realm & worldmap views
Summary by CodeRabbit
New Features
hasWonder
attribute.Changes