Check if bush is harvestable or not.

master
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)
{

View File

@ -19,11 +19,11 @@ namespace stardew_access
public static bool radar = true;
public static bool radarDebug = false;
public static bool radarStereoSound = true;
public static IMonitor? monitor;
AutoHotkeyEngine ahk;
public static IMonitor monitor;
private AutoHotkeyEngine? ahk;
public static string hudMessageQueryKey = "";
public static Radar radarFeature;
public static ScreenReaderInterface? screenReader;
public static ScreenReaderInterface screenReader;
private static IModHelper _modHelper;
public static IModHelper ModHelper

View File

@ -659,7 +659,7 @@ namespace stardew_access.Patches
}
else
{
hoverTitle = null;
hoverTitle = " ";
hoverText = farm.hoverText;
}
}

View File

@ -17,15 +17,16 @@ namespace stardew_access.ScreenReader
public class ScreenReaderLinux : ScreenReaderInterface
{
[DllImport("libspeechdwrapper.so")]
private static extern void Initialize();
private static extern int Initialize();
[DllImport("libspeechdwrapper.so")]
private static extern void Speak(GoString text, bool interrupt);
private static extern int Speak(GoString text, bool interrupt);
[DllImport("libspeechdwrapper.so")]
private static extern void Close();
private static extern int Close();
public string prevText = "", prevTextTile = " ", prevChatText = "", prevMenuText = "";
private bool initialized = false;
public string PrevTextTile{
get{ return prevTextTile; }
@ -34,18 +35,26 @@ namespace stardew_access.ScreenReader
public void InitializeScreenReader()
{
Initialize();
int res = Initialize();
if(res==1){
initialized = true;
}
}
public void CloseScreenReader(){
if(initialized){
Close();
initialized = false;
}
}
public void Say(string text, bool interrupt)
{
if(initialized){
GoString str = new GoString(text, text.Length);
Speak(str, interrupt);
}
}
public void SayWithChecker(string text, bool interrupt)
{