Add support for printing reagents in lathes (#30476)
* Add support for reagents in lathes * missing locale
This commit is contained in:
@@ -16,6 +16,7 @@ using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
using System.Linq;
|
||||
using Content.Shared.Research.Prototypes;
|
||||
|
||||
namespace Content.Server.Cargo.Systems;
|
||||
|
||||
@@ -158,6 +159,26 @@ public sealed class PricingSystem : EntitySystem
|
||||
return price;
|
||||
}
|
||||
|
||||
public double GetLatheRecipePrice(LatheRecipePrototype recipe)
|
||||
{
|
||||
var price = 0.0;
|
||||
|
||||
if (recipe.Result is { } result)
|
||||
{
|
||||
price += GetEstimatedPrice(_prototypeManager.Index(result));
|
||||
}
|
||||
|
||||
if (recipe.ResultReagents is { } resultReagents)
|
||||
{
|
||||
foreach (var (reagent, amount) in resultReagents)
|
||||
{
|
||||
price += (_prototypeManager.Index(reagent).PricePerUnit * amount).Double();
|
||||
}
|
||||
}
|
||||
|
||||
return price;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a rough price for an entityprototype. Does not consider contained entities.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user