/* * This file is sublicensed under MIT License * https://github.com/space-wizards/space-station-14/blob/master/LICENSE.TXT */ using Content.Shared._CP14.Cooking.Prototypes; using Content.Shared.DoAfter; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; namespace Content.Shared._CP14.Cooking.Components; /// /// Prepares food from ingredients and places it in the FoodHolderComponent /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(fieldDeltas: true), Access(typeof(CP14SharedCookingSystem))] public sealed partial class CP14FoodCookerComponent : Component { [DataField(required: true)] public ProtoId FoodType; [DataField] public string ContainerId; [DataField] public string? SolutionId; public DoAfterId? DoAfterId = null; /// /// The moment in time when this entity was last heated. Used for calculations when DoAfter cooking should be reset. /// [DataField, AutoNetworkedField] public TimeSpan LastHeatingTime = TimeSpan.Zero; /// /// How often do you need to heat this entity so that doAfter does not reset? /// /// /// Ideally, this system should check that the Cooker temperature is within certain limits, /// but at the moment the entire temperature system is a terrible mess that we don't want to get deeply involved with, /// so we simplify the simulation by simply requiring the heating action to be performed. /// We don't care how much it heats up, we care how long it takes. /// [DataField] public TimeSpan HeatingFrequencyRequired = TimeSpan.FromSeconds(2f); [DataField] public EntProtoId? BurntAdditionalSpawn = "CP14Fire"; [DataField] public float BurntAdditionalSpawnProb = 0.2f; [DataField] public bool RenameCooker = false; } [Serializable] [DataDefinition] public sealed partial class CP14FoodData { public CP14FoodData(CP14FoodData data) { CurrentRecipe = data.CurrentRecipe; Name = data.Name; Desc = data.Desc; Visuals = new List(data.Visuals); Trash = new List(data.Trash); Flavors = new HashSet(data.Flavors); SliceProto = data.SliceProto; SliceCount = data.SliceCount; } [DataField] public ProtoId? CurrentRecipe; [DataField] public LocId? Name; [DataField] public LocId? Desc; [DataField] public List Visuals = new(); [DataField] public List Trash = new(); [DataField] public HashSet Flavors = new(); [DataField] public EntProtoId? SliceProto; [DataField] public ushort SliceCount = 5; } [Serializable, NetSerializable] public enum CP14CookingVisuals : byte { Cooking, Burning, }