Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mirror: Fixes store purchase events and adds support to raise a directed event #364

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Content.Server/Store/Systems/StoreSystem.Ui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion Content.Shared/Store/ListingPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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;

Expand Down
Loading