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>(); DeconstructItems = new List<DeconstructItem>();
DeconstructTime = 1.0f; DeconstructTime = 1.0f;
tags = new List<string>();
tags.AddRange(ToolBox.GetAttributeString(element, "tags", "").Split(','));
foreach (XElement subElement in element.Elements()) foreach (XElement subElement in element.Elements())
{ {
switch (subElement.Name.ToString().ToLowerInvariant()) switch (subElement.Name.ToString().ToLowerInvariant())
+2
View File
@@ -19,6 +19,8 @@ namespace Barotrauma
protected string name; protected string name;
public List<string> tags;
protected bool isLinkable; protected bool isLinkable;
public Sprite sprite; public Sprite sprite;
@@ -503,10 +503,14 @@ namespace Barotrauma.Networking
return true; return true;
}; };
var allitems = new List<MapEntityPrefab>();
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory))) foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
{ {
if (category == MapEntityCategory.Machine || category == MapEntityCategory.Structure) continue; 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) foreach (MapEntityPrefab pf in items)
{ {
GUITextBlock textBlock = new GUITextBlock( GUITextBlock textBlock = new GUITextBlock(