SpellbookComponent.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using Robust.Shared.Prototypes;
  2. namespace Content.Shared.Magic.Components;
  3. /// <summary>
  4. /// Spellbooks can grant one or more spells to the user. If marked as <see cref="LearnPermanently"/> it will teach
  5. /// the performer the spells and wipe the book.
  6. /// Default behavior requires the book to be held in hand
  7. /// </summary>
  8. [RegisterComponent, Access(typeof(SpellbookSystem))]
  9. public sealed partial class SpellbookComponent : Component
  10. {
  11. /// <summary>
  12. /// List of spells that this book has. This is a combination of the WorldSpells, EntitySpells, and InstantSpells.
  13. /// </summary>
  14. [ViewVariables]
  15. public readonly List<EntityUid> Spells = new();
  16. /// <summary>
  17. /// The three fields below is just used for initialization.
  18. /// </summary>
  19. [DataField]
  20. [ViewVariables(VVAccess.ReadWrite)]
  21. public Dictionary<EntProtoId, int> SpellActions = new();
  22. [DataField]
  23. [ViewVariables(VVAccess.ReadWrite)]
  24. public float LearnTime = .75f;
  25. /// <summary>
  26. /// If true, the spell action stays even after the book is removed
  27. /// </summary>
  28. [DataField]
  29. [ViewVariables(VVAccess.ReadWrite)]
  30. public bool LearnPermanently;
  31. }