EntityWorldTargetActionComponent.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Content.Shared.Whitelist;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Serialization;
  4. namespace Content.Shared.Actions;
  5. /// <summary>
  6. /// Used on action entities to define an action that triggers when targeting an entity or entity coordinates.
  7. /// </summary>
  8. [RegisterComponent, NetworkedComponent]
  9. public sealed partial class EntityWorldTargetActionComponent : BaseTargetActionComponent
  10. {
  11. public override BaseActionEvent? BaseEvent => Event;
  12. /// <summary>
  13. /// The local-event to raise when this action is performed.
  14. /// </summary>
  15. [DataField]
  16. [NonSerialized]
  17. public EntityWorldTargetActionEvent? Event;
  18. /// <summary>
  19. /// Determines which entities are valid targets for this action.
  20. /// </summary>
  21. /// <remarks>No whitelist check when null.</remarks>
  22. [DataField] public EntityWhitelist? Whitelist;
  23. /// <summary>
  24. /// Whether this action considers the user as a valid target entity when using this action.
  25. /// </summary>
  26. [DataField] public bool CanTargetSelf = true;
  27. }
  28. [Serializable, NetSerializable]
  29. public sealed class EntityWorldTargetActionComponentState(
  30. EntityWorldTargetActionComponent component,
  31. IEntityManager entManager)
  32. : BaseActionComponentState(component, entManager)
  33. {
  34. public EntityWhitelist? Whitelist = component.Whitelist;
  35. public bool CanTargetSelf = component.CanTargetSelf;
  36. }