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

fix: Remove mustCallSuper from onComponentTypeCheck #2561

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/flame/collision_detection.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ class Bullet extends PositionComponent with CollisionCallbacks {
// do NOT collide with Player or Water
return false;
}
// Just return true if you not interested in component parent's type check result.
// Or call super it component's parent should be able to override the result.
spydon marked this conversation as resolved.
Show resolved Hide resolved
return super.onComponentTypeCheck(other);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/flame/lib/src/collisions/collision_callbacks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ mixin GenericCollisionCallbacks<T> {
/// reimplement [onComponentTypeCheck]. The result of calculation is cached
/// so you should not check any dynamical parameters here, the function
/// intended to be used as pure type checker.
@mustCallSuper
/// Call super.onComponentTypeCheck to get component parent's result of
spydon marked this conversation as resolved.
Show resolved Hide resolved
/// type check if needed. In other causes this call is redundant in game code
spydon marked this conversation as resolved.
Show resolved Hide resolved
bool onComponentTypeCheck(PositionComponent other);

/// Assign your own [CollisionCallback] if you want a callback when this
Expand Down Expand Up @@ -136,7 +137,6 @@ mixin CollisionCallbacks on Component
}

@override
@mustCallSuper
bool onComponentTypeCheck(PositionComponent other) {
final myParent = parent;
final otherParent = other.parent;
Expand Down