parrotMemory is onGetVerbs now in shared (#39341)
* parrotMemory is onGetVerbs now in shared * code review * code review popup on client rename parrotMemoryComponent * code rev create client system * forgot usings * is server now
This commit is contained in:
@@ -8,10 +8,10 @@ using Content.Server.Radio;
|
||||
using Content.Server.Speech;
|
||||
using Content.Server.Speech.Components;
|
||||
using Content.Server.Vocalization.Systems;
|
||||
using Content.Shared.Animals.Components;
|
||||
using Content.Shared.Animals.Systems;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Random;
|
||||
@@ -25,7 +25,7 @@ namespace Content.Server.Animals.Systems;
|
||||
/// (radiovocalizer) and stores them in a list. When an entity with a VocalizerComponent attempts to vocalize, this will
|
||||
/// try to set the message from memory.
|
||||
/// </summary>
|
||||
public sealed partial class ParrotMemorySystem : EntitySystem
|
||||
public sealed partial class ParrotMemorySystem : SharedParrotMemorySystem
|
||||
{
|
||||
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
@@ -42,8 +42,6 @@ public sealed partial class ParrotMemorySystem : EntitySystem
|
||||
|
||||
SubscribeLocalEvent<EraseEvent>(OnErase);
|
||||
|
||||
SubscribeLocalEvent<ParrotMemoryComponent, GetVerbsEvent<Verb>>(OnGetVerbs);
|
||||
|
||||
SubscribeLocalEvent<ParrotListenerComponent, MapInitEvent>(ListenerOnMapInit);
|
||||
|
||||
SubscribeLocalEvent<ParrotListenerComponent, ListenEvent>(OnListen);
|
||||
@@ -57,30 +55,6 @@ public sealed partial class ParrotMemorySystem : EntitySystem
|
||||
DeletePlayerMessages(args.PlayerNetUserId);
|
||||
}
|
||||
|
||||
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 = () =>
|
||||
{
|
||||
entity.Comp.SpeechMemories.Clear();
|
||||
_popup.PopupEntity(Loc.GetString("parrot-popup-memory-cleared"), entity, user, PopupType.Medium);
|
||||
},
|
||||
};
|
||||
|
||||
args.Verbs.Add(clearMemoryVerb);
|
||||
}
|
||||
|
||||
private void ListenerOnMapInit(Entity<ParrotListenerComponent> entity, ref MapInitEvent args)
|
||||
{
|
||||
// If an entity has a ParrotListenerComponent it really ought to have an ActiveListenerComponent
|
||||
|
||||
Reference in New Issue
Block a user