public override bool Condition(ListingConditionArgs args)
{
var ent = args.EntityManager;
- var minds = ent.System<SharedMindSystem>();
- if (!minds.TryGetMind(args.Buyer, out var mindId, out var mind))
- return true;
+ if (!ent.HasComponent<MindComponent>(args.Buyer))
+ return true; // inanimate objects don't have minds
var roleSystem = ent.System<SharedRoleSystem>();
- var roles = roleSystem.MindGetAllRoleInfo(mindId);
+ var roles = roleSystem.MindGetAllRoleInfo(args.Buyer);
if (Blacklist != null)
{
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
var ent = args.EntityManager;
- var minds = ent.System<SharedMindSystem>();
- // this is for things like surplus crate
- if (!minds.TryGetMind(args.Buyer, out var mindId, out _))
- return true;
+ if (!ent.TryGetComponent<MindComponent>(args.Buyer, out var _))
+ return true; // inanimate objects don't have minds
var jobs = ent.System<SharedJobSystem>();
- jobs.MindTryGetJob(mindId, out var job);
+ jobs.MindTryGetJob(args.Buyer, out var job);
if (Blacklist != null && job != null)
{
public override bool Condition(ListingConditionArgs args)
{
var ent = args.EntityManager;
- var minds = ent.System<SharedMindSystem>();
- // this is for things like surplus crate
- if (!minds.TryGetMind(args.Buyer, out var mindId, out _))
- return true;
+ if (!ent.TryGetComponent<MindComponent>(args.Buyer, out var _))
+ return true; // inanimate objects don't have minds
var jobs = ent.System<SharedJobSystem>();
- jobs.MindTryGetJob(mindId, out var job);
+ jobs.MindTryGetJob(args.Buyer, out var job);
if (Blacklist != null)
{
using Content.Shared.Store;
using Content.Shared.Humanoid.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
+using Content.Shared.Mind;
namespace Content.Server.Store.Conditions;
{
var ent = args.EntityManager;
- if (!ent.TryGetComponent<HumanoidAppearanceComponent>(args.Buyer, out var appearance))
+ if (!ent.TryGetComponent<MindComponent>(args.Buyer, out var mind))
+ return true; // needed to obtain body entityuid to check for humanoid appearance
+
+ if (!ent.TryGetComponent<HumanoidAppearanceComponent>(mind.OwnedEntity, out var appearance))
return true; // inanimate or non-humanoid entities should be handled elsewhere, main example being surplus crates
if (Blacklist != null)
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using System.Linq;
+using Content.Shared.Mind;
namespace Content.Server.Store.Systems;
if (!component.OwnerOnly)
return;
- component.AccountOwner ??= args.User;
+ if (!_mind.TryGetMind(args.User, out var mind, out _))
+ return;
+
+ component.AccountOwner ??= mind;
DebugTools.Assert(component.AccountOwner != null);
- if (component.AccountOwner == args.User)
+ if (component.AccountOwner == mind)
return;
_popup.PopupEntity(Loc.GetString("store-not-account-owner", ("store", uid)), uid, args.User);
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Implants;
using Content.Shared.Inventory;
+using Content.Shared.Mind;
using Content.Shared.PDA;
using Content.Shared.Store;
using Content.Shared.Store.Components;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly StoreSystem _store = default!;
[Dependency] private readonly SharedSubdermalImplantSystem _subdermalImplant = default!;
+ [Dependency] private readonly SharedMindSystem _mind = default!;
[ValidatePrototypeId<CurrencyPrototype>]
public const string TelecrystalCurrencyPrototype = "Telecrystal";
/// </summary>
private void SetUplink(EntityUid user, EntityUid uplink, FixedPoint2 balance, bool giveDiscounts)
{
+ if (!_mind.TryGetMind(user, out var mind, out _))
+ return;
+
var store = EnsureComp<StoreComponent>(uplink);
- store.AccountOwner = user;
+
+ store.AccountOwner = mind;
store.Balance.Clear();
_store.TryAddCurrency(new Dictionary<string, FixedPoint2> { { TelecrystalCurrencyPrototype, balance } },
store);
var uplinkInitializedEvent = new StoreInitializedEvent(
- TargetUser: user,
+ TargetUser: mind,
Store: uplink,
UseDiscounts: giveDiscounts,
- Listings: _store.GetAvailableListings(user, uplink, store)
+ Listings: _store.GetAvailableListings(mind, uplink, store)
.ToArray());
RaiseLocalEvent(ref uplinkInitializedEvent);
}
public HashSet<ProtoId<CurrencyPrototype>> CurrencyWhitelist = new();
/// <summary>
- /// The person who "owns" the store/account. Used if you want the listings to be fixed
+ /// The person/mind who "owns" the store/account. Used if you want the listings to be fixed
/// regardless of who activated it. I.E. role specific items for uplinks.
/// </summary>
- [ViewVariables(VVAccess.ReadWrite)]
+ [DataField]
public EntityUid? AccountOwner = null;
/// <summary>
whitelist:
components:
- Body
+ - MindContainer
canTargetSelf: false
interactOnMiss: false
sound: !type:SoundPathSpecifier