remove random food

This commit is contained in:
Ed
2025-09-08 11:51:45 +03:00
parent f84e1ba04d
commit a246db9ec1
6 changed files with 7 additions and 94 deletions

View File

@@ -24,8 +24,6 @@ public sealed class CP14CookingSystem : CP14SharedCookingSystem
{
base.Initialize();
SubscribeLocalEvent<CP14RandomFoodDataComponent, MapInitEvent>(OnRandomFoodMapInit);
SubscribeLocalEvent<CP14FoodHolderComponent, SolutionContainerChangedEvent>(OnHolderChanged);
}
@@ -54,28 +52,6 @@ public sealed class CP14CookingSystem : CP14SharedCookingSystem
Dirty(ent);
}
private void OnRandomFoodMapInit(Entity<CP14RandomFoodDataComponent> ent, ref MapInitEvent args)
{
if (!TryComp<CP14FoodHolderComponent>(ent, out var holder))
return;
if (!_random.Prob(ent.Comp.Prob))
return;
var filteredRecipes = OrderedRecipes.Where(r => r.FoodType == holder.FoodType).ToList();
if (filteredRecipes.Count == 0)
{
Log.Error($"No recipes found for food type {holder.FoodType}");
return;
}
var randomFood = _random.Pick(filteredRecipes);
UpdateFoodDataVisuals((ent, holder), randomFood.FoodData, ent.Comp.Rename);
Dirty(ent.Owner, holder);
}
protected override void OnCookBurned(Entity<CP14FoodCookerComponent> ent, ref CP14BurningDoAfter args)
{
if (args.Cancelled || args.Handled)

View File

@@ -1,17 +0,0 @@
namespace Content.Server._CP14.Cooking;
/// <summary>
/// Attempting to add a random dish to CP14FoodHolderComponent
/// </summary>
[RegisterComponent, Access(typeof(CP14CookingSystem))]
public sealed partial class CP14RandomFoodDataComponent : Component
{
/// <summary>
/// Chance of food appearing
/// </summary>
[DataField]
public float Prob = 0.75f;
[DataField]
public bool Rename = true;
}

View File

@@ -91,20 +91,4 @@
CP14Copper: 20
- type: Food
trash:
- CP14BowlCopper
- type: entity
id: CP14BowlWoodenRandom
parent: CP14BowlWooden
suffix: Random food
components:
- type: CP14RandomFoodData
- type: SolutionContainerManager
solutions:
food:
maxVol: 30
reagents:
- ReagentId: Nutriment
Quantity: 15
- ReagentId: Protein
Quantity: 15
- CP14BowlCopper

View File

@@ -73,20 +73,4 @@
CP14Gold: 10
- type: Food
trash:
- CP14PlateGold
- type: entity
id: CP14PlateWoodenRandom
parent: CP14PlateWooden
suffix: Random food
components:
- type: CP14RandomFoodData
- type: SolutionContainerManager
solutions:
food:
maxVol: 20
reagents:
- ReagentId: Nutriment
Quantity: 10
- ReagentId: Protein
Quantity: 10
- CP14PlateGold

View File

@@ -63,22 +63,4 @@
- type: Spillable
solution: cooker
- type: SolutionContainerVisuals
- type: SliceableFood
- type: entity
id: CP14PlatePieRandom
suffix: Random food
parent: CP14PlatePie
components:
- type: CP14RandomFoodData
- type: SolutionContainerManager
solutions:
cooker:
maxVol: 50
reagents:
- ReagentId: Nutriment
Quantity: 20
- ReagentId: Protein
Quantity: 20
- ReagentId: Fat
Quantity: 10
- type: SliceableFood

View File

@@ -472,6 +472,10 @@ CP14WallmountOrdersBorder: null
CP14FenceGateBigIronDemiplaneCrystal: CP14FenceGateBigIron
CP14FenceGateBigIronGuildmaster: CP14FenceGateBigIron
CP14BowlWoodenRandom: CP14BowlWooden
CP14PlateWoodenRandom: CP14PlateWooden
CP14PlatePieRandom: CP14PlatePie
# <---> CrystallEdge migration zone end