* 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
53 lines
1.6 KiB
C#
53 lines
1.6 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.Components;
|
|
using Content.Shared.Interaction;
|
|
using Robust.Shared.Containers;
|
|
|
|
namespace Content.Shared._CP14.Cooking;
|
|
|
|
public abstract partial class CP14SharedCookingSystem
|
|
{
|
|
private void InitTransfer()
|
|
{
|
|
SubscribeLocalEvent<CP14FoodHolderComponent, AfterInteractEvent>(OnAfterInteract);
|
|
SubscribeLocalEvent<CP14FoodHolderComponent, InteractUsingEvent>(OnInteractUsing);
|
|
|
|
SubscribeLocalEvent<CP14FoodCookerComponent, ContainerIsInsertingAttemptEvent>(OnInsertAttempt);
|
|
}
|
|
|
|
private void OnInteractUsing(Entity<CP14FoodHolderComponent> target, ref InteractUsingEvent args)
|
|
{
|
|
if (!TryComp<CP14FoodHolderComponent>(args.Used, out var used))
|
|
return;
|
|
|
|
TryTransferFood(target, (args.Used, used));
|
|
}
|
|
|
|
private void OnAfterInteract(Entity<CP14FoodHolderComponent> ent, ref AfterInteractEvent args)
|
|
{
|
|
if (!TryComp<CP14FoodHolderComponent>(args.Target, out var target))
|
|
return;
|
|
|
|
TryTransferFood(ent, (args.Target.Value, target));
|
|
}
|
|
|
|
private void OnInsertAttempt(Entity<CP14FoodCookerComponent> ent, ref ContainerIsInsertingAttemptEvent args)
|
|
{
|
|
if (args.Cancelled)
|
|
return;
|
|
|
|
if (!TryComp<CP14FoodHolderComponent>(ent, out var holder))
|
|
return;
|
|
|
|
if (holder.FoodData is not null)
|
|
{
|
|
_popup.PopupEntity(Loc.GetString("cp14-cooking-popup-not-empty", ("name", MetaData(ent).EntityName)), ent);
|
|
args.Cancel();
|
|
}
|
|
}
|
|
}
|