Fixed bug with tile cursor not passing exact integer tile values causing terrain features like crops to not be read out.

master
bradjrenshaw 2022-05-10 14:21:17 -04:00
parent 838273b3ce
commit 332dd858a8
1 changed files with 5 additions and 4 deletions

View File

@ -63,9 +63,9 @@ namespace stardew_access.Features
private void cursorMoveInput(Vector2 delta, Boolean precise = false) private void cursorMoveInput(Vector2 delta, Boolean precise = false)
{ {
if (!tryMoveTileView(delta)) return; if (!tryMoveTileView(delta)) return;
Vector2 position = this.getTileCursorPosition(); Vector2 position = this.getTileCursorPosition();
Vector2 tile = position / Game1.tileSize; Vector2 tile = new Vector2((float)Math.Floor(position.X / Game1.tileSize), (float)Math.Floor(position.Y / Game1.tileSize));
String ?name = TileInfo.getNameAtTile(tile); String ?name = TileInfo.getNameAtTile(tile);
if (name == null) if (name == null)
{ {
@ -79,7 +79,7 @@ namespace stardew_access.Features
} }
if (precise) if (precise)
{ {
MainClass.ScreenReader.Say($"{position.X}, {position.Y}", true); MainClass.ScreenReader.Say($"{name}, {position.X}, {position.Y}", true);
} }
else else
{ {
@ -111,6 +111,7 @@ namespace stardew_access.Features
public void update() public void update()
{ {
//Reset the viewing cursor to the player when they turn or move. This will not reset the locked offset relative cursor position.
if (this.prevFacing != this.PlayerFacingVector || this.prevPlayerPosition != this.PlayerPosition) if (this.prevFacing != this.PlayerFacingVector || this.prevPlayerPosition != this.PlayerPosition)
{ {
this.ViewingOffset = Vector2.Zero; this.ViewingOffset = Vector2.Zero;
@ -119,6 +120,7 @@ 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 (MainClass.Config.TileCursorUpKey.JustPressed()) if (MainClass.Config.TileCursorUpKey.JustPressed())
{ {
this.cursorMoveInput(new Vector2(0, -Game1.tileSize)); this.cursorMoveInput(new Vector2(0, -Game1.tileSize));
@ -137,7 +139,6 @@ namespace stardew_access.Features
} }
} }
private static bool allowMouseSnap(Vector2 point) private static bool allowMouseSnap(Vector2 point)
{ {
if (!Utility.isOnScreen(point, 0)) return false; if (!Utility.isOnScreen(point, 0)) return false;