You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Possible Bug The method _getArmyRemainingCapacity calculates the remaining capacity using BigInt division, which might lead to incorrect results due to rounding. Consider revising the calculation logic to ensure accuracy.
Code Smell The loadModels method uses a loop with async operations inside but does not handle potential simultaneous async operations well. Consider refactoring to use Promise.all for better efficiency and error handling.
Redundant Code There are commented out lines for StructureType.Hyperstructure model paths which could be confusing and should be cleaned up if not needed.
Why: This suggestion addresses a potential runtime error by ensuring armyEntity is defined before accessing its properties, which is crucial for preventing crashes.
9
Ensure BigInt is used for all operations in troopQty calculation
Use BigInt for troopQty calculation to ensure correct type handling and avoid potential bugs due to type mismatch.
Why: This suggestion ensures type consistency in calculations involving BigInt, which is important for preventing potential bugs due to type mismatches.
8
Enhancement
Add error handling for model loading promises to manage failures gracefully
Add error handling for the loadModels method to manage failed promises and prevent the application from hanging due to unhandled promise rejections.
-this.modelLoadPromises.push(loadPromise);+this.modelLoadPromises.push(loadPromise.catch(error => {+ console.error("Failed to load model:", error);+ return Promise.resolve(); // Resolve to prevent blocking other models+}));
Suggestion importance[1-10]: 8
Why: Adding error handling for model loading promises improves the robustness of the application by preventing it from hanging due to unhandled promise rejections.
8
Replace the placeholder model path with the correct model path
Replace the placeholder model for StructureType.Hyperstructure with the intended model path to ensure the correct assets are loaded.
-[StructureType.Hyperstructure]: "models/buildings/farm.glb", // USING PLACEHOLDER MODEL+[StructureType.Hyperstructure]: "models/buildings/hyperstructure.glb",
Suggestion importance[1-10]: 7
Why: Replacing the placeholder model with the correct one improves the accuracy and visual representation of the application, but it is not critical for functionality.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Closes #1179
Closes #1166
Closes #1161
PR Type
Enhancement, Bug fix
Description
capacityModel
andweightModel
components toArmyMovementManager
and integrated capacity and weight checks in exploration validation._getArmyRemainingCapacity
method inArmyMovementManager
.StructureModelPaths
andStructureLabelPaths
inStructureManager
for dynamic loading of structure models.StructureManager
to handle multiple structure types and manage them dynamically.totalStructures
tracking inWorldmapScene
and updated structure handling to useStructureManager
.WorldmapScene
.Changes walkthrough 📝
ArmyMovementManager.ts
Add capacity and weight checks for army movement
client/src/dojo/modelManager/ArmyMovementManager.ts
capacityModel
andweightModel
components._getArmyRemainingCapacity
method.StructureManager.ts
Dynamic loading and management of structure models
client/src/three/components/StructureManager.ts
StructureModelPaths
andStructureLabelPaths
.Worldmap.ts
Integrate structure management and cache invalidation
client/src/three/scenes/Worldmap.ts
totalStructures
tracking.StructureManager
.