fix microwave deleting entities at will (#1073)

Co-authored-by: FL-OZ <anotherscuffed@gmail.com>
This commit is contained in:
FL-OZ
2020-06-05 11:46:34 -05:00
committed by GitHub
parent fa9169e346
commit 470f81fca1
3 changed files with 69 additions and 19 deletions

View File

@@ -6,7 +6,7 @@ using Robust.Shared.Prototypes;
namespace Content.Shared.Kitchen
{
public class RecipeManager
{
#pragma warning disable 649
@@ -24,6 +24,24 @@ namespace Content.Shared.Kitchen
Recipes.Sort(new RecipeComparer());
}
/// <summary>
/// Check if a prototype ids appears in any of the recipes that exist.
/// </summary>
/// <param name="solidIds"></param>
/// <returns></returns>
public bool SolidAppears(string solidId)
{
foreach(var recipe in Recipes)
{
if(recipe.IngredientsSolids.ContainsKey(solidId))
{
return true;
}
}
return false;
}
private class RecipeComparer : Comparer<FoodRecipePrototype>
{
public override int Compare(FoodRecipePrototype x, FoodRecipePrototype y)
@@ -32,7 +50,7 @@ namespace Content.Shared.Kitchen
{
return 0;
}
return -x.IngredientsReagents.Count.CompareTo(y.IngredientsReagents.Count);
}
}