2022-05-13 00:59:03 -07:00
|
|
|
|
using Content.Shared.Chemistry.Reagent;
|
2022-02-12 17:53:54 -07:00
|
|
|
|
using Content.Shared.FixedPoint;
|
2020-04-26 15:44:20 -05:00
|
|
|
|
using Robust.Shared.Prototypes;
|
2021-11-27 11:50:14 +13:00
|
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
|
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
2020-04-26 15:44:20 -05:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Shared.Kitchen
|
2020-04-26 15:44:20 -05:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// A recipe for space microwaves.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Prototype("microwaveMealRecipe")]
|
2023-11-01 19:56:23 -07:00
|
|
|
|
public sealed partial class FoodRecipePrototype : IPrototype
|
2020-04-26 15:44:20 -05:00
|
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
|
[ViewVariables]
|
2023-01-19 03:56:45 +01:00
|
|
|
|
[IdDataField]
|
2023-08-22 18:14:33 -07:00
|
|
|
|
public string ID { get; private set; } = default!;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
|
|
|
|
|
|
[DataField("name")]
|
2021-02-27 04:12:09 +01:00
|
|
|
|
private string _name = string.Empty;
|
2021-02-20 00:05:24 +01:00
|
|
|
|
|
2022-02-12 17:53:54 -07:00
|
|
|
|
[DataField("reagents", customTypeSerializer:typeof(PrototypeIdDictionarySerializer<FixedPoint2, ReagentPrototype>))]
|
2023-08-22 18:14:33 -07:00
|
|
|
|
private Dictionary<string, FixedPoint2> _ingsReagents = new();
|
2021-03-05 01:08:38 +01:00
|
|
|
|
|
2022-02-12 17:53:54 -07:00
|
|
|
|
[DataField("solids", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<FixedPoint2, EntityPrototype>))]
|
2023-08-22 18:14:33 -07:00
|
|
|
|
private Dictionary<string, FixedPoint2> _ingsSolids = new ();
|
2021-03-05 01:08:38 +01:00
|
|
|
|
|
2021-11-27 11:50:14 +13:00
|
|
|
|
[DataField("result", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
2023-08-22 18:14:33 -07:00
|
|
|
|
public string Result { get; private set; } = string.Empty;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
|
2021-05-04 15:37:16 +02:00
|
|
|
|
[DataField("time")]
|
2023-08-22 18:14:33 -07:00
|
|
|
|
public uint CookTime { get; private set; } = 5;
|
2021-02-20 00:05:24 +01:00
|
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
|
public string Name => Loc.GetString(_name);
|
2021-03-05 01:08:38 +01:00
|
|
|
|
|
2023-09-05 09:55:10 +12:00
|
|
|
|
// TODO Turn this into a ReagentQuantity[]
|
2022-02-12 17:53:54 -07:00
|
|
|
|
public IReadOnlyDictionary<string, FixedPoint2> IngredientsReagents => _ingsReagents;
|
|
|
|
|
|
public IReadOnlyDictionary<string, FixedPoint2> IngredientsSolids => _ingsSolids;
|
2022-09-10 18:47:37 -07:00
|
|
|
|
|
|
|
|
|
|
/// <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;
|
|
|
|
|
|
}
|
2020-04-26 15:44:20 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|