Added keybind to manually trigger Read Tile
parent
e71bdf0e09
commit
b3b77a9fed
|
@ -184,6 +184,12 @@ namespace stardew_access
|
||||||
string toSpeak = $"Time is {CurrentPlayer.getTimeOfDay()} and it is {CurrentPlayer.getDay()} {CurrentPlayer.getDate()} of {CurrentPlayer.getSeason()}";
|
string toSpeak = $"Time is {CurrentPlayer.getTimeOfDay()} and it is {CurrentPlayer.getDay()} {CurrentPlayer.getDate()} of {CurrentPlayer.getSeason()}";
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.say(toSpeak, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Manual read tile
|
||||||
|
if(Equals(e.Button, SButton.P))
|
||||||
|
{
|
||||||
|
ReadTile(manuallyTriggered: true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SnapMouseToPlayer()
|
private void SnapMouseToPlayer()
|
||||||
|
@ -212,7 +218,7 @@ namespace stardew_access
|
||||||
Game1.setMousePosition(x, y);
|
Game1.setMousePosition(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async void ReadTile()
|
private static async void ReadTile(bool manuallyTriggered = false)
|
||||||
{
|
{
|
||||||
isReadingTile = true;
|
isReadingTile = true;
|
||||||
|
|
||||||
|
@ -245,35 +251,35 @@ namespace stardew_access
|
||||||
Vector2 gt = new Vector2(x, y);
|
Vector2 gt = new Vector2(x, y);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
if (!Game1.currentLocation.isTilePassable(Game1.player.nextPosition(Game1.player.getDirection()), Game1.viewport))
|
|
||||||
{
|
|
||||||
ScreenReader.sayWithTileQuery("Colliding", x, y, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Context.IsPlayerFree)
|
if (Context.IsPlayerFree)
|
||||||
{
|
{
|
||||||
Dictionary<Vector2, Netcode.NetRef<TerrainFeature>> terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict;
|
Dictionary<Vector2, Netcode.NetRef<TerrainFeature>> terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict;
|
||||||
|
string toSpeak = " ";
|
||||||
|
|
||||||
if (Game1.currentLocation.isWaterTile(x, y))
|
#region Get objects, crops, resource clumps, etc.
|
||||||
|
if (!Game1.currentLocation.isTilePassable(Game1.player.nextPosition(Game1.player.getDirection()), Game1.viewport))
|
||||||
{
|
{
|
||||||
ScreenReader.sayWithTileQuery("Water", x, y, true);
|
toSpeak = "Colliding";
|
||||||
|
}
|
||||||
|
else if (Game1.currentLocation.isWaterTile(x, y))
|
||||||
|
{
|
||||||
|
toSpeak = "Water";
|
||||||
}
|
}
|
||||||
else if (Game1.currentLocation.getObjectAtTile(x, y) != null)
|
else if (Game1.currentLocation.getObjectAtTile(x, y) != null)
|
||||||
{
|
{
|
||||||
#region Objects at tile (TODO)
|
#region Objects at tile (TODO)
|
||||||
StardewValley.Object obj = Game1.currentLocation.getObjectAtTile(x, y);
|
StardewValley.Object obj = Game1.currentLocation.getObjectAtTile(x, y);
|
||||||
string name = obj.DisplayName;
|
toSpeak = obj.DisplayName;
|
||||||
|
|
||||||
// TODO add individual stone narration using parentSheetIndex
|
// TODO add individual stone narration using parentSheetIndex
|
||||||
// monitor.Log(obj.parentSheetIndex.ToString(), LogLevel.Debug);
|
// monitor.Log(obj.parentSheetIndex.ToString(), LogLevel.Debug);
|
||||||
if (Game1.objectInformation.ContainsKey(obj.ParentSheetIndex) && name.ToLower().Equals("stone"))
|
if (Game1.objectInformation.ContainsKey(obj.ParentSheetIndex) && toSpeak.ToLower().Equals("stone"))
|
||||||
{
|
{
|
||||||
string info = Game1.objectInformation[obj.parentSheetIndex];
|
string info = Game1.objectInformation[obj.parentSheetIndex];
|
||||||
if (info.ToLower().Contains("copper"))
|
if (info.ToLower().Contains("copper"))
|
||||||
name = "Copper " + name;
|
toSpeak = "Copper " + toSpeak;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenReader.sayWithTileQuery(name, x, y, true);
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
else if (terrainFeature.ContainsKey(gt))
|
else if (terrainFeature.ContainsKey(gt))
|
||||||
|
@ -287,7 +293,7 @@ namespace stardew_access
|
||||||
if (dirt.crop != null)
|
if (dirt.crop != null)
|
||||||
{
|
{
|
||||||
string cropName = Game1.objectInformation[dirt.crop.indexOfHarvest].Split('/')[0];
|
string cropName = Game1.objectInformation[dirt.crop.indexOfHarvest].Split('/')[0];
|
||||||
string toSpeak = $"{cropName}";
|
toSpeak = $"{cropName}";
|
||||||
|
|
||||||
bool isWatered = dirt.state.Value == HoeDirt.watered;
|
bool isWatered = dirt.state.Value == HoeDirt.watered;
|
||||||
bool isHarvestable = dirt.readyForHarvest();
|
bool isHarvestable = dirt.readyForHarvest();
|
||||||
|
@ -301,12 +307,10 @@ namespace stardew_access
|
||||||
|
|
||||||
if (isHarvestable)
|
if (isHarvestable)
|
||||||
toSpeak = "Harvestable " + toSpeak;
|
toSpeak = "Harvestable " + toSpeak;
|
||||||
|
|
||||||
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string toSpeak = "Soil";
|
toSpeak = "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;
|
||||||
|
|
||||||
|
@ -315,27 +319,22 @@ namespace stardew_access
|
||||||
|
|
||||||
if (isFertilized)
|
if (isFertilized)
|
||||||
toSpeak = "Fertilized " + toSpeak;
|
toSpeak = "Fertilized " + toSpeak;
|
||||||
|
|
||||||
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is Bush)
|
else if (terrain.Get() is Bush)
|
||||||
{
|
{
|
||||||
string toSpeak = "Bush";
|
toSpeak = "Bush";
|
||||||
ScreenReader.sayWithTileQuery(toSpeak, x, y, 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();
|
toSpeak = cosmeticPlant.textureName().ToLower();
|
||||||
|
|
||||||
if (toSpeak.Contains("terrain"))
|
if (toSpeak.Contains("terrain"))
|
||||||
toSpeak.Replace("terrain", "");
|
toSpeak.Replace("terrain", "");
|
||||||
|
|
||||||
if (toSpeak.Contains("feature"))
|
if (toSpeak.Contains("feature"))
|
||||||
toSpeak.Replace("feature", "");
|
toSpeak.Replace("feature", "");
|
||||||
|
|
||||||
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is Flooring)
|
else if (terrain.Get() is Flooring)
|
||||||
{
|
{
|
||||||
|
@ -343,36 +342,29 @@ namespace stardew_access
|
||||||
bool isPathway = flooring.isPathway.Get();
|
bool isPathway = flooring.isPathway.Get();
|
||||||
bool isSteppingStone = flooring.isSteppingStone.Get();
|
bool isSteppingStone = flooring.isSteppingStone.Get();
|
||||||
|
|
||||||
string toSpeak = "Flooring";
|
toSpeak = "Flooring";
|
||||||
|
|
||||||
if (isPathway)
|
if (isPathway)
|
||||||
toSpeak = "Pathway";
|
toSpeak = "Pathway";
|
||||||
|
|
||||||
if (isSteppingStone)
|
if (isSteppingStone)
|
||||||
toSpeak = "Stepping Stone";
|
toSpeak = "Stepping Stone";
|
||||||
|
|
||||||
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is FruitTree)
|
else if (terrain.Get() is FruitTree)
|
||||||
{
|
{
|
||||||
FruitTree fruitTree = (FruitTree)terrain.Get();
|
FruitTree fruitTree = (FruitTree)terrain.Get();
|
||||||
string toSpeak = Game1.objectInformation[fruitTree.treeType].Split('/')[0];
|
toSpeak = Game1.objectInformation[fruitTree.treeType].Split('/')[0];
|
||||||
|
|
||||||
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is Grass)
|
else if (terrain.Get() is Grass)
|
||||||
{
|
{
|
||||||
Grass grass = (Grass)terrain.Get();
|
Grass grass = (Grass)terrain.Get();
|
||||||
string toSpeak = "Grass";
|
toSpeak = "Grass";
|
||||||
|
|
||||||
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is Tree)
|
else if (terrain.Get() is Tree)
|
||||||
{
|
{
|
||||||
Tree tree = (Tree)terrain.Get();
|
Tree tree = (Tree)terrain.Get();
|
||||||
int treeType = tree.treeType;
|
int treeType = tree.treeType;
|
||||||
int stage = tree.growthStage.Value;
|
int stage = tree.growthStage.Value;
|
||||||
string toSpeak = "";
|
|
||||||
|
|
||||||
if (Game1.player.getEffectiveSkillLevel(2) >= 1)
|
if (Game1.player.getEffectiveSkillLevel(2) >= 1)
|
||||||
{
|
{
|
||||||
|
@ -388,18 +380,14 @@ namespace stardew_access
|
||||||
}
|
}
|
||||||
|
|
||||||
toSpeak = $"{toSpeak}, {stage} stage";
|
toSpeak = $"{toSpeak}, {stage} stage";
|
||||||
|
|
||||||
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is Quartz)
|
else if (terrain.Get() is Quartz)
|
||||||
{
|
{
|
||||||
string toSpeak = "Quartz";
|
toSpeak = "Quartz";
|
||||||
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is Leaf)
|
else if (terrain.Get() is Leaf)
|
||||||
{
|
{
|
||||||
string toSpeak = "Leaf";
|
toSpeak = "Leaf";
|
||||||
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -410,7 +398,6 @@ namespace stardew_access
|
||||||
{
|
{
|
||||||
if (clump.occupiesTile(x, y))
|
if (clump.occupiesTile(x, y))
|
||||||
{
|
{
|
||||||
string toSpeak;
|
|
||||||
int index = clump.parentSheetIndex;
|
int index = clump.parentSheetIndex;
|
||||||
|
|
||||||
switch (index)
|
switch (index)
|
||||||
|
@ -437,8 +424,6 @@ namespace stardew_access
|
||||||
toSpeak = "Unknown";
|
toSpeak = "Unknown";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -451,7 +436,7 @@ namespace stardew_access
|
||||||
{
|
{
|
||||||
if (Equals(x, ydoor.X) && Equals(y, ydoor.Y))
|
if (Equals(x, ydoor.X) && Equals(y, ydoor.Y))
|
||||||
{
|
{
|
||||||
ScreenReader.sayWithTileQuery("Door", x, y, true);
|
toSpeak = "Door";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -463,11 +448,19 @@ namespace stardew_access
|
||||||
int index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
|
int index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
|
||||||
|
|
||||||
if (index == 173 || index == 174)
|
if (index == 173 || index == 174)
|
||||||
ScreenReader.sayWithTileQuery("Ladder", x, y, true);
|
toSpeak = "Door";
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Narrate toSpeak
|
||||||
|
if (toSpeak != " ")
|
||||||
|
if (manuallyTriggered)
|
||||||
|
ScreenReader.say(toSpeak, true);
|
||||||
|
else
|
||||||
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
Loading…
Reference in New Issue