diff --git a/Content.Server/Store/Systems/StoreSystem.Listings.cs b/Content.Server/Store/Systems/StoreSystem.Listings.cs
index 4699ec7b66..412114ce03 100644
--- a/Content.Server/Store/Systems/StoreSystem.Listings.cs
+++ b/Content.Server/Store/Systems/StoreSystem.Listings.cs
@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
+using Content.Shared.Mind;
using Content.Shared.Store;
using Content.Shared.Store.Components;
using Robust.Shared.Prototypes;
@@ -117,7 +118,7 @@ public sealed partial class StoreSystem
if (listing.Conditions != null)
{
- var args = new ListingConditionArgs(buyer, storeEntity, listing, EntityManager);
+ var args = new ListingConditionArgs(GetBuyerMind(buyer), storeEntity, listing, EntityManager);
var conditionsMet = true;
foreach (var condition in listing.Conditions)
@@ -137,6 +138,19 @@ public sealed partial class StoreSystem
}
}
+ ///
+ /// Returns the entity's mind entity, if it has one, to be used for listing conditions.
+ /// If it doesn't have one, or is a mind entity already, it returns itself.
+ ///
+ /// The buying entity.
+ public EntityUid GetBuyerMind(EntityUid buyer)
+ {
+ if (!HasComp(buyer) && _mind.TryGetMind(buyer, out var buyerMind, out var _))
+ return buyerMind;
+
+ return buyer;
+ }
+
///
/// Checks if a listing appears in a list of given categories
///
diff --git a/Content.Server/Store/Systems/StoreSystem.Ui.cs b/Content.Server/Store/Systems/StoreSystem.Ui.cs
index 3f4ccf696d..93bbd3bd96 100644
--- a/Content.Server/Store/Systems/StoreSystem.Ui.cs
+++ b/Content.Server/Store/Systems/StoreSystem.Ui.cs
@@ -146,7 +146,7 @@ public sealed partial class StoreSystem
//condition checking because why not
if (listing.Conditions != null)
{
- var args = new ListingConditionArgs(component.AccountOwner ?? buyer, uid, listing, EntityManager);
+ var args = new ListingConditionArgs(component.AccountOwner ?? GetBuyerMind(buyer), uid, listing, EntityManager);
var conditionsMet = listing.Conditions.All(condition => condition.Condition(args));
if (!conditionsMet)