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:
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user