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

refactor: use EntityBuilder for creating test character #97

Merged

Conversation

jdrueckert
Copy link
Member

@jdrueckert jdrueckert commented Feb 19, 2022

Extracted from #92

@jdrueckert jdrueckert added Category: Test/QA Requests, Issues and Changes targeting tests and quality assurance Topic: AI Requests, Issues and Changes related to pathfinding, behaviors, etc. Size: S Small effort likely only affecting a single area and requiring little to no research Type: Refactoring Request for or implementation of pure and automatic refactorings, e.g. renaming, to improve clarity labels Feb 19, 2022
@jdrueckert jdrueckert self-assigned this Feb 19, 2022
@jdrueckert jdrueckert removed the request for review from skaldarnar February 19, 2022 18:36
moveComponent.movementTypes.addAll(Sets.newHashSet(movementTypes));
return moveComponent;
});
builder.updateComponent(CharacterMovementComponent.class, characterMovement -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether we should use upsertComponent all the time, or at least log something if the component is not present? 🤔 Should updateComponent itself log something (DEBUG level?) if the component is not present?

The main drawback of using updateComponent is that it will silently do nothing if the component is not present. So, upsertComponent is the safe bet to ensure the right thing will happen, while updateComponent is a bit nicer to read if you're pretty certain that the component will be present...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether I would encourage using updateComponent only because it's more readable but in some cases doesn't do what I want it to do based on an assumption I had that might have changed by now...
I guess upsertComponent might indeed be better here.

@skaldarnar skaldarnar merged commit bd5ccf8 into develop Feb 20, 2022
@skaldarnar skaldarnar deleted the refactor/use-entitybuilder-for-testcharacter-creation branch February 20, 2022 12:09
skaldarnar added a commit that referenced this pull request Mar 13, 2022
- style: format `.behavior` files
- chore: add TODO ideas and questions in several places
- chore: add some debug logging
- feature/fix: small adjustments to Behaviors logic

Follow-up PR to #89.

Related PRs (extracted from this): #94, #96, #97, #99.

Contributes to MovingBlocks/Terasology#4981.

Depends on Terasology/FlexiblePathfinding#26 and Terasology/FlexiblePathfinding#27.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Test/QA Requests, Issues and Changes targeting tests and quality assurance Size: S Small effort likely only affecting a single area and requiring little to no research Topic: AI Requests, Issues and Changes related to pathfinding, behaviors, etc. Type: Refactoring Request for or implementation of pure and automatic refactorings, e.g. renaming, to improve clarity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants