Added option to allow tile cursor to view the entire map regardless if it is visible or not.

master
bradjrenshaw 2022-05-10 16:31:54 -04:00
parent 955ffac65b
commit 7a1b768bdb
2 changed files with 11 additions and 3 deletions

View File

@ -6,7 +6,6 @@ using StardewValley;
using StardewValley.Menus; using StardewValley.Menus;
using stardew_access.Features; using stardew_access.Features;
namespace stardew_access.Features namespace stardew_access.Features
{ {
public class MouseHandler public class MouseHandler
@ -137,13 +136,13 @@ namespace stardew_access.Features
private bool tryMoveTileView(Vector2 delta) private bool tryMoveTileView(Vector2 delta)
{ {
Vector2 dest = this.getTileCursorPosition() + delta; Vector2 dest = this.getTileCursorPosition() + delta;
if (Utility.isOnScreen(dest, 0)) if (!isPositionOnMap(dest)) return false;
if ((MainClass.Config.LimitTileCursorToScreen && Utility.isOnScreen(dest, 0)) || !MainClass.Config.LimitTileCursorToScreen)
{ {
if (this.relativeOffsetLock) if (this.relativeOffsetLock)
this.relativeOffsetLockPosition += delta; this.relativeOffsetLockPosition += delta;
else else
this.ViewingOffset += delta; this.ViewingOffset += delta;
return true; return true;
} }
return false; return false;
@ -180,5 +179,13 @@ namespace stardew_access.Features
} }
return true; return true;
} }
private static bool isPositionOnMap(Vector2 position)
{
Map map = Game1.currentLocation.map;
if (position.X < 0 || position.X > map.Layers[0].DisplayWidth) return false;
if (position.Y < 0 || position.Y > map.Layers[0].DisplayHeight) return false;
return true;
}
} }
} }

View File

@ -25,6 +25,7 @@ namespace stardew_access
public KeybindList TimeNSeasonKey { get; set; } = KeybindList.Parse("Q"); public KeybindList TimeNSeasonKey { get; set; } = KeybindList.Parse("Q");
public KeybindList ReadTileKey { get; set; } = KeybindList.Parse("J"); public KeybindList ReadTileKey { get; set; } = KeybindList.Parse("J");
public KeybindList ReadStandingTileKey { get; set; } = KeybindList.Parse("LeftAlt + J"); public KeybindList ReadStandingTileKey { get; set; } = KeybindList.Parse("LeftAlt + J");
public bool LimitTileCursorToScreen { get; set; } = false;
public int TileCursorPreciseMovementDistance { get; set; } = 8; public int TileCursorPreciseMovementDistance { get; set; } = 8;
//Tile viewer keys //Tile viewer keys