diff --git a/Content.Server/GameObjects/Components/Research/LatheDatabaseComponent.cs b/Content.Server/GameObjects/Components/Research/LatheDatabaseComponent.cs index b0d6c85e37..f6fcb395d5 100644 --- a/Content.Server/GameObjects/Components/Research/LatheDatabaseComponent.cs +++ b/Content.Server/GameObjects/Components/Research/LatheDatabaseComponent.cs @@ -44,17 +44,5 @@ namespace Content.Server.GameObjects.Components.Research Dirty(); return true; } - - private List GetRecipeIdList() - { - var list = new List(); - - foreach (var recipe in this) - { - list.Add(recipe.ID); - } - - return list; - } } } diff --git a/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs index 1471889e94..91ae1c1737 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs @@ -75,15 +75,34 @@ namespace Content.Shared.GameObjects.Components.Research { base.ExposeData(serializer); - var recipes = serializer.ReadDataField("recipes", new List()); - var prototypeManager = IoCManager.Resolve(); - foreach (var id in recipes) + if (serializer.Reading) { - if (!prototypeManager.TryIndex(id, out LatheRecipePrototype recipe)) continue; - _recipes.Add(recipe); + var recipes = serializer.ReadDataField("recipes", new List()); + var prototypeManager = IoCManager.Resolve(); + foreach (var id in recipes) + { + if (!prototypeManager.TryIndex(id, out LatheRecipePrototype recipe)) continue; + _recipes.Add(recipe); + } + } else if (serializer.Writing) + { + var recipes = GetRecipeIdList(); + serializer.DataField(ref recipes, "recipes", new List()); } } + public List GetRecipeIdList() + { + var list = new List(); + + foreach (var recipe in this) + { + list.Add(recipe.ID); + } + + return list; + } + public IEnumerator GetEnumerator() { return _recipes.GetEnumerator();