Added the rest terrain features to read tile and enabled it by default

master
shoaib11120 2021-12-16 19:17:57 +05:30
parent c4bdfe2784
commit e2a465af66
1 changed files with 31 additions and 11 deletions

View File

@ -16,7 +16,7 @@ namespace stardew_access
public class MainClass : Mod public class MainClass : Mod
{ {
private Harmony? harmony; private Harmony? harmony;
private static bool isReadingTile = false, readTile = false, snapMouse = true; private static bool isReadingTile = false, readTile = true, snapMouse = true;
private static Vector2 prevTile; private static Vector2 prevTile;
public static IMonitor? monitor; public static IMonitor? monitor;
AutoHotkeyEngine ahk; AutoHotkeyEngine ahk;
@ -260,23 +260,39 @@ namespace stardew_access
bool isWatered = dirt.state.Value == HoeDirt.watered; bool isWatered = dirt.state.Value == HoeDirt.watered;
bool isHarvestable = dirt.crop.fullyGrown.Value; bool isHarvestable = dirt.crop.fullyGrown.Value;
bool isFertilized = dirt.fertilizer.Value != HoeDirt.noFertilizer;
if(isWatered) if (isWatered)
toSpeak = "Watered " + toSpeak; toSpeak = "Watered " + toSpeak;
if (isFertilized)
toSpeak = "Fertilized " + toSpeak;
if (isHarvestable) if (isHarvestable)
toSpeak = "Harvestable " + toSpeak; toSpeak = "Harvestable " + toSpeak;
ScreenReader.say(toSpeak, true);
} else
{
string toSpeak = "Soil";
bool isWatered = dirt.state.Value == HoeDirt.watered;
bool isFertilized = dirt.fertilizer.Value != HoeDirt.noFertilizer;
if (isWatered)
toSpeak = "Watered " + toSpeak;
if(isFertilized)
toSpeak = "Fertilized " + toSpeak;
ScreenReader.say(toSpeak, true); ScreenReader.say(toSpeak, true);
} }
} }
else if(terrain.Get() is Bush) else if (terrain.Get() is Bush)
{ {
string toSpeak = "Bush"; string toSpeak = "Bush";
monitor.Log(toSpeak, LogLevel.Debug);
ScreenReader.say(toSpeak, true); ScreenReader.say(toSpeak, true);
} }
else if(terrain.Get() is CosmeticPlant) else if (terrain.Get() is CosmeticPlant)
{ {
CosmeticPlant cosmeticPlant = (CosmeticPlant)terrain.Get(); CosmeticPlant cosmeticPlant = (CosmeticPlant)terrain.Get();
string toSpeak = cosmeticPlant.textureName().ToLower(); string toSpeak = cosmeticPlant.textureName().ToLower();
@ -287,7 +303,6 @@ namespace stardew_access
if (toSpeak.Contains("feature")) if (toSpeak.Contains("feature"))
toSpeak.Replace("feature", ""); toSpeak.Replace("feature", "");
monitor.Log(toSpeak, LogLevel.Debug);
ScreenReader.say(toSpeak, true); ScreenReader.say(toSpeak, true);
} }
else if (terrain.Get() is Flooring) else if (terrain.Get() is Flooring)
@ -304,7 +319,6 @@ namespace stardew_access
if (isSteppingStone) if (isSteppingStone)
toSpeak = "Stepping Stone"; toSpeak = "Stepping Stone";
monitor.Log(toSpeak, LogLevel.Debug);
ScreenReader.say(toSpeak, true); ScreenReader.say(toSpeak, true);
} }
else if (terrain.Get() is FruitTree) else if (terrain.Get() is FruitTree)
@ -312,7 +326,6 @@ namespace stardew_access
FruitTree fruitTree = (FruitTree)terrain.Get(); FruitTree fruitTree = (FruitTree)terrain.Get();
string toSpeak = Game1.objectInformation[fruitTree.treeType].Split('/')[0]; string toSpeak = Game1.objectInformation[fruitTree.treeType].Split('/')[0];
monitor.Log(toSpeak, LogLevel.Debug);
ScreenReader.say(toSpeak, true); ScreenReader.say(toSpeak, true);
} }
else if (terrain.Get() is ResourceClump) else if (terrain.Get() is ResourceClump)
@ -320,7 +333,6 @@ namespace stardew_access
ResourceClump resourceClump = (ResourceClump)terrain.Get(); ResourceClump resourceClump = (ResourceClump)terrain.Get();
string toSpeak = Game1.objectInformation[resourceClump.parentSheetIndex].Split('/')[0]; string toSpeak = Game1.objectInformation[resourceClump.parentSheetIndex].Split('/')[0];
monitor.Log(toSpeak, LogLevel.Debug);
ScreenReader.say(toSpeak, true); ScreenReader.say(toSpeak, true);
} }
else if (terrain.Get() is Grass) else if (terrain.Get() is Grass)
@ -328,7 +340,6 @@ namespace stardew_access
Grass grass = (Grass)terrain.Get(); Grass grass = (Grass)terrain.Get();
string toSpeak = "Grass"; string toSpeak = "Grass";
monitor.Log(toSpeak, LogLevel.Debug);
ScreenReader.say(toSpeak, true); ScreenReader.say(toSpeak, true);
} }
else if (terrain.Get() is Tree) else if (terrain.Get() is Tree)
@ -353,7 +364,16 @@ namespace stardew_access
toSpeak += $", {stage} stage"; toSpeak += $", {stage} stage";
monitor.Log(toSpeak, LogLevel.Debug); ScreenReader.say(toSpeak, true);
}
else if ( terrain.Get() is Quartz)
{
string toSpeak = "Quartz";
ScreenReader.say(toSpeak, true);
}
else if (terrain.Get() is Leaf)
{
string toSpeak = "Leaf";
ScreenReader.say(toSpeak, true); ScreenReader.say(toSpeak, true);
} }
} }