Read tile pauses while auto walking
parent
fcd6c8ecb3
commit
f85192178f
|
@ -34,15 +34,31 @@ namespace stardew_access.Features
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pauses the read tile for the provided time.
|
/// Pauses the feature for the provided time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="time">The amount of time we want to pause the execution (in ms).<br/>Default is 2500 (2.5s).</param>
|
/// <param name="time">The amount of time we want to pause the execution (in ms).<br/>Default is 2500 (2.5s).</param>
|
||||||
public void pause(int time = 2500)
|
public void pauseUntil(int time = 2500)
|
||||||
{
|
{
|
||||||
this.shouldPause = true;
|
this.shouldPause = true;
|
||||||
Task.Delay(time).ContinueWith(_ => { this.shouldPause = false; });
|
Task.Delay(time).ContinueWith(_ => { this.shouldPause = false; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pauses the feature
|
||||||
|
/// </summary>
|
||||||
|
public void pause()
|
||||||
|
{
|
||||||
|
this.shouldPause = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resumes the feature
|
||||||
|
/// </summary>
|
||||||
|
public void resume()
|
||||||
|
{
|
||||||
|
this.shouldPause = false;
|
||||||
|
}
|
||||||
|
|
||||||
public void run(bool manuallyTriggered = false, bool playersPosition = false)
|
public void run(bool manuallyTriggered = false, bool playersPosition = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -148,6 +148,7 @@ namespace stardew_access.Features
|
||||||
Game1.player.controller = controller;
|
Game1.player.controller = controller;
|
||||||
this.isAutoWalking = true;
|
this.isAutoWalking = true;
|
||||||
this.finalTile = this.GetViewingTile();
|
this.finalTile = this.GetViewingTile();
|
||||||
|
MainClass.ReadTileFeature.pause();
|
||||||
MainClass.ScreenReader.Say($"Moving to {this.finalTile.X}x {this.finalTile.Y}y", true);
|
MainClass.ScreenReader.Say($"Moving to {this.finalTile.X}x {this.finalTile.Y}y", true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -165,6 +166,7 @@ namespace stardew_access.Features
|
||||||
this.finalTile = Vector2.Zero;
|
this.finalTile = Vector2.Zero;
|
||||||
this.isAutoWalking = false;
|
this.isAutoWalking = false;
|
||||||
Game1.player.controller = null;
|
Game1.player.controller = null;
|
||||||
|
MainClass.ReadTileFeature.resume();
|
||||||
if (wasForced)
|
if (wasForced)
|
||||||
MainClass.ScreenReader.Say("Stopped moving", true);
|
MainClass.ScreenReader.Say("Stopped moving", true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace stardew_access.Features
|
||||||
{
|
{
|
||||||
MainClass.ScreenReader.Say(toSpeak, true);
|
MainClass.ScreenReader.Say(toSpeak, true);
|
||||||
// Pause the read tile feature to prevent interruption in warning message
|
// Pause the read tile feature to prevent interruption in warning message
|
||||||
MainClass.ReadTileFeature.pause();
|
MainClass.ReadTileFeature.pauseUntil();
|
||||||
}
|
}
|
||||||
|
|
||||||
prevHour = hours;
|
prevHour = hours;
|
||||||
|
@ -50,7 +50,7 @@ namespace stardew_access.Features
|
||||||
{
|
{
|
||||||
MainClass.ScreenReader.Say(toSpeak, true);
|
MainClass.ScreenReader.Say(toSpeak, true);
|
||||||
// Pause the read tile feature to prevent interruption in warning message
|
// Pause the read tile feature to prevent interruption in warning message
|
||||||
MainClass.ReadTileFeature.pause();
|
MainClass.ReadTileFeature.pauseUntil();
|
||||||
}
|
}
|
||||||
|
|
||||||
prevStamina = stamina;
|
prevStamina = stamina;
|
||||||
|
@ -68,7 +68,7 @@ namespace stardew_access.Features
|
||||||
{
|
{
|
||||||
MainClass.ScreenReader.Say(toSpeak, true);
|
MainClass.ScreenReader.Say(toSpeak, true);
|
||||||
// Pause the read tile feature to prevent interruption in warning message
|
// Pause the read tile feature to prevent interruption in warning message
|
||||||
MainClass.ReadTileFeature.pause();
|
MainClass.ReadTileFeature.pauseUntil();
|
||||||
}
|
}
|
||||||
|
|
||||||
prevHealth = health;
|
prevHealth = health;
|
||||||
|
|
Loading…
Reference in New Issue