ChangeComponentSpellEvent.cs 828 B

123456789101112131415161718192021222324252627
  1. using Content.Shared.Actions;
  2. using Robust.Shared.Prototypes;
  3. namespace Content.Shared.Magic.Events;
  4. /// <summary>
  5. /// Spell that uses the magic of ECS to add & remove components. Components are first removed, then added.
  6. /// </summary>
  7. public sealed partial class ChangeComponentsSpellEvent : EntityTargetActionEvent, ISpeakSpell
  8. {
  9. // TODO allow it to set component data-fields?
  10. // for now a Hackish way to do that is to remove & add, but that doesn't allow you to selectively set specific data fields.
  11. [DataField]
  12. [AlwaysPushInheritance]
  13. public ComponentRegistry ToAdd = new();
  14. [DataField]
  15. [AlwaysPushInheritance]
  16. public HashSet<string> ToRemove = new();
  17. [DataField]
  18. public string? Speech { get; private set; }
  19. [DataField]
  20. public bool DoSpeech { get; private set; }
  21. }