Added command to include key to exclusion
parent
6c8eddd08b
commit
469ed0a6a6
|
@ -77,6 +77,8 @@ namespace stardew_access.Game
|
|||
}
|
||||
|
||||
public void checkTile(Vector2 position)
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<Vector2, Netcode.NetRef<TerrainFeature>> terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict;
|
||||
|
||||
|
@ -123,11 +125,11 @@ namespace stardew_access.Game
|
|||
string? terrain = ReadTile.getTerrainFeatureAtTile(tr).ToLower();
|
||||
if (terrain != null)
|
||||
{
|
||||
if(tr.Get() is HoeDirt && !exclusions.Contains("crop"))
|
||||
if (tr.Get() is HoeDirt && !exclusions.Contains("crop"))
|
||||
{
|
||||
playSoundAt(position, terrain);
|
||||
}
|
||||
else if(tr.Get() is GiantCrop && !exclusions.Contains("giant crop"))
|
||||
else if (tr.Get() is GiantCrop && !exclusions.Contains("giant crop"))
|
||||
{
|
||||
playSoundAt(position, terrain);
|
||||
}
|
||||
|
@ -186,12 +188,17 @@ namespace stardew_access.Game
|
|||
playSoundAt(position, ReadTile.getResourceClumpAtTile((int)position.X, (int)position.Y));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MainClass.monitor.Log($"{e.Message}\n{e.StackTrace}\n{e.Source}", StardewModdingAPI.LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
public void playSoundAt(Vector2 position, String? searchQuery)
|
||||
{
|
||||
if (searchQuery == null || !exclusions.Contains(searchQuery))
|
||||
{
|
||||
MainClass.monitor.Log($"{searchQuery}:X={position.X} Y={position.Y}", StardewModdingAPI.LogLevel.Debug);
|
||||
MainClass.monitor.Log($"Object:{searchQuery}\tPosition: X={position.X} Y={position.Y}", StardewModdingAPI.LogLevel.Debug);
|
||||
Game1.currentLocation.localSoundAt("sa_poi", position);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,6 +104,10 @@ namespace stardew_access.Game
|
|||
public static string? getBuildingAtTile(int x, int y)
|
||||
{
|
||||
string? toReturn = null;
|
||||
|
||||
// It throws error if it can't find the index, do something else to fix this
|
||||
try
|
||||
{
|
||||
int? index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
|
||||
/* Add More
|
||||
MainClass.monitor.Log(index.ToString(), LogLevel.Debug);
|
||||
|
@ -139,6 +143,8 @@ namespace stardew_access.Game
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception) {}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
|
|
@ -222,35 +222,46 @@ namespace stardew_access
|
|||
#endregion
|
||||
|
||||
#region Custom Commands
|
||||
helper.ConsoleCommands.Add("read_tile", "Toggle read tile feature", (string arg1, string[] arg2) =>
|
||||
helper.ConsoleCommands.Add("read_tile", "Toggle read tile feature", (string commmand, string[] args) =>
|
||||
{
|
||||
readTile = !readTile;
|
||||
|
||||
monitor.Log("Read Tile is " + (readTile ? "on" : "off"), LogLevel.Info);
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("snap_mouse", "Toggle snap mouse feature", (string arg1, string[] arg2) =>
|
||||
helper.ConsoleCommands.Add("snap_mouse", "Toggle snap mouse feature", (string commmand, string[] args) =>
|
||||
{
|
||||
snapMouse = !snapMouse;
|
||||
|
||||
monitor.Log("Snap Mouse is " + (snapMouse ? "on" : "off"), LogLevel.Info);
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("radar", "Toggle radar feature", (string arg1, string[] arg2) =>
|
||||
helper.ConsoleCommands.Add("radar", "Toggle radar feature", (string commmand, string[] args) =>
|
||||
{
|
||||
radar = !radar;
|
||||
|
||||
monitor.Log("Radar " + (snapMouse ? "on" : "off"), LogLevel.Info);
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("r_in", "Include an object to radar", (string arg1, string[] arg2) =>
|
||||
helper.ConsoleCommands.Add("r_in", "Include an object to radar", (string commmand, string[] args) =>
|
||||
{
|
||||
radar = !radar;
|
||||
string? keyToAdd = null;
|
||||
|
||||
monitor.Log("Radar " + (snapMouse ? "on" : "off"), LogLevel.Info);
|
||||
for (int i = 0; i < args.Count(); i++) { keyToAdd += " " + args[i]; }
|
||||
|
||||
if (keyToAdd != null)
|
||||
{
|
||||
keyToAdd = keyToAdd.Trim().ToLower();
|
||||
radarFeature.exclusions.Add(keyToAdd);
|
||||
monitor.Log($"Added {keyToAdd} key to exclusions.", LogLevel.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
monitor.Log("Unable to add the key to exclusions.", LogLevel.Info);
|
||||
}
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("ref_sr", "Refresh screen reader", (string arg1, string[] arg2) =>
|
||||
helper.ConsoleCommands.Add("ref_sr", "Refresh screen reader", (string commmand, string[] args) =>
|
||||
{
|
||||
ScreenReader.initializeScreenReader();
|
||||
|
||||
|
|
Loading…
Reference in New Issue