]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fixes store purchase events and adds support to raise a directed event (#26389)
authorkeronshb <54602815+keronshb@users.noreply.github.com>
Sun, 24 Mar 2024 18:07:05 +0000 (14:07 -0400)
committerGitHub <noreply@github.com>
Sun, 24 Mar 2024 18:07:05 +0000 (19:07 +0100)
* fixes store event check

* raise directed product event

Content.Server/Store/Systems/StoreSystem.Ui.cs
Content.Shared/Store/ListingPrototype.cs

index 7cdbc4e41c3d3b8b6fa84ac354ea9c842c1f839f..49db980451ea6b30a967074f90ce8c18f5df5a89 100644 (file)
@@ -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.
index 2f067afbeeba11249cd10e5bb95ae6a1f0bcd41e..25245327ce9c7fcc1663ea48edad77e884a5ec2e 100644 (file)
@@ -98,6 +98,9 @@ public partial class ListingData : IEquatable<ListingData>, ICloneable
     [DataField("productEvent")]
     public object? ProductEvent;
 
+    [DataField]
+    public bool RaiseProductEventOnUser;
+
     /// <summary>
     /// used internally for tracking how many times an item was purchased.
     /// </summary>
@@ -120,7 +123,7 @@ public partial class ListingData : IEquatable<ListingData>, ICloneable
             Description != listing.Description ||
             ProductEntity != listing.ProductEntity ||
             ProductAction != listing.ProductAction ||
-            ProductEvent != listing.ProductEvent ||
+            ProductEvent?.GetType() != listing.ProductEvent?.GetType() ||
             RestockTime != listing.RestockTime)
             return false;