Added junimo bundle narration in read tile
parent
b611b01d9a
commit
ea3ffb4e18
|
@ -81,6 +81,10 @@ namespace stardew_access.Game
|
|||
{
|
||||
toSpeak = getBuildingAtTile(x, y);
|
||||
}
|
||||
else if(getJunimoBundleAt(x, y) != null)
|
||||
{
|
||||
toSpeak = getJunimoBundleAt(x, y);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Narrate toSpeak
|
||||
|
@ -91,6 +95,13 @@ namespace stardew_access.Game
|
|||
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||
#endregion
|
||||
|
||||
#region Play colliding sound effect
|
||||
if (isCollidingAtTile(x, y) && prevTile != gt)
|
||||
{
|
||||
Game1.playSound("colliding");
|
||||
}
|
||||
#endregion
|
||||
|
||||
prevTile = gt;
|
||||
}
|
||||
|
||||
|
@ -104,6 +115,42 @@ namespace stardew_access.Game
|
|||
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)
|
||||
{
|
||||
if (location == null)
|
||||
|
@ -147,9 +194,6 @@ namespace stardew_access.Game
|
|||
{
|
||||
string? toReturn = null;
|
||||
|
||||
// It throws error if it can't find the index, do something else to fix this
|
||||
try
|
||||
{
|
||||
int? index = null;
|
||||
|
||||
if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y] != null)
|
||||
|
@ -195,8 +239,6 @@ namespace stardew_access.Game
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception) {}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
|
|
@ -25,13 +25,12 @@ namespace stardew_access.Patches
|
|||
if(cueName == "grassyStep" || cueName == "sandyStep" || cueName == "snowyStep" || cueName == "stoneStep" || cueName == "thudStep" || cueName == "woodyStep")
|
||||
{
|
||||
Vector2 nextTile = CurrentPlayer.getNextTile();
|
||||
Rectangle rect = new Rectangle((int)nextTile.X * 64 + 1,(int) nextTile.Y * 64 + 1, 62, 62);
|
||||
if (Game1.currentLocation.isCollidingPosition(rect, Game1.viewport, true, 0, glider: false, Game1.player, pathfinding: false))
|
||||
if (ReadTile.isCollidingAtTile((int)nextTile.X, (int)nextTile.Y))
|
||||
{
|
||||
if (prevTile != nextTile)
|
||||
{
|
||||
prevTile = nextTile;
|
||||
Game1.playSound("colliding");
|
||||
//Game1.playSound("colliding");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue