ActionOnInteractComponent.cs 1.3 KB

123456789101112131415161718192021222324252627
  1. using Content.Shared.Interaction;
  2. using Robust.Shared.Prototypes;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
  4. namespace Content.Server.Actions;
  5. /// <summary>
  6. /// This component enables an entity to perform actions when used to interact with the world, without actually
  7. /// granting that action to the entity that is using the item.
  8. /// </summary>
  9. /// <remarks>
  10. /// If the entity is used in hand (<see cref="ActivateInWorldEvent"/>), it will perform a random available instant
  11. /// action. If the entity is used to interact with another entity (<see cref="InteractUsingEvent"/>), it will
  12. /// attempt to perform a random entity target action. Finally, if the entity is used to click somewhere in the world
  13. /// and no other interaction takes place (<see cref="AfterInteractEvent"/>), then it will try to perform a random
  14. /// available entity or world target action. This component does not bypass standard interaction checks.
  15. ///
  16. /// This component mainly exists as a lazy way to add utility entities that can do things like cast "spells".
  17. /// </remarks>
  18. [RegisterComponent]
  19. public sealed partial class ActionOnInteractComponent : Component
  20. {
  21. [DataField(required:true)]
  22. public List<EntProtoId>? Actions;
  23. [DataField] public List<EntityUid>? ActionEntities;
  24. }