-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor Actor Storage to be Tile-Based #105
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
Conversation
Refactors the actor storage mechanism to be decentralized. Previously, the World class maintained a Map<Tile, HasPosition> that was rebuilt every frame. This was inefficient and made the World class a bottleneck for actor lookups. This change moves the responsibility of storing an actor to the Tile class itself, which now holds a single Actor reference. - Added an `actor` field and overloaded `actor()` methods to the `Tile` class. - Removed the `tileToEntityMap` from the `World` class and its corresponding update logic. - Updated the `HasPosition.move()` method to manage adding/removing actors from tiles directly. - Updated all call sites that previously used the world map to query the tile directly. This results in a more object-oriented, efficient, and robust design.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
| if (tile() != null) { | ||
| tile().removeActor(); | ||
| } | ||
| target.actor((Actor) this); |
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.
if (target.hasActor()) {
throw new IllegalStateException("Cannot move to occupied tile: " + target.coord());
}
if (tile() != null) {
tile().removeActor();
}
target.actor((Actor) this);
this tile actor logic line 9-15 should be moved to the Actor class. it should call this function using super.move(target) and also include the extra tile actor logic
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.
Done. I've moved the tile actor logic into an overridden move method in CardPlayer.java as requested.
Refactors the actor storage mechanism to be decentralized. Previously, the World class maintained a Map<Tile, HasPosition> that was rebuilt every frame. This was inefficient and made the World class a bottleneck for actor lookups. This change moves the responsibility of storing an actor to the Tile class itself, which now holds a single Actor reference. - Added an `actor` field and overloaded `actor()` methods to the `Tile` class. - Removed the `tileToEntityMap` from the `World` class and its corresponding update logic. - Updated the `HasPosition.move()` method to manage adding/removing actors from tiles directly. - Updated all call sites that previously used the world map to query the tile directly. This results in a more object-oriented, efficient, and robust design.
Moved the move(Tile) method implementation from CardPlayer to the Actor interface, ensuring consistent movement behavior across all Actor implementations. Also removed HasPosition as a parent of HasInventory, simplifying the interface hierarchy.
Updated DropItemEffect and BuryItemEffect to require an explicit Tile parameter instead of relying on the owner's tile. Adjusted related event, expression, and UI code to pass the correct tile. Removed redundant Tile methods for actor management and improved clarity in actor movement logic.
Refactored the game's actor storage system. Instead of using a centralized map in the
Worldclass, actors are now stored directly on theTileobject they occupy. This improves efficiency by removing the need to rebuild the map every frame and creates a more intuitive, object-oriented design where the tile is the single source of truth for its occupant.PR created automatically by Jules for task 425455560673632216 started by @Lunkle