Added buildings detection
parent
20e07d79cc
commit
3744929be0
|
@ -72,6 +72,7 @@ namespace stardew_access.Game
|
||||||
exclusions.Add("ice crystal");
|
exclusions.Add("ice crystal");
|
||||||
exclusions.Add("clay stone");
|
exclusions.Add("clay stone");
|
||||||
exclusions.Add("fossil stone");
|
exclusions.Add("fossil stone");
|
||||||
|
exclusions.Add("street lamp");
|
||||||
exclusions.Add("crop");
|
exclusions.Add("crop");
|
||||||
exclusions.Add("tree");
|
exclusions.Add("tree");
|
||||||
exclusions.Add("flooring");
|
exclusions.Add("flooring");
|
||||||
|
@ -310,9 +311,10 @@ namespace stardew_access.Game
|
||||||
PlaySoundAt(position, "door", CATEGORY.Buildings);
|
PlaySoundAt(position, "door", CATEGORY.Buildings);
|
||||||
}
|
}
|
||||||
// Check for buildings on maps
|
// Check for buildings on maps
|
||||||
else if (ReadTile.getBuildingAtTile((int)position.X, (int)position.Y) != null)
|
else if (ReadTile.getTileInfo((int)position.X, (int)position.Y).Item2 != null)
|
||||||
{
|
{
|
||||||
PlaySoundAt(position, ReadTile.getBuildingAtTile((int)position.X, (int)position.Y), CATEGORY.Buildings);
|
(CATEGORY, string?) item = ReadTile.getTileInfo((int)position.X, (int)position.Y);
|
||||||
|
PlaySoundAt(position, item.Item2, item.Item1);
|
||||||
}
|
}
|
||||||
// Check for resource clumps
|
// Check for resource clumps
|
||||||
else if (ReadTile.getResourceClumpAtTile((int)position.X, (int)position.Y) != null)
|
else if (ReadTile.getResourceClumpAtTile((int)position.X, (int)position.Y) != null)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using StardewModdingAPI;
|
using StardewModdingAPI;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
|
using StardewValley.Buildings;
|
||||||
using StardewValley.Locations;
|
using StardewValley.Locations;
|
||||||
using StardewValley.Objects;
|
using StardewValley.Objects;
|
||||||
using StardewValley.TerrainFeatures;
|
using StardewValley.TerrainFeatures;
|
||||||
|
@ -87,9 +88,9 @@ namespace stardew_access.Game
|
||||||
{
|
{
|
||||||
toSpeak = "Elevator";
|
toSpeak = "Elevator";
|
||||||
}
|
}
|
||||||
else if (getBuildingAtTile(x, y) != null)
|
else if (getTileInfo(x, y).Item2 != null)
|
||||||
{
|
{
|
||||||
toSpeak = getBuildingAtTile(x, y);
|
toSpeak = getTileInfo(x, y).Item2;
|
||||||
}
|
}
|
||||||
else if (getJunimoBundleAt(x, y) != null)
|
else if (getJunimoBundleAt(x, y) != null)
|
||||||
{
|
{
|
||||||
|
@ -200,9 +201,15 @@ namespace stardew_access.Game
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string? getBuildingAtTile(int x, int y)
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x"></param>
|
||||||
|
/// <param name="y"></param>
|
||||||
|
/// <returns>Item1: This is the category of the tile. Default to Furnitures.
|
||||||
|
/// <br/>Item2: This is the name of the tile. Default to null if the tile tile has nothing on it.</returns>
|
||||||
|
public static (CATEGORY?,string?) getTileInfo(int x, int y)
|
||||||
{
|
{
|
||||||
string? toReturn = null;
|
|
||||||
|
|
||||||
int? index = null;
|
int? index = null;
|
||||||
|
|
||||||
|
@ -212,26 +219,30 @@ namespace stardew_access.Game
|
||||||
MainClass.monitor.Log(index.ToString(), LogLevel.Debug);
|
MainClass.monitor.Log(index.ToString(), LogLevel.Debug);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if(Game1.currentLocation is Farm)
|
||||||
|
{
|
||||||
|
Building building = (Game1.currentLocation as Farm).getBuildingAt(new Vector2(x, y));
|
||||||
|
if (building != null)
|
||||||
|
{
|
||||||
|
return (CATEGORY.Buildings, building.buildingType.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (index != null)
|
if (index != null)
|
||||||
{
|
{
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case 1955:
|
case 1955:
|
||||||
case 41:
|
case 41:
|
||||||
toReturn = "Mail Box";
|
return (CATEGORY.Furnitures, "Mail Box");
|
||||||
break;
|
|
||||||
case 1003:
|
case 1003:
|
||||||
toReturn = "Street lamp";
|
return (CATEGORY.Furnitures, "Street lamp");
|
||||||
break;
|
|
||||||
case 78:
|
case 78:
|
||||||
toReturn = "Trash bin";
|
return (CATEGORY.Furnitures, "Trash bin");
|
||||||
break;
|
|
||||||
case 617:
|
case 617:
|
||||||
toReturn = "Daily quest";
|
return (CATEGORY.Furnitures, "Daily quest");
|
||||||
break;
|
|
||||||
case 616:
|
case 616:
|
||||||
toReturn = "Calender";
|
return (CATEGORY.Furnitures, "Calender");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Game1.currentLocation is FarmHouse || Game1.currentLocation is IslandFarmHouse)
|
if (Game1.currentLocation is FarmHouse || Game1.currentLocation is IslandFarmHouse)
|
||||||
|
@ -239,20 +250,18 @@ namespace stardew_access.Game
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case 173:
|
case 173:
|
||||||
toReturn = "Fridge";
|
return (CATEGORY.Furnitures, "Fridge");
|
||||||
break;
|
|
||||||
case 169:
|
case 169:
|
||||||
case 170:
|
case 170:
|
||||||
case 171:
|
case 171:
|
||||||
case 172:
|
case 172:
|
||||||
toReturn = "Kitchen";
|
return (CATEGORY.Furnitures, "Kitchen");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return toReturn;
|
return (null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string getTerrainFeatureAtTile(Netcode.NetRef<TerrainFeature> terrain)
|
public static string getTerrainFeatureAtTile(Netcode.NetRef<TerrainFeature> terrain)
|
||||||
|
|
Loading…
Reference in New Issue