From 3d8f5070c5cdecc8d502f7b532b55ab8767eb971 Mon Sep 17 00:00:00 2001 From: juanjp600 Date: Wed, 5 Oct 2016 16:57:06 -0300 Subject: [PATCH] Added all smallitems to extra cargo list + removed duplicate entries --- Subsurface/Source/Items/ItemPrefab.cs | 3 +++ Subsurface/Source/Map/MapEntityPrefab.cs | 4 +++- Subsurface/Source/Networking/GameServerSettings.cs | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Subsurface/Source/Items/ItemPrefab.cs b/Subsurface/Source/Items/ItemPrefab.cs index 574fb1be1..91ce91db1 100644 --- a/Subsurface/Source/Items/ItemPrefab.cs +++ b/Subsurface/Source/Items/ItemPrefab.cs @@ -277,6 +277,9 @@ namespace Barotrauma DeconstructItems = new List(); DeconstructTime = 1.0f; + tags = new List(); + tags.AddRange(ToolBox.GetAttributeString(element, "tags", "").Split(',')); + foreach (XElement subElement in element.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) diff --git a/Subsurface/Source/Map/MapEntityPrefab.cs b/Subsurface/Source/Map/MapEntityPrefab.cs index 9669bd545..5d357841d 100644 --- a/Subsurface/Source/Map/MapEntityPrefab.cs +++ b/Subsurface/Source/Map/MapEntityPrefab.cs @@ -18,7 +18,9 @@ namespace Barotrauma public static List list = new List(); protected string name; - + + public List tags; + protected bool isLinkable; public Sprite sprite; diff --git a/Subsurface/Source/Networking/GameServerSettings.cs b/Subsurface/Source/Networking/GameServerSettings.cs index 0a9ad41b0..6ecf872fc 100644 --- a/Subsurface/Source/Networking/GameServerSettings.cs +++ b/Subsurface/Source/Networking/GameServerSettings.cs @@ -503,10 +503,14 @@ namespace Barotrauma.Networking return true; }; + var allitems = new List(); 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(