Clean up StoreSystem (#14027)

This commit is contained in:
Nemanja
2023-02-12 07:39:14 -05:00
committed by GitHub
parent e7b18b33aa
commit 351c53e774
9 changed files with 108 additions and 101 deletions

View File

@@ -3,7 +3,7 @@ using Content.Shared.Store;
namespace Content.Server.Store.Systems;
public sealed partial class StoreSystem : EntitySystem
public sealed partial class StoreSystem
{
/// <summary>
/// Refreshes all listings on a store.
@@ -64,11 +64,12 @@ public sealed partial class StoreSystem : EntitySystem
/// Gets the available listings for a store
/// </summary>
/// <param name="buyer">Either the account owner, user, or an inanimate object (e.g., surplus bundle)</param>
/// <param name="store"></param>
/// <param name="component">The store the listings are coming from.</param>
/// <returns>The available listings.</returns>
public IEnumerable<ListingData> GetAvailableListings(EntityUid buyer, StoreComponent component)
public IEnumerable<ListingData> GetAvailableListings(EntityUid buyer, EntityUid store, StoreComponent component)
{
return GetAvailableListings(buyer, component.Listings, component.Categories, component.Owner);
return GetAvailableListings(buyer, component.Listings, component.Categories, store);
}
/// <summary>
@@ -81,8 +82,7 @@ public sealed partial class StoreSystem : EntitySystem
/// <returns>The available listings.</returns>
public IEnumerable<ListingData> GetAvailableListings(EntityUid buyer, HashSet<ListingData>? listings, HashSet<string> categories, EntityUid? storeEntity = null)
{
if (listings == null)
listings = GetAllListings();
listings ??= GetAllListings();
foreach (var listing in listings)
{