Co-authored-by: Vitaliy_Merzun <dunoquas487@gmail.com> Co-authored-by: Vigers Ray <60344369+VigersRay@users.noreply.github.com>
82 lines
3.1 KiB
C#
82 lines
3.1 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;
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; //Sunrise-Edit
|
|
using Robust.Shared.Serialization; //Sunrise-Edit
|
|
|
|
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);
|
|
//Sunrise-Start
|
|
[DataField("recipeType", customTypeSerializer: typeof(FlagSerializer<MicrowaveRecipeTypeFlags>))]
|
|
public int RecipeType = (int)MicrowaveRecipeType.Microwave;
|
|
//Sunrise-End
|
|
// 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>
|
|
/// 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;
|
|
}
|
|
}
|
|
//Sunrise-Start
|
|
[Flags, FlagsFor(typeof(MicrowaveRecipeTypeFlags))]
|
|
[Serializable, NetSerializable]
|
|
public enum MicrowaveRecipeType : int
|
|
{
|
|
Microwave = 1,
|
|
ElectricRangeKey = 2,
|
|
MedicalAssembler = 4,
|
|
}
|
|
|
|
public sealed class MicrowaveRecipeTypeFlags { }
|
|
//Sunrise-End
|
|
}
|