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

Move the nearest item logic over to the PhysicsSystem #245

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

JackAshwell11
Copy link
Owner

@JackAshwell11 JackAshwell11 commented Sep 26, 2024

Description of Changes

This PR refactors the Game view to take on a more high-level orchestrating role by the nearest_item logic into the PhysicsSystem removing the equivalent Python code from the Game view. It also adds a few other quality of life changes such as two new functions to the Registry and a new event type allowing future refactors to take place.

Type of Changes

Type
🐛 Bug Fix
✨ New Feature
🔨 Refactoring
📝 Miscellaneous

Tasks

  • Implement PhysicsSystem::get_nearest_item().
  • Refactor all code that uses nearest_item to allow them to work with this newer version.

…ity to get the nearest Chipmunk2D sensor to another game object (if they're within a minimum range).

Implemented `Registry::get_game_object_type()` allowing for a client to get the stored game object type giving a game object ID. This allowed me to simplify `AttackSystem::do_attack()` since the previous change required passing in the game object type, but now we can get it from the registry.

Fixed a Python typing error with the `KinematicComponent` constructor.

Removed an unused header in `steering.cpp`.
…em::remove_item_from_inventory()`, and `InventorySystem::use_item()` allowing them to absorb more of the logic from `game.py`.

Added `Registry::has_game_object()` allowing a client to easily check if a given game object ID is registered with the registry.

Added a new event type `SpriteRemoval` which is called when a game object needs to be removed from an Arcade spritelist.
@JackAshwell11 JackAshwell11 force-pushed the nearest_item_conversion branch from 9c63c28 to 5a7d53f Compare September 27, 2024 09:49
@JackAshwell11 JackAshwell11 merged commit f81b5b7 into main Sep 27, 2024
13 checks passed
@JackAshwell11 JackAshwell11 deleted the nearest_item_conversion branch September 27, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant