From: keronshb <54602815+keronshb@users.noreply.github.com> Date: Sun, 24 Mar 2024 18:07:05 +0000 (-0400) Subject: Fixes store purchase events and adds support to raise a directed event (#26389) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=4dced51f0d8d008714a14675b48c8fa2b7fa0ace;p=space-station-14.git Fixes store purchase events and adds support to raise a directed event (#26389) * fixes store event check * raise directed product event --- diff --git a/Content.Server/Store/Systems/StoreSystem.Ui.cs b/Content.Server/Store/Systems/StoreSystem.Ui.cs index 7cdbc4e41c..49db980451 100644 --- a/Content.Server/Store/Systems/StoreSystem.Ui.cs +++ b/Content.Server/Store/Systems/StoreSystem.Ui.cs @@ -249,10 +249,12 @@ public sealed partial class StoreSystem 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 2f067afbee..25245327ce 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 partial class ListingData : IEquatable, ICloneable Description != listing.Description || ProductEntity != listing.ProductEntity || ProductAction != listing.ProductAction || - ProductEvent != listing.ProductEvent || + ProductEvent?.GetType() != listing.ProductEvent?.GetType() || RestockTime != listing.RestockTime) return false;