Fix secfab being able to print protolathe items (#17443)
This commit is contained in:
@@ -53,13 +53,14 @@ namespace Content.Server.Lathe
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
foreach (var (comp, lathe) in EntityQuery<LatheProducingComponent, LatheComponent>())
|
||||
var query = EntityQueryEnumerator<LatheProducingComponent, LatheComponent>();
|
||||
while(query.MoveNext(out var uid, out var comp, out var lathe))
|
||||
{
|
||||
if (lathe.CurrentRecipe == null)
|
||||
continue;
|
||||
|
||||
if ( _timing.CurTime - comp.StartTime >= comp.ProductionLength)
|
||||
FinishProducing(comp.Owner, lathe);
|
||||
FinishProducing(uid, lathe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,9 +109,7 @@ namespace Content.Server.Lathe
|
||||
|
||||
public List<string> GetAllBaseRecipes(LatheComponent component)
|
||||
{
|
||||
return component.DynamicRecipes == null
|
||||
? component.StaticRecipes
|
||||
: component.StaticRecipes.Union(component.DynamicRecipes).ToList();
|
||||
return component.StaticRecipes.Union(component.DynamicRecipes).ToList();
|
||||
}
|
||||
|
||||
public bool TryAddToQueue(EntityUid uid, LatheRecipePrototype recipe, LatheComponent? component = null)
|
||||
@@ -191,10 +190,15 @@ namespace Content.Server.Lathe
|
||||
|
||||
private void OnGetRecipes(EntityUid uid, TechnologyDatabaseComponent component, LatheGetRecipesEvent args)
|
||||
{
|
||||
if (uid != args.Lathe || !TryComp<LatheComponent>(uid, out var latheComponent) || latheComponent.DynamicRecipes == null)
|
||||
if (uid != args.Lathe || !TryComp<LatheComponent>(uid, out var latheComponent))
|
||||
return;
|
||||
|
||||
args.Recipes = args.Recipes.Union(component.UnlockedRecipes.Where(r => latheComponent.DynamicRecipes.Contains(r))).ToList();
|
||||
foreach (var recipe in latheComponent.DynamicRecipes)
|
||||
{
|
||||
if (!component.UnlockedRecipes.Contains(recipe))
|
||||
continue;
|
||||
args.Recipes.Add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMaterialAmountChanged(EntityUid uid, LatheComponent component, ref MaterialAmountChangedEvent args)
|
||||
|
||||
Reference in New Issue
Block a user