Skip to content

Commit

Permalink
Requested changes, traitor uplink fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ActiveMammmoth committed Nov 23, 2024
1 parent dfb72ab commit 2ceac67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Content.Server/Store/Systems/StoreSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ private void OnStoreOpenAttempt(EntityUid uid, StoreComponent component, Activat
if (!component.OwnerOnly)
return;

_mind.TryGetMind(args.User, out var mind, out var mindComp);
if (!_mind.TryGetMind(args.User, out var mind, out var mindComp))
mind = args.User;

component.AccountOwner ??= mind;
DebugTools.Assert(component.AccountOwner != null);
Expand Down
11 changes: 8 additions & 3 deletions Content.Server/Traitor/Uplink/UplinkSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
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;
Expand All @@ -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";
Expand Down Expand Up @@ -61,19 +63,22 @@ public bool AddUplink(
/// </summary>
private void SetUplink(EntityUid user, EntityUid uplink, FixedPoint2 balance, bool giveDiscounts)
{
if (!_mind.TryGetMind(user, out var mind, out var mindComp))
mind = user;

var store = EnsureComp<StoreComponent>(uplink);
store.AccountOwner = user;
store.AccountOwner = mind;

store.Balance.Clear();
_store.TryAddCurrency(new Dictionary<string, FixedPoint2> { { TelecrystalCurrencyPrototype, balance } },
uplink,
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);
}
Expand Down

0 comments on commit 2ceac67

Please sign in to comment.