From a720f885bec39811ecbd715e1249ea41474134a4 Mon Sep 17 00:00:00 2001 From: SimpleStation14 Date: Fri, 3 May 2024 11:55:45 -0400 Subject: [PATCH] Cherry-picked commit 4dced51f0d8d008714a14675b48c8fa2b7fa0ace from space-wizards/space-station-14/master --- Content.Server/Store/Systems/StoreSystem.Ui.cs | 6 ++++-- Content.Shared/Store/ListingPrototype.cs | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Content.Server/Store/Systems/StoreSystem.Ui.cs b/Content.Server/Store/Systems/StoreSystem.Ui.cs index a7490fd27ff..e60e11d9d16 100644 --- a/Content.Server/Store/Systems/StoreSystem.Ui.cs +++ b/Content.Server/Store/Systems/StoreSystem.Ui.cs @@ -250,10 +250,12 @@ private void OnBuyRequest(EntityUid uid, StoreComponent component, StoreBuyListi HandleRefundComp(uid, component, upgradeActionId.Value); } - //broadcast event if (listing.ProductEvent != null) { - RaiseLocalEvent(listing.ProductEvent); + if (!listing.RaiseProductEventOnUser) + RaiseLocalEvent(listing.ProductEvent); + else + RaiseLocalEvent(buyer, listing.ProductEvent); } //log dat shit. diff --git a/Content.Shared/Store/ListingPrototype.cs b/Content.Shared/Store/ListingPrototype.cs index 2f067afbeeb..25245327ce9 100644 --- a/Content.Shared/Store/ListingPrototype.cs +++ b/Content.Shared/Store/ListingPrototype.cs @@ -98,6 +98,9 @@ public partial class ListingData : IEquatable, ICloneable [DataField("productEvent")] public object? ProductEvent; + [DataField] + public bool RaiseProductEventOnUser; + /// /// used internally for tracking how many times an item was purchased. /// @@ -120,7 +123,7 @@ public bool Equals(ListingData? listing) Description != listing.Description || ProductEntity != listing.ProductEntity || ProductAction != listing.ProductAction || - ProductEvent != listing.ProductEvent || + ProductEvent?.GetType() != listing.ProductEvent?.GetType() || RestockTime != listing.RestockTime) return false;