Added junimo bundle narration in read tile
parent
b611b01d9a
commit
ea3ffb4e18
|
@ -81,6 +81,10 @@ namespace stardew_access.Game
|
||||||
{
|
{
|
||||||
toSpeak = getBuildingAtTile(x, y);
|
toSpeak = getBuildingAtTile(x, y);
|
||||||
}
|
}
|
||||||
|
else if(getJunimoBundleAt(x, y) != null)
|
||||||
|
{
|
||||||
|
toSpeak = getJunimoBundleAt(x, y);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Narrate toSpeak
|
#region Narrate toSpeak
|
||||||
|
@ -91,6 +95,13 @@ namespace stardew_access.Game
|
||||||
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Play colliding sound effect
|
||||||
|
if (isCollidingAtTile(x, y) && prevTile != gt)
|
||||||
|
{
|
||||||
|
Game1.playSound("colliding");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
prevTile = gt;
|
prevTile = gt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +115,42 @@ namespace stardew_access.Game
|
||||||
isReadingTile = false;
|
isReadingTile = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string? getJunimoBundleAt(int x, int y)
|
||||||
|
{
|
||||||
|
if (Game1.currentLocation is not CommunityCenter)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
CommunityCenter communityCenter = (Game1.currentLocation as CommunityCenter);
|
||||||
|
|
||||||
|
string? name = (x, y) switch
|
||||||
|
{
|
||||||
|
(14, 5) => "Pantry",
|
||||||
|
(14, 23) => "Crafts Room",
|
||||||
|
(40, 10) => "Fish Tank",
|
||||||
|
(63, 14) => "Boiler Room",
|
||||||
|
(55, 6) => "Vault",
|
||||||
|
(46, 11) => "Bulletin Board",
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (communityCenter.shouldNoteAppearInArea(CommunityCenter.getAreaNumberFromName(name)))
|
||||||
|
return $"{name} bundle";
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool isCollidingAtTile(int x, int y)
|
||||||
|
{
|
||||||
|
Rectangle rect = new Rectangle(x * 64 + 1,y * 64 + 1, 62, 62);
|
||||||
|
|
||||||
|
if (Game1.currentLocation.isCollidingPosition(rect, Game1.viewport, true, 0, glider: false, Game1.player, pathfinding: true))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static string? getFarmAnimalAt(GameLocation? location, int x, int y, bool onlyName = false)
|
public static string? getFarmAnimalAt(GameLocation? location, int x, int y, bool onlyName = false)
|
||||||
{
|
{
|
||||||
if (location == null)
|
if (location == null)
|
||||||
|
@ -147,12 +194,9 @@ namespace stardew_access.Game
|
||||||
{
|
{
|
||||||
string? toReturn = null;
|
string? toReturn = null;
|
||||||
|
|
||||||
// It throws error if it can't find the index, do something else to fix this
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int? index = null;
|
int? index = null;
|
||||||
|
|
||||||
if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y]!=null)
|
if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y] != null)
|
||||||
index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
|
index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
|
||||||
/* Add More
|
/* Add More
|
||||||
MainClass.monitor.Log(index.ToString(), LogLevel.Debug);
|
MainClass.monitor.Log(index.ToString(), LogLevel.Debug);
|
||||||
|
@ -179,7 +223,7 @@ namespace stardew_access.Game
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Game1.currentLocation is FarmHouse || Game1.currentLocation is IslandFarmHouse)
|
if (Game1.currentLocation is FarmHouse || Game1.currentLocation is IslandFarmHouse)
|
||||||
{
|
{
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
|
@ -195,8 +239,6 @@ namespace stardew_access.Game
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception) {}
|
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,13 +25,12 @@ namespace stardew_access.Patches
|
||||||
if(cueName == "grassyStep" || cueName == "sandyStep" || cueName == "snowyStep" || cueName == "stoneStep" || cueName == "thudStep" || cueName == "woodyStep")
|
if(cueName == "grassyStep" || cueName == "sandyStep" || cueName == "snowyStep" || cueName == "stoneStep" || cueName == "thudStep" || cueName == "woodyStep")
|
||||||
{
|
{
|
||||||
Vector2 nextTile = CurrentPlayer.getNextTile();
|
Vector2 nextTile = CurrentPlayer.getNextTile();
|
||||||
Rectangle rect = new Rectangle((int)nextTile.X * 64 + 1,(int) nextTile.Y * 64 + 1, 62, 62);
|
if (ReadTile.isCollidingAtTile((int)nextTile.X, (int)nextTile.Y))
|
||||||
if (Game1.currentLocation.isCollidingPosition(rect, Game1.viewport, true, 0, glider: false, Game1.player, pathfinding: false))
|
|
||||||
{
|
{
|
||||||
if (prevTile != nextTile)
|
if (prevTile != nextTile)
|
||||||
{
|
{
|
||||||
prevTile = nextTile;
|
prevTile = nextTile;
|
||||||
Game1.playSound("colliding");
|
//Game1.playSound("colliding");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue