Plushies can now have pAIs stuffed into them (v2)! (#30805)

* First commit

* I forgot silly me

* Actually added comments

* spellin

* fixes

* more blacklists

* Minor fixes

* Speech Verb also changes now

* Simple name stuff

* Other fixes

* remove one line of whitespace

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
beck-thompson
2024-10-09 11:01:32 -07:00
committed by GitHub
parent 6d99597349
commit 327466a6e2
12 changed files with 102 additions and 4 deletions

View File

@@ -0,0 +1,30 @@
using Content.Shared.Chat;
using Robust.Shared.Containers;
using Content.Shared.Whitelist;
using Content.Shared.Speech;
namespace Content.Shared.ChangeNameInContainer;
public sealed partial class ChangeNameInContainerSystem : EntitySystem
{
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ChangeVoiceInContainerComponent, TransformSpeakerNameEvent>(OnTransformSpeakerName);
}
private void OnTransformSpeakerName(Entity<ChangeVoiceInContainerComponent> ent, ref TransformSpeakerNameEvent args)
{
if (!_container.TryGetContainingContainer((ent, null, null), out var container)
|| _whitelist.IsWhitelistFail(ent.Comp.Whitelist, container.Owner))
return;
args.VoiceName = Name(container.Owner);
if (TryComp<SpeechComponent>(container.Owner, out var speechComp))
args.SpeechVerb = speechComp.SpeechVerb;
}
}