Check if bush is harvestable or not.

This commit is contained in:
Mohammad Shoaib
2022-01-31 20:16:47 +05:30
parent 4b7d011a7b
commit 77f9f18ecc
5 changed files with 65 additions and 18 deletions

View File

@@ -197,7 +197,7 @@ namespace stardew_access.Game
// Check for animals
else if (ReadTile.getFarmAnimalAt(Game1.currentLocation, (int)position.X, (int)position.Y) != null)
{
string name = ReadTile.getFarmAnimalAt(Game1.currentLocation, (int)position.X, (int)position.Y, onlyName: true);
string? name = ReadTile.getFarmAnimalAt(Game1.currentLocation, (int)position.X, (int)position.Y, onlyName: true);
PlaySoundAt(position, name, CATEGORY.FarmAnimals);
}
// Check for water
@@ -286,10 +286,6 @@ namespace stardew_access.Game
{
PlaySoundAt(position, terrain, CATEGORY.Others);
}
else if (tr.Get() is Leaf)
{
PlaySoundAt(position, terrain, CATEGORY.Others);
}
}
}
// Check for Mine ladders
@@ -313,7 +309,7 @@ namespace stardew_access.Game
// Check for buildings on maps
else if (ReadTile.getTileInfo((int)position.X, (int)position.Y).Item2 != null)
{
(CATEGORY, string?) item = ReadTile.getTileInfo((int)position.X, (int)position.Y);
(CATEGORY?, string?) item = ReadTile.getTileInfo((int)position.X, (int)position.Y);
PlaySoundAt(position, item.Item2, item.Item1);
}
// Check for resource clumps

View File

@@ -71,7 +71,49 @@ namespace stardew_access.Game
}
else if ( Game1.currentLocation.getLargeTerrainFeatureAt(x, y) != null )
{
toSpeak = "Bush";
Bush bush = (Bush) Game1.currentLocation.getLargeTerrainFeatureAt(x, y);
int size = bush.size;
#region Check if bush is harvestable or not
if (!bush.townBush && (int)bush.tileSheetOffset == 1 && bush.inBloom(Game1.GetSeasonForLocation(Game1.currentLocation), Game1.dayOfMonth))
{
// Taken from the game's code
string season = ((int)bush.overrideSeason == -1) ? Game1.GetSeasonForLocation(Game1.currentLocation) : Utility.getSeasonNameFromNumber(bush.overrideSeason);
int shakeOff = -1;
if (!(season == "spring"))
{
if (season == "fall")
{
shakeOff = 410;
}
}
else
{
shakeOff = 296;
}
if ((int)size == 3)
{
shakeOff = 815;
}
if ((int)size == 4)
{
shakeOff = 73;
}
if (shakeOff == -1)
{
return;
}
toSpeak = "Harvestable";
}
#endregion
if(bush.townBush)
toSpeak = $"{toSpeak} Town Bush";
else if(bush.greenhouseBush)
toSpeak = $"{toSpeak} Greenhouse Bush";
else
toSpeak = $"{toSpeak} Bush";
}
else if (getResourceClumpAtTile(x, y) != null)
{