-
Notifications
You must be signed in to change notification settings - Fork 18
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
refactor: use EntityBuilder for creating test character #97
Conversation
moveComponent.movementTypes.addAll(Sets.newHashSet(movementTypes)); | ||
return moveComponent; | ||
}); | ||
builder.updateComponent(CharacterMovementComponent.class, characterMovement -> { |
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.
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...
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.
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.
- 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.
Extracted from #92