diff --git a/stardew-access/Features/TileInfo.cs b/stardew-access/Features/TileInfo.cs index 4de8066..2232087 100644 --- a/stardew-access/Features/TileInfo.cs +++ b/stardew-access/Features/TileInfo.cs @@ -150,22 +150,27 @@ namespace stardew_access.Features } #region Track dropped items - NetCollection droppedItems = Game1.currentLocation.debris; - if (droppedItems.Count() > 0) + if (MainClass.Config.TrackDroppedItems) { - foreach (var item in droppedItems) + NetCollection droppedItems = Game1.currentLocation.debris; + if (droppedItems.Count() > 0) { - 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; + 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 (item.item == null) continue; - if (toReturn == "") - return ($"Dropped Item: {count} {name}", CATEGORY.DroppedItems); - else - toReturn = $"{toReturn}, Dropped Item: {count} {name}"; + 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 diff --git a/stardew-access/ModConfig.cs b/stardew-access/ModConfig.cs index f4ea1de..bce66e6 100644 --- a/stardew-access/ModConfig.cs +++ b/stardew-access/ModConfig.cs @@ -79,7 +79,7 @@ namespace stardew_access public Boolean SnapMouse { get; set; } = true; // Toggles the snap mouse feature public Boolean Warning { get; set; } = true; // Toggles the warnings feature public Boolean TTS { get; set; } = true; // Toggles the screen reader/tts. - // TODO add command to toggle warning feature + public Boolean TrackDroppedItems {get; set;} = true; // Toggles detecting the dropped items. #endregion // TODO Add the exclusion and focus list too