Added watered/unwatered toggle for crops

master
Mohammad Shoaib Khan 2022-08-18 12:18:40 +05:30
parent 2df4cfca27
commit 6d18849f17
3 changed files with 19 additions and 5 deletions

View File

@ -39,6 +39,14 @@ namespace stardew_access
MainClass.DebugLog("Flooring is " + (MainClass.Config.ReadFlooring ? "on" : "off")); MainClass.DebugLog("Flooring is " + (MainClass.Config.ReadFlooring ? "on" : "off"));
}); });
helper.ConsoleCommands.Add("watered", "Toggle speaking watered or unwatered for crops.", (string commmand, string[] args) =>
{
MainClass.Config.WateredToggle = !MainClass.Config.WateredToggle;
helper.WriteConfig(MainClass.Config);
MainClass.DebugLog("Watered toggle is " + (MainClass.Config.WateredToggle ? "on" : "off"));
});
#region Radar Feature #region Radar Feature
helper.ConsoleCommands.Add("radar", "Toggle radar feature.", (string commmand, string[] args) => helper.ConsoleCommands.Add("radar", "Toggle radar feature.", (string commmand, string[] args) =>
{ {

View File

@ -543,8 +543,9 @@ namespace stardew_access.Features
/// Returns the detail about the HoeDirt i.e. soil, plant, etc. /// Returns the detail about the HoeDirt i.e. soil, plant, etc.
/// </summary> /// </summary>
/// <param name="dirt">The HoeDirt to be checked</param> /// <param name="dirt">The HoeDirt to be checked</param>
/// <param name="ignoreIfEmpty">Ignores returning `soil` if empty</param>
/// <returns>The details about the given HoeDirt</returns> /// <returns>The details about the given HoeDirt</returns>
public static string getHoeDirtDetail(HoeDirt dirt) public static string getHoeDirtDetail(HoeDirt dirt, bool ignoreIfEmpty = false)
{ {
string detail; string detail;
@ -557,8 +558,10 @@ namespace stardew_access.Features
bool isHarvestable = dirt.readyForHarvest(); bool isHarvestable = dirt.readyForHarvest();
bool isFertilized = dirt.fertilizer.Value != HoeDirt.noFertilizer; bool isFertilized = dirt.fertilizer.Value != HoeDirt.noFertilizer;
if (isWatered) if (isWatered && MainClass.Config.WateredToggle)
detail = "Watered " + detail; detail = "Watered " + detail;
else if (!isWatered && !MainClass.Config.WateredToggle)
detail = "Unwatered " + detail;
if (isFertilized) if (isFertilized)
detail = "Fertilized " + detail; detail = "Fertilized " + detail;
@ -580,12 +583,14 @@ namespace stardew_access.Features
} }
else else
{ {
detail = "Soil"; detail = (ignoreIfEmpty) ? "" : "Soil";
bool isWatered = dirt.state.Value == HoeDirt.watered; bool isWatered = dirt.state.Value == HoeDirt.watered;
bool isFertilized = dirt.fertilizer.Value != HoeDirt.noFertilizer; bool isFertilized = dirt.fertilizer.Value != HoeDirt.noFertilizer;
if (isWatered) if (isWatered && MainClass.Config.WateredToggle)
detail = "Watered " + detail; detail = "Watered " + detail;
else if (!isWatered && !MainClass.Config.WateredToggle)
detail = "Unwatered " + detail;
if (isFertilized) if (isFertilized)
detail = "Fertilized " + detail; detail = "Fertilized " + detail;
@ -709,7 +714,7 @@ namespace stardew_access.Features
} }
else if (obj is IndoorPot indoorPot) else if (obj is IndoorPot indoorPot)
{ {
toReturn.name = $"{obj.DisplayName}, {getHoeDirtDetail(indoorPot.hoeDirt)}"; toReturn.name = $"{obj.DisplayName}, {getHoeDirtDetail(indoorPot.hoeDirt, true)}";
} }
else if (obj is Sign sign) else if (obj is Sign sign)
{ {

View File

@ -23,6 +23,7 @@ namespace stardew_access
public KeybindList ReadTileKey { get; set; } = KeybindList.Parse("J"); // Manually trigger read tile for the tile player is *looking at*. public KeybindList ReadTileKey { get; set; } = KeybindList.Parse("J"); // Manually trigger read tile for the tile player is *looking at*.
public KeybindList ReadStandingTileKey { get; set; } = KeybindList.Parse("LeftAlt + J"); // Manually trigger read tile for the tile player is *standing on*. public KeybindList ReadStandingTileKey { get; set; } = KeybindList.Parse("LeftAlt + J"); // Manually trigger read tile for the tile player is *standing on*.
public Boolean ReadFlooring { get; set; } = false; // Toggle reading floorings. public Boolean ReadFlooring { get; set; } = false; // Toggle reading floorings.
public Boolean WateredToggle { get; set; } = true; // Toggle speaking watered or unwatered for crops.
#endregion #endregion
#region Tile viewer #region Tile viewer