mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-16 21:17:39 +03:00
fix discount
This commit is contained in:
@@ -20,6 +20,7 @@ public sealed class StoreDiscountSystem : EntitySystem
|
||||
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly StoreSystem _store = default!; // WD EDIT
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize()
|
||||
@@ -75,14 +76,15 @@ public sealed class StoreDiscountSystem : EntitySystem
|
||||
// WD EDIT START
|
||||
private void OnMapInit(EntityUid uid, StoreDiscountComponent component, MapInitEvent args)
|
||||
{
|
||||
if (!TryComp<StoreComponent>(uid, out var store) || component.Discounts.Count != 0)
|
||||
if (!TryComp<StoreComponent>(uid, out var store) || !component.OnSpawn)
|
||||
return;
|
||||
|
||||
var uplinkInitializedEvent = new StoreInitializedEvent(
|
||||
TargetUser: uid,
|
||||
Store: uid,
|
||||
UseDiscounts: true,
|
||||
Listings: store.FullListingsCatalog.ToArray());
|
||||
Listings: _store.GetAvailableListings(uid, uid, store)
|
||||
.ToArray());
|
||||
RaiseLocalEvent(ref uplinkInitializedEvent);
|
||||
}
|
||||
// WD EDIT END
|
||||
|
||||
@@ -24,6 +24,9 @@ public sealed partial class StoreDiscountComponent : Component
|
||||
|
||||
[DataField]
|
||||
public int MaxItems = 8;
|
||||
|
||||
[DataField]
|
||||
public bool OnSpawn;
|
||||
// WD EDIT END
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
Telecrystal: 0
|
||||
# WD EDIT START
|
||||
- type: StoreDiscount
|
||||
onSpawn: true
|
||||
- type: GiftIgnore
|
||||
# WD EDIT END
|
||||
|
||||
|
||||
Reference in New Issue
Block a user