reduce lathe recipe copy pasta (#31515)

* add inheritance to lathe recipes and make result an override

* add GetResult method to lathe system

* make other parts of the code use GetResult

* clean up the stock parts yml

* remove unused apu boards from dynamic recipes

* make inverse dictionary public so test doesnt have to copy paste

* revert result override stuff

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2024-08-29 19:36:29 +00:00
committed by GitHub
parent a799d4a785
commit 3bdd2e3a87
5 changed files with 44 additions and 31 deletions

View File

@@ -44,6 +44,7 @@ public sealed class MaterialArbitrageTest
var pricing = entManager.System<PricingSystem>();
var stackSys = entManager.System<StackSystem>();
var mapSystem = server.System<SharedMapSystem>();
var latheSys = server.System<SharedLatheSystem>();
var compFact = server.ResolveDependency<IComponentFactory>();
Assert.That(mapSystem.IsInitialized(testMap.MapId));
@@ -53,12 +54,8 @@ public sealed class MaterialArbitrageTest
var materialName = compFact.GetComponentName(typeof(MaterialComponent));
var destructibleName = compFact.GetComponentName(typeof(DestructibleComponent));
// construct inverted lathe recipe dictionary
Dictionary<string, List<LatheRecipePrototype>> latheRecipes = new();
foreach (var proto in protoManager.EnumeratePrototypes<LatheRecipePrototype>())
{
latheRecipes.GetOrNew(proto.Result).Add(proto);
}
// get the inverted lathe recipe dictionary
var latheRecipes = latheSys.InverseRecipes;
// Lets assume the possible lathe for resource multipliers:
// TODO: each recipe can technically have its own cost multiplier associated with it, so this test needs redone to factor that in.