From 142b92192e977a311d8ddde6e5f03d40e1e2566f Mon Sep 17 00:00:00 2001 From: Dvir Date: Thu, 25 Jan 2024 22:25:37 +0200 Subject: [PATCH] Food System --- .../Nutrition/EntitySystems/FoodSystem.cs | 15 +++++-- .../_NF/Reagents/Consumables/food.yml | 41 ------------------- 2 files changed, 12 insertions(+), 44 deletions(-) diff --git a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs index 6e39722e3ea..01ef659b36e 100644 --- a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs @@ -32,6 +32,7 @@ using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Content.Shared.Chemistry.Components.SolutionManager; +using Content.Server.Medical; namespace Content.Server.Nutrition.EntitySystems; @@ -56,6 +57,7 @@ public sealed class FoodSystem : EntitySystem [Dependency] private readonly StackSystem _stack = default!; [Dependency] private readonly StomachSystem _stomach = default!; [Dependency] private readonly UtensilSystem _utensil = default!; + [Dependency] private readonly VomitSystem _vomitSystem = default!; public const float MaxFeedDistance = 1.0f; @@ -277,6 +279,7 @@ private void OnDoAfter(EntityUid uid, FoodComponent component, ConsumeDoAfterEve string[] toxinsRegent = { "Toxin", "CarpoToxin", "Mold", "Amatoxin", "SulfuricAcid" }; var healingRegent = "Stimulants"; + var damagingRegent = "Toxin"; _solutionContainer.TryGetSolution(stomachToUse.Owner, StomachSystem.DefaultSolutionName, out var stomachContainer); switch (component.Quality) @@ -297,7 +300,10 @@ private void OnDoAfter(EntityUid uid, FoodComponent component, ConsumeDoAfterEve case Quality.Normal: if (reverseFoodQuality) { - + foreach (var reagent in toxinsRegent) + _solutionContainer.RemoveReagent(stomachToUse.Owner, stomachContainer, reagent, transferAmount * 2); + if (transferAmount >= 5) + _solutionContainer.TryAddReagent(uid, solution, healingRegent, 1, out _); } else { @@ -317,7 +323,8 @@ private void OnDoAfter(EntityUid uid, FoodComponent component, ConsumeDoAfterEve case Quality.Nasty: if (reverseFoodQuality) { - + if (transferAmount >= 5) + _solutionContainer.TryAddReagent(uid, solution, damagingRegent, 1, out _); } else { @@ -327,7 +334,9 @@ private void OnDoAfter(EntityUid uid, FoodComponent component, ConsumeDoAfterEve case Quality.Toxin: if (reverseFoodQuality) { - + if (transferAmount >= 5) + _solutionContainer.TryAddReagent(uid, solution, damagingRegent, 2, out _); + _vomitSystem.Vomit(stomachToUse.Owner, -1000, -1000); // You feel hollow! } else { diff --git a/Resources/Prototypes/_NF/Reagents/Consumables/food.yml b/Resources/Prototypes/_NF/Reagents/Consumables/food.yml index 436c1ce8c62..5b87c97963a 100644 --- a/Resources/Prototypes/_NF/Reagents/Consumables/food.yml +++ b/Resources/Prototypes/_NF/Reagents/Consumables/food.yml @@ -43,44 +43,3 @@ - !type:PlantAdjustHealth amount: 0.5 pricePerUnit: 10 - -- type: reagent - id: ToxinGoblinSafe - name: reagent-name-toxin - group: Toxins - desc: reagent-desc-toxin - flavor: bitter - color: "#cf3600" - physicalDesc: reagent-physical-desc-opaque - plantMetabolism: - - !type:PlantAdjustToxins - amount: 10 - - !type:PlantAdjustHealth - amount: -5 - metabolisms: - Poison: - effects: - - !type:HealthChange - conditions: - - !type:OrganType - type: Goblin - shouldHave: false - damage: - types: - Poison: 4 -# goblins heal a marginal amount of toxin and brute by eating rotten meat foods - - !type:HealthChange - conditions: - - !type:OrganType - type: Goblin - damage: - types: - Poison: -1 - Radiation: -0.1 - - !type:HealthChange - conditions: - - !type:OrganType - type: Goblin - damage: - groups: - Brute: -1