Fix static pricing for stacks (#14865)

Removed BaseItem price as it was always a placeholder and easier to just change without it.
Ensure staticprice is never used if stackprice is present.
Added StackComponent to the test so the behavior matches expectation.
This commit is contained in:
metalgearsloth
2023-03-27 04:01:42 +11:00
committed by GitHub
parent 930d097616
commit a8130f177f
3 changed files with 61 additions and 5 deletions

View File

@@ -149,8 +149,14 @@ public sealed class PricingSystem : EntitySystem
var price = ev.Price;
price += GetMaterialsPrice(prototype);
price += GetSolutionsPrice(prototype);
// Can't use static price with stackprice
var oldPrice = price;
price += GetStackPrice(prototype);
price += GetStaticPrice(prototype);
if (oldPrice.Equals(price))
{
price += GetStaticPrice(prototype);
}
// TODO: Proper container support.
@@ -179,8 +185,15 @@ public sealed class PricingSystem : EntitySystem
// DO NOT FORGET TO UPDATE ESTIMATED PRICING
price += GetMaterialsPrice(uid);
price += GetSolutionsPrice(uid);
// Can't use static price with stackprice
var oldPrice = price;
price += GetStackPrice(uid);
price += GetStaticPrice(uid);
if (oldPrice.Equals(price))
{
price += GetStaticPrice(uid);
}
if (TryComp<ContainerManagerComponent>(uid, out var containers))
{