feat(grid): Refactor grid to use GridComponent + AActor instead of AGridItem #1
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.
Description
Motivation and Context
As we're expanding the systems in the game, we need to be able to customize our classes and actors better to interface to our various Grid, Growth, Interaction, Inventory, and other subsystems well.
Previously anything that could be placed into the grid must be a subclass of
AGridItem
, which meant that if we wanted to ensure some consistency between item types (some which can be in the grid and some which can't) we'd have to duplicate some actor level code for no real reason.This PR makes it so that any actor class can be placed into the grid, as long as it has a GridComponent within it, which defines how the actor will interface to the grid (providing the functions and grid related data storage).
This means for instance that a
mushroom
or amoss
can be blueprint actor type which simply containsGridComponent
GrowthComponent
InteractionComponent
And may implement any arbitrary interfaces without needing to have a parent hierarchy that includes GridManager classes.
This has a few benefits, the least of which is that the actor classes can now more easily and more generically have code which pulls in their various attributes from the various datatables in a nice and data-driven manner.
Finally, this means that we can more easily separate types of items and the code required for them while keeping the inheritance tree / class hierarchy fairly simple.
I will add some documentation to the
docs
folder as this is finished which will provide documentation around the new way to create items and define their attributes.How has this been tested?
Screenshots (if appropriate):
Growth shown after some time:
Multi-cell items:


Which also grow after some time:
And which also work on a slope:

Rotation works:
grid-rotation-test.mp4
And on a slope:
grid-rotation-slope-test.mp4
Types of changes
Checklist:
Software
.github/workflows/build.yml
file to add my new test to the automated cloud build github action.