Added all smallitems to extra cargo list + removed duplicate entries

This commit is contained in:
juanjp600
2016-10-05 16:57:06 -03:00
parent 41c38575b9
commit 3d8f5070c5
3 changed files with 11 additions and 2 deletions
+3
View File
@@ -277,6 +277,9 @@ namespace Barotrauma
DeconstructItems = new List<DeconstructItem>();
DeconstructTime = 1.0f;
tags = new List<string>();
tags.AddRange(ToolBox.GetAttributeString(element, "tags", "").Split(','));
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLowerInvariant())
+3 -1
View File
@@ -18,7 +18,9 @@ namespace Barotrauma
public static List<MapEntityPrefab> list = new List<MapEntityPrefab>();
protected string name;
public List<string> tags;
protected bool isLinkable;
public Sprite sprite;
@@ -503,10 +503,14 @@ namespace Barotrauma.Networking
return true;
};
var allitems = new List<MapEntityPrefab>();
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
{
if (category == MapEntityCategory.Machine || category == MapEntityCategory.Structure) continue;
var items = MapEntityPrefab.list.FindAll(ep => ep.Price > 0.0f && ep.Category.HasFlag(category));
var items = MapEntityPrefab.list.FindAll(ep => ep is ItemPrefab && (ep.Price > 0.0f || ep.tags.Contains("smallitem")) && ep.Category.HasFlag(category));
DebugConsole.NewMessage(category.ToString() + " " + items.Count.ToString(), Color.Lime);
items.RemoveAll(ep => allitems.Contains(ep));
allitems.AddRange(items);
foreach (MapEntityPrefab pf in items)
{
GUITextBlock textBlock = new GUITextBlock(