Added auto walk feature to tile viewer
parent
3c76c424e8
commit
c8b274347e
|
@ -20,6 +20,8 @@ namespace stardew_access.Features
|
||||||
private Vector2 relativeOffsetLockPosition = Vector2.Zero;
|
private Vector2 relativeOffsetLockPosition = Vector2.Zero;
|
||||||
private Boolean relativeOffsetLock = false;
|
private Boolean relativeOffsetLock = false;
|
||||||
private Vector2 prevPlayerPosition = Vector2.Zero, prevFacing = Vector2.Zero;
|
private Vector2 prevPlayerPosition = Vector2.Zero, prevFacing = Vector2.Zero;
|
||||||
|
private Boolean isAutoWalking = false;
|
||||||
|
private Vector2 finalTile = Vector2.Zero;
|
||||||
|
|
||||||
private Vector2 PlayerFacingVector
|
private Vector2 PlayerFacingVector
|
||||||
{
|
{
|
||||||
|
@ -129,6 +131,22 @@ namespace stardew_access.Features
|
||||||
{
|
{
|
||||||
this.cursorMoveInput(new Vector2(-Game1.tileSize, 0));
|
this.cursorMoveInput(new Vector2(-Game1.tileSize, 0));
|
||||||
}
|
}
|
||||||
|
else if (MainClass.Config.AutoWalkToTile.JustPressed() && StardewModdingAPI.Context.IsPlayerFree)
|
||||||
|
{
|
||||||
|
PathFindController controller = new PathFindController(Game1.player, Game1.currentLocation, this.GetViewingTile().ToPoint(), Game1.player.FacingDirection);
|
||||||
|
controller.allowPlayerPathingInEvent = true;
|
||||||
|
if (controller.pathToEndPoint != null && controller.pathToEndPoint.Count > 0)
|
||||||
|
{
|
||||||
|
Game1.player.controller = controller;
|
||||||
|
this.isAutoWalking = true;
|
||||||
|
this.finalTile = this.GetViewingTile();
|
||||||
|
MainClass.ScreenReader.Say($"Moving to {this.finalTile.X}x {this.finalTile.Y}y", true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainClass.ScreenReader.Say($"Cannot move to {this.finalTile.X}x {this.finalTile.Y}y", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cursorMoveInput(Vector2 delta, Boolean precise = false)
|
private void cursorMoveInput(Vector2 delta, Boolean precise = false)
|
||||||
|
@ -200,6 +218,14 @@ namespace stardew_access.Features
|
||||||
this.prevPlayerPosition = this.PlayerPosition;
|
this.prevPlayerPosition = this.PlayerPosition;
|
||||||
if (MainClass.Config.SnapMouse)
|
if (MainClass.Config.SnapMouse)
|
||||||
this.SnapMouseToPlayer();
|
this.SnapMouseToPlayer();
|
||||||
|
|
||||||
|
if (this.isAutoWalking && this.finalTile != Vector2.Zero && this.finalTile == CurrentPlayer.Position)
|
||||||
|
{
|
||||||
|
MainClass.ScreenReader.Say("Reached destination", true);
|
||||||
|
this.finalTile = Vector2.Zero;
|
||||||
|
this.isAutoWalking = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool allowMouseSnap(Vector2 point)
|
private static bool allowMouseSnap(Vector2 point)
|
||||||
|
|
|
@ -38,6 +38,7 @@ namespace stardew_access
|
||||||
public KeybindList TileCursorPreciseDownKey { get; set; } = KeybindList.Parse("LeftShift + Down");
|
public KeybindList TileCursorPreciseDownKey { get; set; } = KeybindList.Parse("LeftShift + Down");
|
||||||
public KeybindList TileCursorPreciseLeftKey { get; set; } = KeybindList.Parse("LeftShift + Left");
|
public KeybindList TileCursorPreciseLeftKey { get; set; } = KeybindList.Parse("LeftShift + Left");
|
||||||
public KeybindList ToggleRelativeCursorLockKey { get; set; } = KeybindList.Parse("L");
|
public KeybindList ToggleRelativeCursorLockKey { get; set; } = KeybindList.Parse("L");
|
||||||
|
public KeybindList AutoWalkToTile { get; set; } = KeybindList.Parse("LeftControl + Enter");
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// TODO Add the exclusion and focus list too
|
// TODO Add the exclusion and focus list too
|
||||||
|
|
Loading…
Reference in New Issue