mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* Remove Shared System IPrototypeManager instances * Remove RecipeManager IPrototypeManager instance * Fix ItemSystem IPrototypeManager refs, use TryComp * SharedItemSystem changes, EntWhitelist CompName * HasComponent->HasComp
32 lines
828 B
C#
32 lines
828 B
C#
using System.Linq;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared.Kitchen;
|
|
|
|
public sealed partial class RecipeManager : EntitySystem
|
|
{
|
|
public List<FoodRecipePrototype> Recipes { get; private set; } = new();
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
ReloadRecipes();
|
|
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnPrototypesReloaded);
|
|
}
|
|
|
|
private void OnPrototypesReloaded(PrototypesReloadedEventArgs args)
|
|
{
|
|
if (args.WasModified<FoodRecipePrototype>())
|
|
ReloadRecipes();
|
|
}
|
|
|
|
private void ReloadRecipes()
|
|
{
|
|
Recipes = ProtoMan
|
|
.EnumeratePrototypes<FoodRecipePrototype>()
|
|
.Where(x => !x.SecretRecipe)
|
|
.OrderByDescending(x => x.IngredientCount())
|
|
.ToList();
|
|
}
|
|
}
|