-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Mods: Add New "Wayback" Mod #21673
base: master
Are you sure you want to change the base?
Mods: Add New "Wayback" Mod #21673
Conversation
The Wayback mod delays the motion of your cursor by a little bit. It makes the cursor feel sorta slippery. This does not delay the actual internal cursor, only the visuals. Warning: This is ducktaped together with spaghetti code.
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 don't think this will be accepted by the core devs but here's a few things i've personally spotted that cant remain the way they are
osu.Game/Rulesets/Mods/ModWayback.cs
Outdated
} | ||
return multiplier; | ||
} | ||
} |
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.
multipliers should not be added initially
{ | ||
TruePosition = TargetPosition; | ||
} | ||
ActiveCursor.Position = TruePosition; |
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.
changes from mods should be done through interfaces ( check any other mod to see how its done )
@@ -31,7 +31,7 @@ public partial class OsuCursorContainer : GameplayCursorContainer, IKeyBindingHa | |||
|
|||
private readonly Bindable<bool> showTrail = new Bindable<bool>(true); | |||
|
|||
private readonly Drawable cursorTrail; | |||
public readonly Drawable CursorTrail; |
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 dont think this will fly, theres no way mods should be accesing the cursor directly, check other mods, i dont think theres a single one that access whatever its changing in this fashion
osuPlayfield.Cursor.Delayed = true; | ||
osuPlayfield.Cursor.FollowSpeed = FollowSpeed.Value; | ||
((OsuCursorContainer)osuPlayfield.Cursor).CursorTrail.Alpha = 0; | ||
osuPlayfield.Smoke.Alpha = 0; |
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.
Why are you setting values that don't change during gameplay in update?? this runs continously
Wait why are we disabling the cursor trail/smoke? I don't see any reason to do this (apart from the difficulty of implementation) also we prefer to merge from topic branches instead of from master, see CONTRIBUTING.md |
if (Delayed) | ||
{ | ||
TruePosition = Vector2.Lerp(TruePosition, TargetPosition, (float)Time.Elapsed / 1000 * FollowSpeed); | ||
} | ||
else | ||
{ | ||
TruePosition = TargetPosition; | ||
} | ||
ActiveCursor.Position = TruePosition; |
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.
What is the point of TruePosition
here? Can't you just set ActiveCursor.Position
directly?
return multiplier; | ||
} | ||
} | ||
public override Type[] IncompatibleMods => new Type[] { typeof(ModNoScope) }; |
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.
Might want to add autopilot to the list of incompatible mods
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.
It is, in the osu ruleset, because there is no generic ModAutopilot, just OsuModAutopilot, but thanks for the feedback!
osu.Game/Rulesets/Mods/ModWayback.cs
Outdated
double multiplier = 1; | ||
float followSpeed = FollowSpeed.Value; | ||
double pos = 0; | ||
while (pos < 90) | ||
{ | ||
multiplier += 0.01; | ||
pos += (100 - pos) / 100 * followSpeed; | ||
} | ||
return multiplier; |
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.
What is this supposed to do? I don't understand this
You probably shouldn't put that much thought into score multipliers for the time being.
@@ -170,7 +170,7 @@ private partial class DefaultCursorTrail : CursorTrail | |||
[BackgroundDependencyLoader] | |||
private void load(TextureStore textures) | |||
{ | |||
Texture = textures.Get(@"Cursor/cursortrail"); | |||
Texture = textures.Get(@"Cursor/CursorTrail"); |
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 have a feeling this will break something...
Thank you for pointing out these flaws in my code. |
I think I've made all the changes requested. |
still needs a lot of work, outside of code issues which i might be willing to fix myself, i have issues with how the mod works right now in general, because the cursor isnt delayed, its simply "magnetised", id expect it to follow the exact path the real cursor took but with some delay |
I made the changes requested. |
protected override void Update() { | ||
foreach (IHidesCursorTrail modifier in Mods.OfType<IHidesCursorTrail>()) | ||
{ | ||
cursorTrail.Alpha = 0; | ||
} // FIXME: Don't do this every frame. It's only like this right now because for some reason it won't work if I only do it once. | ||
base.Update(); | ||
} | ||
|
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.
If you want to get the PR into a mergeable state this definitely needs to be fixed
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.
Will fix!
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.
Fixed!
Position = TargetPosition; | ||
foreach (IModifiesCursorMovement modifier in Mods.OfType<IModifiesCursorMovement>()) | ||
{ | ||
Position = modifier.UpdatePosition(TargetPosition, (float)Time.Elapsed / 1000f); | ||
} |
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.
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.
Am I being dumb, because it looks like the examples given don't have it done in another class.
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.
My point is just that I don't think a cursor should check if there are any mods and apply them if necessary. Imo this task shouldn't do a cursor.
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'm not exactly sure what you meant, I moved it to Playfield. Is this correct?
I'm not sure what it should be named, but definitely not "wayback". |
"set back" perhaps? |
Wayback delays your cursor by a variable amount of time.
This mod provides an interesting challenge.
In order to implement this, I had to introduce an interface for modifying the cursor position.