diff --git a/Content.Server/Materials/ProduceMaterialExtractorSystem.cs b/Content.Server/Materials/ProduceMaterialExtractorSystem.cs index 5a46930499..33d5c1ac14 100644 --- a/Content.Server/Materials/ProduceMaterialExtractorSystem.cs +++ b/Content.Server/Materials/ProduceMaterialExtractorSystem.cs @@ -4,6 +4,8 @@ using Content.Server.Materials.Components; using Content.Server.Power.EntitySystems; using Content.Shared.Chemistry.EntitySystems; using Content.Shared.Interaction; +using Content.Shared.Storage; +using Content.Shared.Storage.Components; using Robust.Server.Audio; namespace Content.Server.Materials; @@ -28,11 +30,32 @@ public sealed class ProduceMaterialExtractorSystem : EntitySystem if (!this.IsPowered(ent, EntityManager)) return; - if (!TryComp(args.Used, out var produce)) - return; + bool success = false; - if (!_solutionContainer.TryGetSolution(args.Used, produce.SolutionName, out var solution)) - return; + // Handle using bags (mainly plant bags) + if (ExtractFromStorage(ent, args.Used)) + success = true; + + // Handle using produce directly + if (ExtractFromProduce(ent, args.Used)) + success = true; + + // TODO: What if a bag is also a plant? + + if (success) + { + _audio.PlayPvs(ent.Comp.ExtractSound, ent); + args.Handled = true; + } + } + + private bool ExtractFromProduce(Entity ent, EntityUid used) + { + if (!TryComp(used, out var produce)) + return false; + + if (!_solutionContainer.TryGetSolution(used, produce.SolutionName, out var solution)) + return false; // Can produce even have fractional amounts? Does it matter if they do? // Questions man was never meant to answer. @@ -41,8 +64,22 @@ public sealed class ProduceMaterialExtractorSystem : EntitySystem .Sum(r => r.Quantity.Float()); _materialStorage.TryChangeMaterialAmount(ent, ent.Comp.ExtractedMaterial, (int) matAmount); - _audio.PlayPvs(ent.Comp.ExtractSound, ent); - QueueDel(args.Used); - args.Handled = true; + QueueDel(used); + + return true; + } + + private bool ExtractFromStorage(Entity ent, EntityUid used) + { + if (!TryComp(used, out var storage)) + return false; + + bool success = false; + + foreach (var (item, _location) in storage.StoredItems) + if (ExtractFromProduce(ent, item)) + success = true; + + return success; } } diff --git a/Resources/Prototypes/Recipes/Lathes/biogen.yml b/Resources/Prototypes/Recipes/Lathes/biogen.yml index 0579172025..5cc6fbab5f 100644 --- a/Resources/Prototypes/Recipes/Lathes/biogen.yml +++ b/Resources/Prototypes/Recipes/Lathes/biogen.yml @@ -235,5 +235,54 @@ category: Materials completetime: 3 materials: - Biomass: 149 + Biomass: 100 + +- type: latheRecipe + id: BioClothingBeltPlant + result: ClothingBeltPlant + category: Materials + completetime: 5 + materials: + Biomass: 50 + +- type: latheRecipe + id: BioClothingBeltUtility + result: ClothingBeltUtility + category: Materials + completetime: 5 + materials: + Biomass: 50 + +- type: latheRecipe + id: BioClothingBeltMedical + result: ClothingBeltMedical + category: Materials + completetime: 5 + materials: + Biomass: 50 + +- type: latheRecipe + id: BioClothingBeltJanitor + result: ClothingBeltJanitor + category: Materials + completetime: 5 + materials: + Biomass: 50 + +- type: latheRecipe + id: BioClothingBeltStorageWaistbag + result: ClothingBeltStorageWaistbag + category: Materials + completetime: 5 + materials: + Biomass: 50 + +- type: latheRecipe + id: BioClothingBeltChef + result: ClothingBeltChef + category: Materials + completetime: 5 + materials: + Biomass: 50 + # Sunrise-End diff --git a/Resources/Prototypes/_Sunrise/Recipes/Lathes/Packs/biogen.yml b/Resources/Prototypes/_Sunrise/Recipes/Lathes/Packs/biogen.yml index 81369cbba6..cfffbe1d5a 100644 --- a/Resources/Prototypes/_Sunrise/Recipes/Lathes/Packs/biogen.yml +++ b/Resources/Prototypes/_Sunrise/Recipes/Lathes/Packs/biogen.yml @@ -4,3 +4,9 @@ id: BioGenStaticSunrise recipes: - BioGenHandheldSoil + - BioClothingBeltPlant + - BioClothingBeltUtility + - BioClothingBeltMedical + - BioClothingBeltJanitor + - BioClothingBeltStorageWaistbag + - BioClothingBeltChef