Added dropped item detection
parent
c153462706
commit
8aac4499fc
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
using Netcode;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
using StardewValley.Buildings;
|
using StardewValley.Buildings;
|
||||||
using StardewValley.Locations;
|
using StardewValley.Locations;
|
||||||
|
@ -148,6 +149,27 @@ namespace stardew_access.Features
|
||||||
category = CATEGORY.JunimoBundle;
|
category = CATEGORY.JunimoBundle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Track dropped items
|
||||||
|
NetCollection<Debris> droppedItems = Game1.currentLocation.debris;
|
||||||
|
if (droppedItems.Count() > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in droppedItems)
|
||||||
|
{
|
||||||
|
int xPos = ((int)item.Chunks[0].position.Value.X / Game1.tileSize) + 1;
|
||||||
|
int yPos = ((int)item.Chunks[0].position.Value.Y / Game1.tileSize) + 1;
|
||||||
|
if (xPos != x || yPos != y) continue;
|
||||||
|
|
||||||
|
string name = item.item.DisplayName;
|
||||||
|
int count = item.item.Stack;
|
||||||
|
|
||||||
|
if (toReturn == "")
|
||||||
|
return ($"Dropped Item: {count} {name}", CATEGORY.DroppedItems);
|
||||||
|
else
|
||||||
|
toReturn = $"{toReturn}, Dropped Item: {count} {name}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
if (toReturn == "")
|
if (toReturn == "")
|
||||||
return (null, category);
|
return (null, category);
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,8 @@ namespace stardew_access.Features
|
||||||
return CATEGORY.Machines;
|
return CATEGORY.Machines;
|
||||||
else if (name == "bridge")
|
else if (name == "bridge")
|
||||||
return CATEGORY.Bridges;
|
return CATEGORY.Bridges;
|
||||||
|
else if (name == "dropped item")
|
||||||
|
return CATEGORY.DroppedItems;
|
||||||
else if (name == "other")
|
else if (name == "other")
|
||||||
return CATEGORY.Others;
|
return CATEGORY.Others;
|
||||||
|
|
||||||
|
@ -85,6 +87,7 @@ namespace stardew_access.Features
|
||||||
public static CATEGORY Decor = new CATEGORY("decoration");
|
public static CATEGORY Decor = new CATEGORY("decoration");
|
||||||
public static CATEGORY Machines = new CATEGORY("machine");
|
public static CATEGORY Machines = new CATEGORY("machine");
|
||||||
public static CATEGORY Bridges = new CATEGORY("bridge");
|
public static CATEGORY Bridges = new CATEGORY("bridge");
|
||||||
|
public static CATEGORY DroppedItems = new CATEGORY("dropped item");
|
||||||
public static CATEGORY Others = new CATEGORY("other");
|
public static CATEGORY Others = new CATEGORY("other");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue