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