2021-11-01 17:28:42 +01:00
|
|
|
using Content.Shared.Construction;
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Construction.Completions
|
|
|
|
|
{
|
|
|
|
|
[UsedImplicitly]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class RaiseEvent : IGraphAction
|
2021-11-01 17:28:42 +01:00
|
|
|
{
|
|
|
|
|
[DataField("event", required:true)]
|
2023-08-22 18:14:33 -07:00
|
|
|
public EntityEventArgs? Event { get; private set; }
|
2021-11-01 17:28:42 +01:00
|
|
|
|
|
|
|
|
[DataField("directed")]
|
2023-08-22 18:14:33 -07:00
|
|
|
public bool Directed { get; private set; } = true;
|
2021-11-01 17:28:42 +01:00
|
|
|
|
|
|
|
|
[DataField("broadcast")]
|
2023-08-22 18:14:33 -07:00
|
|
|
public bool Broadcast { get; private set; } = true;
|
2021-11-01 17:28:42 +01:00
|
|
|
|
|
|
|
|
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
|
|
|
|
{
|
|
|
|
|
if (Event == null || !Directed && !Broadcast)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if(Directed)
|
2022-10-30 02:48:53 -04:00
|
|
|
entityManager.EventBus.RaiseLocalEvent(uid, (object)Event);
|
2021-11-01 17:28:42 +01:00
|
|
|
|
|
|
|
|
if(Broadcast)
|
|
|
|
|
entityManager.EventBus.RaiseEvent(EventSource.Local, (object)Event);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|