mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* PopupClient to PopupEntity/Coordinates * PopupPredictedX to PopupEntity/Cursor/Coordinates * The rest of the damn owl * nullability fixes * Buckle cleanup * cleanup, address PR comments * ExecutionSystem: one popup method * correct my filthy lies * Apply most of ajcm's suggestions * return user to SharedItemRecallSystem.cs * Fix lingering Ensnarable broadcast popups * targeted drain popups * fix lingering untargeted Guardian popups I read the comment on GuardianHostRecall. Oops. * target stethoscope popups * fix the PDA vibration popup * Fix target for encryption key removal popup * anomaly scanner: args.User, not uid * disposal unit comment, bcast pda vibration popup
48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
using Content.Shared.Administration.Managers;
|
|
using Content.Shared.Animals.Components;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Verbs;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Shared.Animals.Systems;
|
|
|
|
public abstract partial class SharedParrotMemorySystem : EntitySystem
|
|
{
|
|
[Dependency] private SharedPopupSystem _popup = default!;
|
|
[Dependency] private ISharedAdminManager _admin = default!;
|
|
[Dependency] private INetManager _net = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<ParrotMemoryComponent, GetVerbsEvent<Verb>>(OnGetVerbs);
|
|
}
|
|
|
|
private void OnGetVerbs(Entity<ParrotMemoryComponent> entity, ref GetVerbsEvent<Verb> args)
|
|
{
|
|
var user = args.User;
|
|
|
|
// limit this to admins
|
|
if (!_admin.IsAdmin(user))
|
|
return;
|
|
|
|
// simple verb that just clears the memory list
|
|
var clearMemoryVerb = new Verb()
|
|
{
|
|
Text = Loc.GetString("parrot-verb-clear-memory"),
|
|
Category = VerbCategory.Admin,
|
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/clear-parrot.png")),
|
|
Act = () =>
|
|
{
|
|
_popup.PopupEntity(Loc.GetString("parrot-popup-memory-cleared"), entity.Owner, user);
|
|
|
|
if (_net.IsServer)
|
|
entity.Comp.SpeechMemories.Clear();
|
|
},
|
|
};
|
|
|
|
args.Verbs.Add(clearMemoryVerb);
|
|
}
|
|
}
|