From 2f3b6fb28e91b17a2b352f5ece3681c6bf13093d Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Sat, 8 Jan 2022 00:57:20 +1300 Subject: [PATCH] Fix some action-blocker bugs (#6050) --- Content.Shared/Emoting/EmoteSystem.cs | 8 ++++---- Content.Shared/PAI/SharedPAISystem.cs | 19 ++++++++++++++++--- Content.Shared/Speech/SpeechSystem.cs | 6 +++--- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Content.Shared/Emoting/EmoteSystem.cs b/Content.Shared/Emoting/EmoteSystem.cs index 1aee5508eb..ebb18d4657 100644 --- a/Content.Shared/Emoting/EmoteSystem.cs +++ b/Content.Shared/Emoting/EmoteSystem.cs @@ -8,13 +8,13 @@ namespace Content.Shared.Emoting { base.Initialize(); - SubscribeLocalEvent(OnEmoteAttempt); + SubscribeLocalEvent(OnEmoteAttempt); } - private void OnEmoteAttempt(EntityUid entity, SharedEmotingComponent component, EmoteAttemptEvent ev) + private void OnEmoteAttempt(EmoteAttemptEvent args) { - if (!component.Enabled) - ev.Cancel(); + if (!TryComp(args.Uid, out SharedEmotingComponent? emote) || !emote.Enabled) + args.Cancel(); } } } diff --git a/Content.Shared/PAI/SharedPAISystem.cs b/Content.Shared/PAI/SharedPAISystem.cs index 2d7d2f7ee0..16880900f6 100644 --- a/Content.Shared/PAI/SharedPAISystem.cs +++ b/Content.Shared/PAI/SharedPAISystem.cs @@ -1,12 +1,10 @@ using System; using Content.Shared.DragDrop; -using Content.Shared.Emoting; using Content.Shared.Interaction.Events; using Content.Shared.Item; +using Content.Shared.Movement; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; -using Robust.Shared.Serialization.Manager.Attributes; -using Robust.Shared.ViewVariables; namespace Content.Shared.PAI { @@ -29,6 +27,21 @@ namespace Content.Shared.PAI SubscribeLocalEvent(OnAttackAttempt); SubscribeLocalEvent(OnDropAttempt); SubscribeLocalEvent(OnPickupAttempt); + SubscribeLocalEvent(OnMoveAttempt); + SubscribeLocalEvent(OnChangeDirectionAttempt); + } + + private void OnMoveAttempt(EntityUid uid, PAIComponent component, MovementAttemptEvent args) + { + args.Cancel(); // no more scurrying around on lil robot legs. + } + + private void OnChangeDirectionAttempt(EntityUid uid, PAIComponent component, ChangeDirectionAttemptEvent args) + { + // PAIs can't rotate, but decapitated heads and sentient crowbars can, life isn't fair. Seriously though, why + // tf does this have to be actively blocked, surely this should just not be blanket enabled for any player + // controlled entity. Same goes for moving really. + args.Cancel(); } private void OnUseAttempt(EntityUid uid, PAIComponent component, UseAttemptEvent args) diff --git a/Content.Shared/Speech/SpeechSystem.cs b/Content.Shared/Speech/SpeechSystem.cs index e7bb379d59..680959e562 100644 --- a/Content.Shared/Speech/SpeechSystem.cs +++ b/Content.Shared/Speech/SpeechSystem.cs @@ -8,12 +8,12 @@ namespace Content.Shared.Speech { base.Initialize(); - SubscribeLocalEvent(OnSpeakAttempt); + SubscribeLocalEvent(OnSpeakAttempt); } - private void OnSpeakAttempt(EntityUid uid, SharedSpeechComponent component, SpeakAttemptEvent args) + private void OnSpeakAttempt(SpeakAttemptEvent args) { - if (!component.Enabled) + if (!TryComp(args.Uid, out SharedSpeechComponent? speech) || !speech.Enabled) args.Cancel(); } }