ActionBlocker CanSpeak uses EntityUid exclusively
This commit is contained in:
parent
c68c3219f8
commit
190612a350
|
|
@ -41,7 +41,7 @@ namespace Content.Server.Actions.Actions
|
|||
|
||||
public void DoInstantAction(InstantActionEventArgs args)
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanSpeak(args.Performer)) return;
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanSpeak(args.Performer.Uid)) return;
|
||||
if (!args.Performer.TryGetComponent<HumanoidAppearanceComponent>(out var humanoid)) return;
|
||||
if (!args.Performer.TryGetComponent<SharedActionsComponent>(out var actions)) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ namespace Content.Server.Chat.Managers
|
|||
|
||||
public void EntitySay(IEntity source, string message)
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanSpeak(source))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanSpeak(source.Uid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,18 +60,13 @@ namespace Content.Shared.ActionBlocker
|
|||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public bool CanSpeak(IEntity entity)
|
||||
{
|
||||
var ev = new SpeakAttemptEvent(entity);
|
||||
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public bool CanSpeak(EntityUid uid)
|
||||
{
|
||||
return CanSpeak(EntityManager.GetEntity(uid));
|
||||
var ev = new SpeakAttemptEvent(uid);
|
||||
|
||||
RaiseLocalEvent(uid, ev);
|
||||
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public bool CanDrop(IEntity entity)
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ namespace Content.Shared.Speech
|
|||
{
|
||||
public class SpeakAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public SpeakAttemptEvent(IEntity entity)
|
||||
public SpeakAttemptEvent(EntityUid uid)
|
||||
{
|
||||
Entity = entity;
|
||||
Uid = uid;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
public EntityUid Uid { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue