Open Flutterish opened 4 years ago
What you’ve mentioned is exactly what’s happening here. Don’t do that.
Does the position transformation not know that the target is a Drawable / implements a position interface? Metadata shows that it does. I don't think a reflection is the best way to implement this.
The transform helpers use reflection to be infinitely extensible for user code without being aware of user classes. There is no way I'm aware of to achieve that without reflection.
The extension methods have a generic constraint to T : Drawable
. These ones can make use of that information ( as there is no other Position
a drawable wants to animate ) using Transform<Vector2, Drawable>
, can they not?
Whether "there is no other Position
to animate" is arguable. Somebody might want to overwrite Position
(as you did yourself) and have that transformed instead.
Choosing which one it should be at that point is pretty arbitrary; using the new
one seems more consistent with other members unknown to Drawable
to me.
Oh, if this is the generic use case, then absolutely. It seems to me that if one would want to do that they'd use TransformBindable
or MakeTransform
instead though. It might be just my ( likely less than yours ) coding experience telling me things constrained to X should only interact with X.
I misread this a little bit as overriding Position
, but I can see how this can get confusing and be undesirable in the context of new
. May reconsider.
Describe the bug: Given this code:
(
crasher
is not used anywhere else ) osu!lazer crashes without anException
. I assume some transformation uses reflections to setPosition
which results in infinite recursion.Screenshots or videos showing encountered issue: Replicable.
osu!lazer version: 2020.717.0
Logs: network.log runtime.log updater.log database.log performance.log