public static void DetectItemVisibility(Character c = null) { if (c == null) { foreach (Item it in Item.ItemList) { it.Visible = true; } } else { Hull h = c.CurrentHull; hullList.ForEach(j => j.Visible = false); List <Hull> visibleHulls; if (h == null || c.Submarine == null) { visibleHulls = hullList.FindAll(j => j.CanSeeOther(null, false)); } else { visibleHulls = hullList.FindAll(j => h.CanSeeOther(j, true)); } visibleHulls.ForEach(j => j.Visible = true); foreach (Item it in Item.ItemList) { if (it.CurrentHull == null || visibleHulls.Contains(it.CurrentHull)) { it.Visible = true; } else { it.Visible = false; } } } }