Added focus mode to radar feature

master
shoaib11120 2022-01-22 10:53:24 +05:30
parent c5e72d545b
commit 590fe5288f
1 changed files with 36 additions and 32 deletions

View File

@ -223,15 +223,19 @@ namespace stardew_access.Game
} }
} }
public void playSoundAt(Vector2 position, String? searchQuery, Type soundType) public void playSoundAt(Vector2 position, String searchQuery, Type soundType)
{ {
// Skip if player is directly looking at the tile // Skip if player is directly looking at the tile
if (CurrentPlayer.getNextTile().Equals(position)) if (CurrentPlayer.getNextTile().Equals(position))
return; return;
if (searchQuery == null || !exclusions.Contains(searchQuery.ToLower().Trim())) if (!radarFocus && exclusions.Contains(searchQuery.ToLower().Trim()))
{ return;
if(MainClass.radarDebug)
if (radarFocus && !focus.Contains(searchQuery.ToLower().Trim()))
return;
if (MainClass.radarDebug)
MainClass.monitor.Log($"Object:{searchQuery.ToLower().Trim()}\tPosition: X={position.X} Y={position.Y}", StardewModdingAPI.LogLevel.Debug); MainClass.monitor.Log($"Object:{searchQuery.ToLower().Trim()}\tPosition: X={position.X} Y={position.Y}", StardewModdingAPI.LogLevel.Debug);
int px = (int)Game1.player.getTileX(); // Player's X postion int px = (int)Game1.player.getTileX(); // Player's X postion
@ -243,7 +247,7 @@ namespace stardew_access.Game
int dx = ox - px; // Distance of object's X position int dx = ox - px; // Distance of object's X position
int dy = oy - py; // Distance of object's Y position int dy = oy - py; // Distance of object's Y position
if(dy < 0 && (Math.Abs(dy) >= Math.Abs(dx))) // Object is at top if (dy < 0 && (Math.Abs(dy) >= Math.Abs(dx))) // Object is at top
{ {
Game1.currentLocation.localSoundAt(getSoundName(soundType, "top"), position); Game1.currentLocation.localSoundAt(getSoundName(soundType, "top"), position);
} }
@ -259,7 +263,7 @@ namespace stardew_access.Game
{ {
Game1.currentLocation.localSoundAt(getSoundName(soundType, "bottom"), position); Game1.currentLocation.localSoundAt(getSoundName(soundType, "bottom"), position);
} }
}
} }
public string getSoundName(Type soundType, string post) public string getSoundName(Type soundType, string post)
@ -329,13 +333,13 @@ namespace stardew_access.Game
public void enableFocus() public void enableFocus()
{ {
temp_exclusions = exclusions; temp_exclusions = exclusions.ToList();
exclusions.Clear(); exclusions.Clear();
} }
public void disableFocus() public void disableFocus()
{ {
exclusions = temp_exclusions; exclusions = temp_exclusions.ToList();
temp_exclusions.Clear(); temp_exclusions.Clear();
} }
} }