fix: restore pai shop action handling (#4651)

* fix: restore pai shop action handling
This commit is contained in:
DisposableCrewmember42 2025-11-14 21:20:06 +00:00 committed by GitHub
parent a41c134753
commit 6b65d3bb15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 5 deletions

View File

@ -1,15 +1,18 @@
using Content.Server.Ghost.Roles;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Instruments;
using Content.Shared.Kitchen.Components;
using Content.Shared.Kitchen.Components; // DeltaV - shared
using Content.Server.Store.Systems;
using Content.Shared.Interaction.Events;
using Content.Shared.Mind.Components;
using Content.Shared.PAI;
using Content.Shared.Popups;
using Robust.Shared.Random;
using System.Text;
using Content.Shared.Store;
using Content.Shared.Store.Components;
using Content.Shared.Instruments;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Prototypes;
using System.Text;
namespace Content.Server.PAI;
@ -19,12 +22,13 @@ public sealed class PAISystem : SharedPAISystem
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly StoreSystem _store = default!;
[Dependency] private readonly ToggleableGhostRoleSystem _toggleableGhostRole = default!;
/// <summary>
/// Possible symbols that can be part of a scrambled pai's name.
/// </summary>
private static readonly char[] SYMBOLS = new[] { '#', '~', '-', '@', '&', '^', '%', '$', '*', ' '};
private static readonly char[] SYMBOLS = new[] { '#', '~', '-', '@', '&', '^', '%', '$', '*', ' ' };
public override void Initialize()
{
@ -34,6 +38,8 @@ public sealed class PAISystem : SharedPAISystem
SubscribeLocalEvent<PAIComponent, MindAddedMessage>(OnMindAdded);
SubscribeLocalEvent<PAIComponent, MindRemovedMessage>(OnMindRemoved);
SubscribeLocalEvent<PAIComponent, BeingMicrowavedEvent>(OnMicrowaved);
SubscribeLocalEvent<PAIComponent, PAIShopActionEvent>(OnShop);
}
private void OnUseInHand(EntityUid uid, PAIComponent component, UseInHandEvent args)
@ -101,6 +107,14 @@ public sealed class PAISystem : SharedPAISystem
_metaData.SetEntityName(uid, val);
}
private void OnShop(Entity<PAIComponent> ent, ref PAIShopActionEvent args)
{
if (!TryComp<StoreComponent>(ent, out var store))
return;
_store.ToggleUi(args.Performer, ent, store);
}
public void PAITurningOff(EntityUid uid)
{
// Close the instrument interface if it was open