Files
crystall-punk-14/Content.Server/Nutrition/Components/SliceableFoodComponent.cs
Red 8721f736e1 Cooking simulator 3: Pies (#1540)
* 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
2025-07-20 15:45:59 +03:00

39 lines
1.0 KiB
C#

using Content.Server._CP14.Cooking;
using Content.Server.Nutrition.EntitySystems;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
namespace Content.Server.Nutrition.Components;
[RegisterComponent, Access(typeof(SliceableFoodSystem), typeof(CP14CookingSystem))]
public sealed partial class SliceableFoodComponent : Component
{
/// <summary>
/// Prototype to spawn after slicing.
/// If null then it can't be sliced.
/// </summary>
[DataField]
public EntProtoId? Slice;
[DataField]
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Items/Culinary/chop.ogg");
/// <summary>
/// Number of slices the food starts with.
/// </summary>
[DataField("count")]
public ushort TotalCount = 5;
/// <summary>
/// how long it takes for this food to be sliced
/// </summary>
[DataField]
public float SliceTime = 1f;
/// <summary>
/// all the pieces will be shifted in random directions.
/// </summary>
[DataField]
public float SpawnOffset = 0.5f;
}