Material Reclaimer (#14969)
* Material Reclaimer * Fix this test * autostack output, tweak volume, add upgrade examine * whitelist AND blacklist support why not * trying so hard to get this fucking test to work * EmoGarbage delves into MaterialArbitrageTest, never to return * VV and restore cloth to glory * make the system more robust * even more stuff has composition; add blacklist for important items * fix test fails * convert recycling * forgor :sadge: * lol * simply a modiCUM of doc commentary
This commit is contained in:
@@ -213,7 +213,7 @@ public sealed class PricingSystem : EntitySystem
|
||||
{
|
||||
double price = 0;
|
||||
|
||||
if (TryComp<MaterialComponent>(uid, out var material) && !HasComp<StackPriceComponent>(uid))
|
||||
if (TryComp<MaterialComponent>(uid, out var material))
|
||||
{
|
||||
var matPrice = GetMaterialPrice(material);
|
||||
if (TryComp<StackComponent>(uid, out var stack))
|
||||
@@ -229,8 +229,7 @@ public sealed class PricingSystem : EntitySystem
|
||||
{
|
||||
double price = 0;
|
||||
|
||||
if (prototype.Components.TryGetValue(_factory.GetComponentName(typeof(MaterialComponent)), out var materials) &&
|
||||
!prototype.Components.ContainsKey(_factory.GetComponentName(typeof(StackPriceComponent))))
|
||||
if (prototype.Components.TryGetValue(_factory.GetComponentName(typeof(MaterialComponent)), out var materials))
|
||||
{
|
||||
var materialsComp = (MaterialComponent) materials.Component;
|
||||
var matPrice = GetMaterialPrice(materialsComp);
|
||||
@@ -276,7 +275,8 @@ public sealed class PricingSystem : EntitySystem
|
||||
var price = 0.0;
|
||||
|
||||
if (TryComp<StackPriceComponent>(uid, out var stackPrice) &&
|
||||
TryComp<StackComponent>(uid, out var stack))
|
||||
TryComp<StackComponent>(uid, out var stack) &&
|
||||
!HasComp<MaterialComponent>(uid)) // don't double count material prices
|
||||
{
|
||||
price += stack.Count * stackPrice.Price;
|
||||
}
|
||||
@@ -289,7 +289,8 @@ public sealed class PricingSystem : EntitySystem
|
||||
var price = 0.0;
|
||||
|
||||
if (prototype.Components.TryGetValue(_factory.GetComponentName(typeof(StackPriceComponent)), out var stackpriceProto) &&
|
||||
prototype.Components.TryGetValue(_factory.GetComponentName(typeof(StackComponent)), out var stackProto))
|
||||
prototype.Components.TryGetValue(_factory.GetComponentName(typeof(StackComponent)), out var stackProto) &&
|
||||
!prototype.Components.ContainsKey(_factory.GetComponentName(typeof(MaterialComponent))))
|
||||
{
|
||||
var stackPrice = (StackPriceComponent) stackpriceProto.Component;
|
||||
var stack = (StackComponent) stackProto.Component;
|
||||
|
||||
Reference in New Issue
Block a user