fix discount

This commit is contained in:
Spatison
2025-02-28 18:43:49 +03:00
parent d1f656661b
commit edb7da67be
2 changed files with 1 additions and 10 deletions

View File

@@ -82,14 +82,6 @@ public sealed class StoreTests
var storeComponent = entManager.GetComponent<StoreComponent>(pda);
var discountComponent = entManager.GetComponent<StoreDiscountComponent>(pda);
Assert.That(
discountComponent.Discounts,
Has.Exactly(6).Items,
$"After applying discount total discounted items count was expected to be '6' "
+ $"but was actually {discountComponent.Discounts.Count}- this can be due to discount "
+ $"categories settings (maxItems, weight) not being realistically set, or default "
+ $"discounted count being changed from '6' in StoreDiscountSystem.InitializeDiscounts."
);
var discountedListingItems = storeComponent.FullListingsCatalog
.Where(x => x.IsCostModified)
.OrderBy(x => x.ID)

View File

@@ -75,8 +75,7 @@ public sealed class StoreDiscountSystem : EntitySystem
// WD EDIT START
private void OnMapInit(EntityUid uid, StoreDiscountComponent component, MapInitEvent args)
{
if (!TryComp<StoreComponent>(uid, out var store))
if (!TryComp<StoreComponent>(uid, out var store) || component.Discounts.Count != 0)
return;
var uplinkInitializedEvent = new StoreInitializedEvent(