Fix lathe arbitrage test (#34449)

* Fix lathe arbitrage test

* Add refinables

* nullable

* nullable2

* Fix merge

* Ignore failures
This commit is contained in:
Leon Friedrich
2025-04-17 21:07:51 +10:00
committed by GitHub
parent 9b3f37f5af
commit f46bb301fb
4 changed files with 156 additions and 38 deletions

View File

@@ -21,6 +21,9 @@ namespace Content.Shared.Lathe
/// </summary>
[DataField]
public List<ProtoId<LatheRecipePackPrototype>> DynamicPacks = new();
// Note that this shouldn't be modified dynamically.
// I.e., this + the static recipies should represent all recipies that the lathe can ever make
// Otherwise the material arbitrage test and/or LatheSystem.GetAllBaseRecipes needs to be updated
/// <summary>
/// The lathe's construction queue
@@ -81,15 +84,16 @@ namespace Content.Shared.Lathe
public sealed class LatheGetRecipesEvent : EntityEventArgs
{
public readonly EntityUid Lathe;
public readonly LatheComponent Comp;
public bool getUnavailable;
public bool GetUnavailable;
public HashSet<ProtoId<LatheRecipePrototype>> Recipes = new();
public LatheGetRecipesEvent(EntityUid lathe, bool forced)
public LatheGetRecipesEvent(Entity<LatheComponent> lathe, bool forced)
{
Lathe = lathe;
getUnavailable = forced;
(Lathe, Comp) = lathe;
GetUnavailable = forced;
}
}

View File

@@ -34,6 +34,25 @@ public abstract class SharedLatheSystem : EntitySystem
BuildInverseRecipeDictionary();
}
/// <summary>
/// Get the set of all recipes that a lathe could possibly ever create (e.g., if all techs were unlocked).
/// </summary>
public HashSet<ProtoId<LatheRecipePrototype>> GetAllPossibleRecipes(LatheComponent component)
{
var recipes = new HashSet<ProtoId<LatheRecipePrototype>>();
foreach (var pack in component.StaticPacks)
{
recipes.UnionWith(_proto.Index(pack).Recipes);
}
foreach (var pack in component.DynamicPacks)
{
recipes.UnionWith(_proto.Index(pack).Recipes);
}
return recipes;
}
/// <summary>
/// Add every recipe in the list of recipe packs to a single hashset.
/// </summary>