Files
Delta-v/Content.Shared/Kitchen/MicrowaveMealRecipePrototype.cs
T
fb98bfe575 deepfryer 2.0 (#5043)
* was it worth the hype

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* minor stuff

* multi-ingredient recipe support

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* oil transfer

* explosions and fire

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* make the yaml linter happy

* YML recipes

* typo ops

* review

* Apply suggestions from code review

Milon told me to.

Signed-off-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Stop-Signs <stopsign221@gmail.com>
Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com>
2026-01-06 12:41:29 -06:00

72 lines
2.6 KiB
C#

using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
namespace Content.Shared.Kitchen
{
/// <summary>
/// A recipe for space microwaves.
/// </summary>
[Prototype("microwaveMealRecipe")]
public sealed partial class FoodRecipePrototype : IPrototype
{
[ViewVariables]
[IdDataField]
public string ID { get; private set; } = default!;
[DataField("name")]
private string _name = string.Empty;
[DataField]
public string Group = "Other";
[DataField("reagents", customTypeSerializer:typeof(PrototypeIdDictionarySerializer<FixedPoint2, ReagentPrototype>))]
private Dictionary<string, FixedPoint2> _ingsReagents = new();
[DataField("solids", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<FixedPoint2, EntityPrototype>))]
private Dictionary<string, FixedPoint2> _ingsSolids = new ();
[DataField("result", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string Result { get; private set; } = string.Empty;
[DataField("time")]
public uint CookTime { get; private set; } = 5;
public string Name => Loc.GetString(_name);
// TODO Turn this into a ReagentQuantity[]
public IReadOnlyDictionary<string, FixedPoint2> IngredientsReagents => _ingsReagents;
public IReadOnlyDictionary<string, FixedPoint2> IngredientsSolids => _ingsSolids;
/// <summary>
/// Is this recipe unavailable in normal circumstances?
/// </summary>
[DataField]
public bool SecretRecipe = false;
/// <summary>
/// DeltaV: Changes the guidebook formatting to "Fry for"
/// </summary>
[DataField]
public bool DeepFried;
/// <summary>
/// Count the number of ingredients in a recipe for sorting the recipe list.
/// This makes sure that where ingredient lists overlap, the more complex
/// recipe is picked first.
/// </summary>
public FixedPoint2 IngredientCount()
{
FixedPoint2 n = 0;
n += _ingsReagents.Count; // number of distinct reagents
foreach (FixedPoint2 i in _ingsSolids.Values) // sum the number of solid ingredients
{
n += i;
}
return n;
}
}
}