Mind Swap Fix (#33553)

* Stores owned by mind instead of body

* Requested changes, traitor uplink fixed

* Store, listings fixed and now use Entity<MindComponent>

* Removed duplicate code

* test change

* test change 2

* back to mind entityuid

* MilonPL requested minor changes

* ScarKy0 requested changes
This commit is contained in:
ActiveMammmoth
2025-02-04 11:25:54 -05:00
committed by GitHub
parent 1d5b01190d
commit 6a017ef17b
8 changed files with 32 additions and 22 deletions

View File

@@ -5,6 +5,7 @@ using Content.Shared.FixedPoint;
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;
@@ -19,6 +20,7 @@ public sealed class UplinkSystem : EntitySystem
[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";
@@ -61,8 +63,12 @@ public sealed class UplinkSystem : EntitySystem
/// </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 } },
@@ -70,10 +76,10 @@ public sealed class UplinkSystem : EntitySystem
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);
}