Skip to content

Commit

Permalink
Prevent place 0 duration notes
Browse files Browse the repository at this point in the history
  • Loading branch information
LumpBloom7 committed Jan 12, 2025
1 parent 6d0b17b commit 59a097d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Sentakki.Edit.Blueprints.Holds
{
public partial class HoldPlacementBlueprint : SentakkiPlacementBlueprint<Hold>
{
protected override bool IsValidForPlacement => HitObject.Duration > 0;
private readonly HoldHighlight highlight;

public HoldPlacementBlueprint()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public partial class SlidePlacementBlueprint : SentakkiPlacementBlueprint<Slide>

private readonly SlideVisual bodyHighlight;
private readonly SlideVisual commited;
protected override bool IsValidForPlacement => HitObject.Duration > 0 && commitedSlideBodyInfo?.SlidePathParts?.Length > 0;

[Resolved]
private SlideEditorToolboxGroup slidePlacementToolbox { get; set; } = null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace osu.Game.Rulesets.Sentakki.Edit.Blueprints.TouchHolds
{
public partial class TouchHoldPlacementBlueprint : SentakkiPlacementBlueprint<TouchHold>
{
protected override bool IsValidForPlacement => HitObject.Duration > 0;

public TouchHoldPlacementBlueprint()
{
InternalChild = new TouchHoldHighlight();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public override void UpdateTimeAndPosition(SnapResult result)

var newPosition = ToLocalSpace(result.ScreenSpacePosition) - OriginPosition;

if (Vector2.Distance(Vector2.Zero, newPosition) > 250)
if (Vector2.Distance(Vector2.Zero, newPosition) > 270)
{
float angle = Vector2.Zero.GetDegreesFromPosition(newPosition);
newPosition = SentakkiExtensions.GetCircularPosition(250, angle);
newPosition = SentakkiExtensions.GetCircularPosition(270, angle);
}

HitObject.Position = newPosition;
Expand Down
8 changes: 8 additions & 0 deletions osu.Game.Rulesets.Sentakki/Objects/Slide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ public double Duration
}
set
{
if (Duration == 0)
{
foreach (var slide in SlideInfoList)
slide.Duration = value;

return;
}

double ratio = value / Duration;

foreach (var slide in SlideInfoList)
Expand Down

0 comments on commit 59a097d

Please sign in to comment.