Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Food Quality System (Goblin) #1159

Closed
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
3ced7d0
draft
ErhardSteinhauer Mar 27, 2024
a147065
Food System
dvir001 Mar 27, 2024
199e72b
Create fun.yml
dvir001 Mar 27, 2024
d9862db
food stuffs
ErhardSteinhauer Mar 27, 2024
79f80e2
Merge branch 'GoblinFoodSystem' of https://github.com/ErhardSteinhaue…
ErhardSteinhauer Mar 27, 2024
2fca643
there_do_be_goblins.txt
ErhardSteinhauer Mar 27, 2024
142b1a3
revert changes to toxins.yml
ErhardSteinhauer Mar 27, 2024
443322c
Merge branch 'GoblinFoodSystem' of https://github.com/ErhardSteinhaue…
ErhardSteinhauer Mar 27, 2024
03ce1a6
Update pie.yml
dvir001 Mar 27, 2024
d7f6d41
Merge branch 'GoblinFoodSystem' of https://github.com/ErhardSteinhaue…
dvir001 Mar 27, 2024
0c82113
mail things
ErhardSteinhauer Mar 27, 2024
a93646a
Merge branch 'GoblinFoodSystem' of https://github.com/ErhardSteinhaue…
ErhardSteinhauer Mar 27, 2024
06c29ad
Update StomachComponent.cs
dvir001 Mar 31, 2024
85538a2
Update FoodComponent.cs
dvir001 Mar 31, 2024
c4e7c52
Update StomachComponent.cs
dvir001 Mar 31, 2024
730522f
Merge branch 'master' into GoblinFoodSystem
dvir001 Apr 27, 2024
38f3a33
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer Apr 27, 2024
075435b
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer Apr 29, 2024
611be4a
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer Apr 29, 2024
ba68a1b
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer Apr 29, 2024
802d6f1
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer Apr 29, 2024
3fafed3
Merge branch 'master' of https://github.com/dvir001/frontier-station-…
dvir001 May 3, 2024
a41995a
Food System Multi types support
dvir001 May 3, 2024
9693762
trash eating gob stomach
ErhardSteinhauer May 3, 2024
fe792f7
Update FoodSystem.cs
dvir001 May 3, 2024
2ff271a
Merge branch 'GoblinFoodSystem' of https://github.com/ErhardSteinhaue…
dvir001 May 3, 2024
bd84268
Update FoodSystem.cs
dvir001 May 3, 2024
a3cf959
more trash food
ErhardSteinhauer May 3, 2024
24c27e8
Food
dvir001 May 3, 2024
d009322
Merge branch 'GoblinFoodSystem' of https://github.com/ErhardSteinhaue…
dvir001 May 3, 2024
f890786
Allow goblin to eat open mail only
dvir001 May 3, 2024
94294be
yml fixes
ErhardSteinhauer May 4, 2024
e9a96a6
more yml fixes
ErhardSteinhauer May 4, 2024
0b59814
No More refill
dvir001 May 4, 2024
39aefbd
less corn in cob
ErhardSteinhauer May 4, 2024
0d099ee
Pain
dvir001 May 4, 2024
0d15fce
Fixing
dvir001 May 4, 2024
052d619
Moff
dvir001 May 4, 2024
118699e
Update paper.yml
dvir001 May 4, 2024
ac5ed9a
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer May 8, 2024
b68dbc3
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer May 15, 2024
4986a68
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer May 15, 2024
43c326c
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer May 15, 2024
e170050
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer May 16, 2024
69e9585
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer May 17, 2024
86e939a
Merge branch 'master' into GoblinFoodSystem
ErhardSteinhauer May 20, 2024
a411773
Merge branch 'master' of https://github.com/dvir001/frontier-station-…
dvir001 May 30, 2024
4874a83
Merge branch 'GoblinFoodSystem' of https://github.com/ErhardSteinhaue…
dvir001 May 30, 2024
eaee2bf
Fixup
dvir001 May 30, 2024
7298cf6
Update burger.yml
dvir001 May 30, 2024
7a6338e
Update FoodSystem.cs
dvir001 May 30, 2024
6c7010f
Update FoodSystem.cs
dvir001 May 30, 2024
483d048
Update Resources/Locale/en-US/_NF/nutrition/components/food-component…
dvir001 May 30, 2024
311260b
Update FoodSystem.cs
dvir001 May 30, 2024
92dd46b
Update Resources/Locale/en-US/_NF/reagents/foods.ftl
dvir001 May 31, 2024
4130c94
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer Jun 1, 2024
bf200cb
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer Jun 2, 2024
9aebf22
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer Jun 6, 2024
38f6b4e
mail
ErhardSteinhauer Jun 14, 2024
5773635
Merge branch 'GoblinFoodSystem' of https://github.com/ErhardSteinhaue…
ErhardSteinhauer Jun 14, 2024
5b5852e
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer Jun 14, 2024
743d8f2
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer Jun 15, 2024
cbc57d7
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer Jun 19, 2024
27f449a
Merge branch 'new-frontiers-14:master' into GoblinFoodSystem
ErhardSteinhauer Jun 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Content.Server/Body/Components/StomachComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,29 @@ public ReagentDelta(ReagentQuantity reagentQuantity)

public void Increment(TimeSpan delta) => Lifetime += delta;
}

/// <summary>
/// Frontier - Used by goblin for fliping the food quility effects
/// </summary>
[DataField]
public bool ReverseFoodQuality = false;

/// <summary>
/// Frontier - Allow eating mail TODO: Move this to a switch before fully added.
/// </summary>
[DataField]
public bool MailDigestion = false;

/// <summary>
/// Frontier - Allow eating fiber like food (Moth food)
/// </summary>
[DataField]
public bool FiberDigestion = false;

/// <summary>
/// Frontier - Allow eating trash
/// </summary>
[DataField]
public bool TrashDigestion = false;
}
}
17 changes: 16 additions & 1 deletion Content.Server/Nutrition/Components/FoodComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
using Content.Shared.FixedPoint;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Content.Server.Mail; // Frontier

using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;

namespace Content.Server.Nutrition.Components;

[RegisterComponent, Access(typeof(FoodSystem))]
[RegisterComponent, Access(typeof(FoodSystem), typeof(MailSystem))] // Frontier
public sealed partial class FoodComponent : Component
{
[DataField]
Expand Down Expand Up @@ -74,4 +77,16 @@ public sealed partial class FoodComponent : Component
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool RequireDead = true;

/// <summary>
/// Frontier - Nasty food, used for goblins to know if they can eat it or not
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField] // Frontier
dvir001 marked this conversation as resolved.
Show resolved Hide resolved
public string[] Quality = { "Normal" };

/// <summary>
/// Frontier - Edited by the system to find the final quility results
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField] // Frontier
public string FinalQuality = "Normal";
}
188 changes: 186 additions & 2 deletions Content.Server/Nutrition/EntitySystems/FoodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
using Robust.Shared.Audio.Systems;
using Robust.Shared.Utility;
using System.Linq;
using Content.Server.Medical; // Frontier
using Content.Shared.Speech.EntitySystems; // Frontier
using Robust.Shared.Random; // Frontier
using Content.Shared.Jittering; // Frontier
using Content.Server.Chat.Systems; // Frontier
using Content.Shared.Tag; // Frontier

namespace Content.Server.Nutrition.EntitySystems;

Expand All @@ -55,6 +61,12 @@ 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 _vomit = default!; // Frontier
[Dependency] private readonly SharedStutteringSystem _stuttering = default!; // Frontier
[Dependency] protected readonly IRobustRandom RobustRandom = default!; // Frontier
[Dependency] private readonly SharedJitteringSystem _jittering = default!; // Frontier
[Dependency] private readonly ChatSystem _chat = default!; // Frontier
[Dependency] private readonly TagSystem _tag = default!; // Frontier

public const float MaxFeedDistance = 1.0f;

Expand Down Expand Up @@ -230,6 +242,7 @@ private void OnDoAfter(Entity<FoodComponent> entity, ref ConsumeDoAfterEvent arg
// Get the stomach with the highest available solution volume
var highestAvailable = FixedPoint2.Zero;
StomachComponent? stomachToUse = null;
var reverseFoodQuality = false; // Frontier
foreach (var (stomach, _) in stomachs)
{
var owner = stomach.Owner;
Expand All @@ -244,6 +257,7 @@ private void OnDoAfter(Entity<FoodComponent> entity, ref ConsumeDoAfterEvent arg

stomachToUse = stomach;
highestAvailable = stomachSol.AvailableVolume;
reverseFoodQuality = stomachToUse.ReverseFoodQuality; // Frontier
}

// No stomach so just popup a message that they can't eat.
Expand All @@ -257,13 +271,150 @@ private void OnDoAfter(Entity<FoodComponent> entity, ref ConsumeDoAfterEvent arg
_reaction.DoEntityReaction(args.Target.Value, solution, ReactionMethod.Ingestion);
_stomach.TryTransferSolution(stomachToUse.Owner, split, stomachToUse);

/// Frontier - Food quality system
var foodQuality = entity.Comp.Quality;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with suggestion above, replace entity.Comp.FinalQuality with a local variable. It is only used within this function and does not need to live longer. Suggestion uses string as enumeration isn't used at time of writing.

Suggested change
var foodQuality = entity.Comp.Quality;
var foodQuality = entity.Comp.Quality;
var finalFoodQuality = "Junk";

If accepting this, replace all entity.Comp.FinalQuality entries with finalFoodQuality or whatever local variable name you choose.

var showFlavors = true;

foreach (var quality in foodQuality)
{
if (quality == null)
continue;
else if (quality == "High")
entity.Comp.FinalQuality = "High";
else if (quality == "Normal")
entity.Comp.FinalQuality = "Normal";
else if (quality == "Junk")
entity.Comp.FinalQuality = "Junk";
else if (quality == "Nasty")
entity.Comp.FinalQuality = "Nasty";
else if (quality == "Toxin")
dvir001 marked this conversation as resolved.
Show resolved Hide resolved
entity.Comp.FinalQuality = "Toxin";
else if ((quality == "Trash") || (quality == "Mail") || (quality == "Fiber"))
entity.Comp.FinalQuality = "Trash";

if (reverseFoodQuality)
{
if (quality == "High")
entity.Comp.FinalQuality = "Toxin";
else if (quality == "Normal")
entity.Comp.FinalQuality = "Nasty";
else if (quality == "Nasty")
entity.Comp.FinalQuality = "Normal";
else if (quality == "Toxin")
entity.Comp.FinalQuality = "High";
}

// TODO: Add detection for fried food on nasty to update it to toxin for goblins.
// TODO: Add inspect food but only for goblin eyes to see, goblins can tell food quality.

string[] toxinsRegent = { "Toxin", "CarpoToxin", "Mold", "Amatoxin", "SulfuricAcid" };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions:

  • move toxin list to a static readonly field in the class.
  • Rename to ToxinReagents (or toxinReagents if local)
  • Add Gastrotoxin and Bungotoxin, for rotten meat and bungo pits.

var speedRegent = "Stimulants";
var damagingRegent = "Toxin";
var emoteId = "Laugh";
Comment on lines +313 to +315
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace with const versions? Recommendation: refactor Regent->Reagent.

Suggested change
var speedRegent = "Stimulants";
var damagingRegent = "Toxin";
var emoteId = "Laugh";
const string speedRegent = "Stimulants";
const string damagingRegent = "Toxin";
const string emoteId = "Laugh";


var msgNasty = Loc.GetString("food-system-nasty", ("used", args.Used), ("target", args.Target));
var msgToxin = Loc.GetString("food-system-toxin", ("used", args.Used), ("target", args.Target));

TryComp<BloodstreamComponent>(args.Target.Value, out var bloodStream);

if (entity.Comp.FinalQuality == "High")
{
if (reverseFoodQuality)
{
if (_solutionContainer.ResolveSolution(stomachToUse.Owner, stomachToUse.BodySolutionName, ref stomachToUse.Solution))
{
foreach (var reagent in toxinsRegent)
_solutionContainer.RemoveReagent(stomachToUse.Solution.Value, reagent, FixedPoint2.New((int) transferAmount)); // Remove from body before it goes to blood
_solutionContainer.RemoveReagent(stomachToUse.Solution.Value, "Flavorol", FixedPoint2.New((int) transferAmount)); // Remove from body before it goes to blood
}
if (_solutionContainer.ResolveSolution(args.Target.Value, bloodStream!.ChemicalSolutionName, ref bloodStream.ChemicalSolution))
_solutionContainer.TryAddReagent(bloodStream.ChemicalSolution.Value, speedRegent, FixedPoint2.New((int) transferAmount / 3), out _); // Add to blood
}
}
else if (entity.Comp.FinalQuality == "Normal")
{
if (reverseFoodQuality)
{
if (_solutionContainer.ResolveSolution(stomachToUse.Owner, stomachToUse.BodySolutionName, ref stomachToUse.Solution))
{
foreach (var reagent in toxinsRegent)
_solutionContainer.RemoveReagent(stomachToUse.Solution.Value, reagent, FixedPoint2.New((int) transferAmount)); // Remove from body before it goes to blood
_solutionContainer.RemoveReagent(stomachToUse.Solution.Value, "Flavorol", FixedPoint2.New((int) transferAmount)); // Remove from body before it goes to blood
}
if (_solutionContainer.ResolveSolution(args.Target.Value, bloodStream!.ChemicalSolutionName, ref bloodStream.ChemicalSolution))
_solutionContainer.TryAddReagent(bloodStream.ChemicalSolution.Value, speedRegent, FixedPoint2.New((int) transferAmount / 5), out _); // Add to blood
}
}
else if (entity.Comp.FinalQuality == "Junk")
{
if (reverseFoodQuality)
{
if (_solutionContainer.ResolveSolution(stomachToUse.Owner, stomachToUse.BodySolutionName, ref stomachToUse.Solution))
{
foreach (var reagent in toxinsRegent)
_solutionContainer.RemoveReagent(stomachToUse.Solution.Value, reagent, FixedPoint2.New((int) transferAmount)); // Remove from body before it goes to blood
_solutionContainer.RemoveReagent(stomachToUse.Solution.Value, "Flavorol", FixedPoint2.New((int) transferAmount)); // Remove from body before it goes to blood
}
if (_solutionContainer.ResolveSolution(args.Target.Value, bloodStream!.ChemicalSolutionName, ref bloodStream.ChemicalSolution))
_solutionContainer.TryAddReagent(bloodStream.ChemicalSolution.Value, speedRegent, FixedPoint2.New((int) transferAmount / 7), out _); // Add to blood
}
}
else if (entity.Comp.FinalQuality == "Nasty")
{
if (reverseFoodQuality)
{
showFlavors = false;
_popup.PopupEntity(msgNasty, args.Target.Value, args.User);

if (_solutionContainer.ResolveSolution(stomachToUse.Owner, stomachToUse.BodySolutionName, ref stomachToUse.Solution))
_solutionContainer.RemoveReagent(stomachToUse.Solution.Value, "Flavorol", FixedPoint2.New((int) transferAmount)); // Remove from body before it goes to blood
if (_solutionContainer.ResolveSolution(args.Target.Value, bloodStream!.ChemicalSolutionName, ref bloodStream.ChemicalSolution))
_solutionContainer.TryAddReagent(bloodStream.ChemicalSolution.Value, damagingRegent, FixedPoint2.New((int) transferAmount / 5), out _); // Add to blood
_stuttering.DoStutter(args.Target.Value, TimeSpan.FromSeconds(5), false); // Gives stuttering
_jittering.DoJitter(args.Target.Value, TimeSpan.FromSeconds(5), true, 40f, 4f, true, null);
}
}
else if (entity.Comp.FinalQuality == "Toxin")
{
if (reverseFoodQuality)
{
showFlavors = false;
_popup.PopupEntity(msgToxin, args.Target.Value, args.User);

if (_solutionContainer.ResolveSolution(stomachToUse.Owner, stomachToUse.BodySolutionName, ref stomachToUse.Solution))
_solutionContainer.RemoveReagent(stomachToUse.Solution.Value, "Flavorol", FixedPoint2.New((int) transferAmount)); // Remove from body before it goes to blood
if (_solutionContainer.ResolveSolution(args.Target.Value, bloodStream!.ChemicalSolutionName, ref bloodStream.ChemicalSolution))
_solutionContainer.TryAddReagent(bloodStream.ChemicalSolution.Value, damagingRegent, FixedPoint2.New((int) transferAmount / 3), out _); // Add to blood
_stuttering.DoStutter(args.Target.Value, TimeSpan.FromSeconds(5), false); // Gives stuttering
_jittering.DoJitter(args.Target.Value, TimeSpan.FromSeconds(5), true, 80f, 8f, true, null);
_chat.TryEmoteWithoutChat(args.Target.Value, emoteId);

if (RobustRandom.Prob(.05f)) // 5% to puke
_vomit.Vomit(args.Target.Value);
}
}
else if (entity.Comp.FinalQuality == "Trash")
{
if (_solutionContainer.ResolveSolution(stomachToUse.Owner, stomachToUse.BodySolutionName, ref stomachToUse.Solution))
{
foreach (var reagent in toxinsRegent)
_solutionContainer.RemoveReagent(stomachToUse!.Solution.Value, reagent, FixedPoint2.New((int) transferAmount)); // Remove from body before it goes to blood
_solutionContainer.RemoveReagent(stomachToUse!.Solution.Value, "Flavorol", FixedPoint2.New((int) transferAmount)); // Remove from body before it goes to blood
}
if (_solutionContainer.ResolveSolution(args.Target.Value, bloodStream!.ChemicalSolutionName, ref bloodStream.ChemicalSolution))
_solutionContainer.TryAddReagent(bloodStream.ChemicalSolution.Value, speedRegent, FixedPoint2.New((int) transferAmount), out _); // Add to blood
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can make this a lot cleaner if you just put the number in the quality enum like so;

public enum Quality
{
    Trash,
    Toxin,
    Nasty,
    Junk,
    Normal,
    High
}

public static class QualityExtensions
{
    private static readonly Dictionary<Quality, int> transferMultipliers = new Dictionary<Quality, int>
    {
        { Quality.Trash, 1 },
        { Quality.Toxin, 3 },
        { Quality.Nasty, 5 },
        { Quality.Junk, 7 },
        { Quality.Normal, 5 },
        { Quality.High, 3 }
    };

    public static int GetTransferMultiplier(this Quality quality)
    {
        if (transferMultipliers.TryGetValue(quality, out int multiplier))
        {
            return multiplier;
        }
        throw new InvalidOperationException("No multiplier defined for this quality");
    }
}

and then just split it up into a function or so if it is not reversed:

        Quality finalQuality = Enum.Parse<Quality>(entity.Comp.FinalQuality);
        int transferMultiplier = finalQuality.GetTransferMultiplier();

        if (_solutionContainer.ResolveSolution(stomachToUse.Owner, stomachToUse.BodySolutionName, ref stomachToUse.Solution))
        {
            foreach (var reagent in toxinsRegent)
                _solutionContainer.RemoveReagent(stomachToUse.Solution.Value, reagent, FixedPoint2.New((int) transferAmount));

            _solutionContainer.RemoveReagent(stomachToUse.Solution.Value, "Flavorol", FixedPoint2.New((int) transferAmount));
        }

        if (_solutionContainer.ResolveSolution(args.Target.Value, bloodStream!.ChemicalSolutionName, ref bloodStream.ChemicalSolution))
            _solutionContainer.TryAddReagent(bloodStream.ChemicalSolution.Value, speedRegent, FixedPoint2.New((int) transferAmount / transferMultiplier), out _);

        switch (finalQuality)
        {
            case Quality.Nasty:
                showFlavors = false;
                _popup.PopupEntity(msgNasty, args.Target.Value, args.User);
                _stuttering.DoStutter(args.Target.Value, TimeSpan.FromSeconds(5), false);
                _jittering.DoJitter(args.Target.Value, TimeSpan.FromSeconds(5), true, 40f, 4f, true, null);
                break;
            case Quality.Toxin:
                showFlavors = false;
                _popup.PopupEntity(msgToxin, args.Target.Value, args.User);
                _stuttering.DoStutter(args.Target.Value, TimeSpan.FromSeconds(5), false);
                _jittering.DoJitter(args.Target.Value, TimeSpan.FromSeconds(5), true, 80f, 8f, true, null);
                _chat.TryEmoteWithoutChat(args.Target.Value, emoteId);
                if (RobustRandom.Prob(.05f)) // 5% to puke
                    _vomit.Vomit(args.Target.Value);
                break;
            default:
                // No additional actions for other qualities
                break;
        }

/// Frontier - Food quality system end

var flavors = args.FlavorMessage;

if (forceFeed)
{
var targetName = Identity.Entity(args.Target.Value, EntityManager);
var userName = Identity.Entity(args.User, EntityManager);
_popup.PopupEntity(Loc.GetString("food-system-force-feed-success", ("user", userName), ("flavors", flavors)), entity.Owner, entity.Owner);
if (showFlavors) // Frontier
_popup.PopupEntity(Loc.GetString("food-system-force-feed-success", ("user", userName), ("flavors", flavors)), entity.Owner, entity.Owner);

_popup.PopupEntity(Loc.GetString("food-system-force-feed-success-user", ("target", targetName)), args.User, args.User);

Expand All @@ -272,7 +423,8 @@ private void OnDoAfter(Entity<FoodComponent> entity, ref ConsumeDoAfterEvent arg
}
else
{
_popup.PopupEntity(Loc.GetString(entity.Comp.EatMessage, ("food", entity.Owner), ("flavors", flavors)), args.User, args.User);
if (showFlavors) // Frontier
_popup.PopupEntity(Loc.GetString(entity.Comp.EatMessage, ("food", entity.Owner), ("flavors", flavors)), args.User, args.User);

// log successful voluntary eating
_adminLogger.Add(LogType.Ingestion, LogImpact.Low, $"{ToPrettyString(args.User):target} ate {ToPrettyString(entity.Owner):food}");
Expand All @@ -288,6 +440,8 @@ private void OnDoAfter(Entity<FoodComponent> entity, ref ConsumeDoAfterEvent arg

args.Repeat = !forceFeed;

_solutionContainer.SetCapacity(soln.Value, soln.Value.Comp.Solution.MaxVolume - transferAmount); // Frontier - You cannot eat a cake and leave it whole

if (TryComp<StackComponent>(entity, out var stack))
{
//Not deleting whole stack piece will make troubles with grinding object
Expand Down Expand Up @@ -402,6 +556,36 @@ private bool IsDigestibleBy(EntityUid food, FoodComponent component, List<(Stoma
// Run through the mobs' stomachs
foreach (var (comp, _) in stomachs)
{
// Frontier - Food system hack job
var foodQuality = component.Quality;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can component.Quality be used directly in the foreach?

var foodQualityblock = false;
foreach (var quality in foodQuality)
{
if (quality == "Mail" || quality == "Fiber" || quality == "Trash")
{
if (comp.MailDigestion && quality == "Mail")
{
foodQualityblock = false;
break;
}
else if (comp.FiberDigestion && quality == "Fiber")
{
foodQualityblock = false;
break;
}
else if (comp.TrashDigestion && quality == "Trash")
{
foodQualityblock = false;
break;
}
else
foodQualityblock = true;
}
}
if (foodQualityblock)
return false;
dvir001 marked this conversation as resolved.
Show resolved Hide resolved
// Frontier - Food system hack job

// Find a stomach with a SpecialDigestible
if (comp.SpecialDigestible == null)
continue;
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ private bool TrySliceFood(EntityUid uid, EntityUid user, EntityUid usedItem,
return false;
}

_solutionContainerSystem.SetCapacity(soln.Value, soln.Value.Comp.Solution.MaxVolume - (solution.Volume / FixedPoint2.New(component.Count))); // Frontier - You cannot eat a cake and leave it whole

var sliceUid = Slice(uid, user, component, transform);

var lostSolution = _solutionContainerSystem.SplitSolution(soln.Value, solution.Volume / FixedPoint2.New(component.Count));
Expand Down
3 changes: 3 additions & 0 deletions Content.Server/Nyanotrasen/Mail/MailSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,9 @@ public void OpenMail(EntityUid uid, MailComponent? component = null, EntityUid?
_handsSystem.PickupOrDrop(user, entity);
}

if (TryComp<FoodComponent>(uid, out var food)) // Frontier
food.Quality = new string[] { "Mail", "Fiber", "Trash" };

_tagSystem.AddTag(uid, "Trash");
_tagSystem.AddTag(uid, "Recyclable");
component.IsEnabled = false;
Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/en-US/_NF/flavors/flavor-profiles.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flavor-base-trashjuice = trashy
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
food-system-nasty = This food gross.
food-system-toxin = This food bad.
dvir001 marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/_NF/reagents/foods.ftl
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
reagent-name-flaverol = Flaverol

reagent-name-trashjuice = trash juices
dvir001 marked this conversation as resolved.
Show resolved Hide resolved
reagent-desc-trashjuice = Do you really want to know what it is?
1 change: 1 addition & 0 deletions Resources/Locale/en-US/_NF/reagents/physical-desc.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
reagent-physical-desc-trashjuice = ... Wait.. Did it just move?
4 changes: 2 additions & 2 deletions Resources/Prototypes/Body/Organs/Animal/animal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
abstract: true
components:
- type: Organ
- type: Food
# quality: Nasty # Frontier
- type: Food # Frontier
quality: [ "Nasty" ] # Frontier
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be godly if you can turn this into something like:

metabolizerTypes: [ Animal ]

you'd have to turn it into a prototype and it will be cleaner

- type: Sprite
sprite: Mobs/Species/Human/organs.rsi
- type: StaticPrice
Expand Down
4 changes: 2 additions & 2 deletions Resources/Prototypes/Body/Organs/human.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
- type: Sprite
sprite: Mobs/Species/Human/organs.rsi
- type: Organ
- type: Food
# quality: Nasty # Frontier
- type: Food # Frontier
quality: [ "Nasty" ] # Frontier
- type: Extractable
grindableSolutionName: organ
- type: SolutionContainerManager
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Body/Organs/moth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# - Fruit
# - Pill
# - Crayon
fiberDigestion: true
- type: SolutionContainerManager
solutions:
stomach:
Expand Down
2 changes: 2 additions & 0 deletions Resources/Prototypes/Body/Parts/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
name: "body part"
abstract: true
components:
- type: Food # Frontier
quality: [ "Nasty" ] # Frontier
- type: Damageable
damageContainer: Biological
- type: BodyPart
Expand Down
Loading
Loading