* enum -> prototype * move sprites * more dirt sprites * some food data stucking fixing * pumpkin fix * pie move sprites * refactor components * pie refactor * remove outdated proto * new pie types * Update SliceableFoodSystem.cs * Refactor food cooking system and add fat flavor Added 'Fat' to the flavor profile. Refactored food cooking logic to use CreateFoodData and UpdateFoodDataVisuals instead of CookFood and ApplyFoodVisuals. Introduced RenameCooker property to CP14FoodCookerComponent to control entity renaming during cooking. Improved separation of food data creation and visual updates. * Update migration.yml * Refactor food visual and sliceable logic in cooking system Moved sliceable food logic from OnCookFinished to UpdateFoodDataVisuals for better encapsulation. Made UpdateFoodDataVisuals overridable and updated its usage in random food initialization. Added Rename field to CP14RandomFoodDataComponent and cleaned up unused BecomeSliceable field in CP14FoodCookerComponent. Updated pie_pan.yml to add SliceableFood and a new random food entity. * Update pie_pan.yml * fill levels
106 lines
2.9 KiB
C#
106 lines
2.9 KiB
C#
/*
|
|
* 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;
|
|
|
|
/// <summary>
|
|
/// Prepares food from ingredients and places it in the FoodHolderComponent
|
|
/// </summary>
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(fieldDeltas: true), Access(typeof(CP14SharedCookingSystem))]
|
|
public sealed partial class CP14FoodCookerComponent : Component
|
|
{
|
|
[DataField(required: true)]
|
|
public ProtoId<CP14FoodTypePrototype> FoodType;
|
|
|
|
[DataField]
|
|
public string ContainerId;
|
|
|
|
[DataField]
|
|
public string? SolutionId;
|
|
|
|
public DoAfterId? DoAfterId = null;
|
|
|
|
/// <summary>
|
|
/// The moment in time when this entity was last heated. Used for calculations when DoAfter cooking should be reset.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public TimeSpan LastHeatingTime = TimeSpan.Zero;
|
|
|
|
/// <summary>
|
|
/// How often do you need to heat this entity so that doAfter does not reset?
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// 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.
|
|
/// </remarks>
|
|
[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<PrototypeLayerData>(data.Visuals);
|
|
Trash = new List<EntProtoId>(data.Trash);
|
|
Flavors = new HashSet<LocId>(data.Flavors);
|
|
SliceProto = data.SliceProto;
|
|
SliceCount = data.SliceCount;
|
|
}
|
|
|
|
[DataField]
|
|
public ProtoId<CP14CookingRecipePrototype>? CurrentRecipe;
|
|
|
|
[DataField]
|
|
public LocId? Name;
|
|
|
|
[DataField]
|
|
public LocId? Desc;
|
|
|
|
[DataField]
|
|
public List<PrototypeLayerData> Visuals = new();
|
|
|
|
[DataField]
|
|
public List<EntProtoId> Trash = new();
|
|
|
|
[DataField]
|
|
public HashSet<LocId> Flavors = new();
|
|
|
|
[DataField]
|
|
public EntProtoId? SliceProto;
|
|
|
|
[DataField]
|
|
public ushort SliceCount = 5;
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public enum CP14CookingVisuals : byte
|
|
{
|
|
Cooking,
|
|
Burning,
|
|
}
|