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

Mods: Add New "Wayback" Mod #21673

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft

Mods: Add New "Wayback" Mod #21673

wants to merge 11 commits into from

Conversation

jessiejs
Copy link

@jessiejs jessiejs commented Dec 16, 2022

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.

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.
Copy link
Contributor

@mk56-spn mk56-spn left a 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

}
return multiplier;
}
}
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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

@ghost
Copy link

ghost commented Dec 17, 2022

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

Comment on lines 37 to 45
if (Delayed)
{
TruePosition = Vector2.Lerp(TruePosition, TargetPosition, (float)Time.Elapsed / 1000 * FollowSpeed);
}
else
{
TruePosition = TargetPosition;
}
ActiveCursor.Position = TruePosition;
Copy link

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) };
Copy link

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

Copy link
Author

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!

Comment on lines 18 to 26
double multiplier = 1;
float followSpeed = FollowSpeed.Value;
double pos = 0;
while (pos < 90)
{
multiplier += 0.01;
pos += (100 - pos) / 100 * followSpeed;
}
return multiplier;
Copy link

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");
Copy link

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...

@jessiejs
Copy link
Author

Thank you for pointing out these flaws in my code.
I should be able to start fixing these issues on Monday.

@jessiejs
Copy link
Author

I think I've made all the changes requested.
Please tell me if it needs any more changes.

@jessiejs jessiejs requested a review from mk56-spn December 22, 2022 00:00
@mk56-spn
Copy link
Contributor

mk56-spn commented Dec 23, 2022

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

@jessiejs
Copy link
Author

I made the changes requested.
Personally, I think we should rename the mod to "Ping" now, for clarity.

Comment on lines 94 to 101
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();
}

Copy link
Contributor

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

Copy link
Author

Choose a reason for hiding this comment

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

Will fix!

Copy link
Author

Choose a reason for hiding this comment

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

Fixed!

Comment on lines 41 to 45
Position = TargetPosition;
foreach (IModifiesCursorMovement modifier in Mods.OfType<IModifiesCursorMovement>())
{
Position = modifier.UpdatePosition(TargetPosition, (float)Time.Elapsed / 1000f);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Something like this should be done in another class, see: this or this

Copy link
Author

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.

Copy link
Contributor

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.

Copy link
Author

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?

@peppy
Copy link
Member

peppy commented Jan 9, 2023

I'm not sure what it should be named, but definitely not "wayback".

@mk56-spn
Copy link
Contributor

mk56-spn commented Jan 9, 2023

"set back" perhaps?

@jessiejs jessiejs requested review from a user and mk56-spn and removed request for mk56-spn and a user January 23, 2023 04:51
@jessiejs jessiejs removed the request for review from a user February 19, 2023 23:25
@jessiejs jessiejs requested a review from mk56-spn February 19, 2023 23:25
@peppy peppy marked this pull request as draft June 16, 2023 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants