Skip to content

Commit

Permalink
Food System
Browse files Browse the repository at this point in the history
  • Loading branch information
dvir001 committed Jan 25, 2024
1 parent 515ce7f commit 142b921
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 44 deletions.
15 changes: 12 additions & 3 deletions Content.Server/Nutrition/EntitySystems/FoodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down Expand Up @@ -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)
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand Down
41 changes: 0 additions & 41 deletions Resources/Prototypes/_NF/Reagents/Consumables/food.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 142b921

Please sign in to comment.