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

@@ -61,7 +61,6 @@ namespace Content.Server.Lathe
/// Per-tick cache
/// </summary>
private readonly List<GasMixture> _environments = new();
private readonly HashSet<ProtoId<LatheRecipePrototype>> _availableRecipes = new();
public override void Initialize()
{
@@ -162,12 +161,8 @@ namespace Content.Server.Lathe
public List<ProtoId<LatheRecipePrototype>> GetAvailableRecipes(EntityUid uid, LatheComponent component, bool getUnavailable = false)
{
_availableRecipes.Clear();
AddRecipesFromPacks(_availableRecipes, component.StaticPacks);
var ev = new LatheGetRecipesEvent(uid, getUnavailable)
{
Recipes = _availableRecipes
};
var ev = new LatheGetRecipesEvent((uid, component), getUnavailable);
AddRecipesFromPacks(ev.Recipes, component.StaticPacks);
RaiseLocalEvent(uid, ev);
return ev.Recipes.ToList();
}
@@ -290,7 +285,7 @@ namespace Content.Server.Lathe
var pack = _proto.Index(id);
foreach (var recipe in pack.Recipes)
{
if (args.getUnavailable || database.UnlockedRecipes.Contains(recipe))
if (args.GetUnavailable || database.UnlockedRecipes.Contains(recipe))
args.Recipes.Add(recipe);
}
}
@@ -298,10 +293,8 @@ namespace Content.Server.Lathe
private void OnGetRecipes(EntityUid uid, TechnologyDatabaseComponent component, LatheGetRecipesEvent args)
{
if (uid != args.Lathe || !TryComp<LatheComponent>(uid, out var latheComponent))
return;
AddRecipesFromDynamicPacks(ref args, component, latheComponent.DynamicPacks);
if (uid == args.Lathe)
AddRecipesFromDynamicPacks(ref args, component, args.Comp.DynamicPacks);
}
private void GetEmagLatheRecipes(EntityUid uid, EmagLatheRecipesComponent component, LatheGetRecipesEvent args)
@@ -309,7 +302,7 @@ namespace Content.Server.Lathe
if (uid != args.Lathe)
return;
if (!args.getUnavailable && !_emag.CheckFlag(uid, EmagType.Interaction))
if (!args.GetUnavailable && !_emag.CheckFlag(uid, EmagType.Interaction))
return;
AddRecipesFromPacks(args.Recipes, component.EmagStaticPacks);