Add support for printing reagents in lathes (#30476)

* Add support for reagents in lathes

* missing locale
This commit is contained in:
Nemanja
2024-08-01 00:15:05 -04:00
committed by GitHub
parent 4b7325098a
commit 2c26be606f
17 changed files with 239 additions and 139 deletions

View File

@@ -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>