Fix some action-blocker bugs (#6050)
This commit is contained in:
@@ -8,13 +8,13 @@ namespace Content.Shared.Emoting
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SharedEmotingComponent, EmoteAttemptEvent>(OnEmoteAttempt);
|
||||
SubscribeLocalEvent<EmoteAttemptEvent>(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<PAIComponent, AttackAttemptEvent>(OnAttackAttempt);
|
||||
SubscribeLocalEvent<PAIComponent, DropAttemptEvent>(OnDropAttempt);
|
||||
SubscribeLocalEvent<PAIComponent, PickupAttemptEvent>(OnPickupAttempt);
|
||||
SubscribeLocalEvent<PAIComponent, MovementAttemptEvent>(OnMoveAttempt);
|
||||
SubscribeLocalEvent<PAIComponent, ChangeDirectionAttemptEvent>(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)
|
||||
|
||||
@@ -8,12 +8,12 @@ namespace Content.Shared.Speech
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SharedSpeechComponent, SpeakAttemptEvent>(OnSpeakAttempt);
|
||||
SubscribeLocalEvent<SpeakAttemptEvent>(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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user