using System.Threading; using Content.Shared.Actions.ActionTypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary; namespace Content.Server.Magic; /// /// Spellbooks for having an entity learn spells as long as they've read the book and it's in their hand. /// [RegisterComponent] public sealed class SpellbookComponent : Component { /// /// List of spells that this book has. This is a combination of the WorldSpells, EntitySpells, and InstantSpells. /// [ViewVariables] public readonly List Spells = new(); /// /// The three fields below is just used for initialization. /// [DataField("worldSpells", customTypeSerializer: typeof(PrototypeIdDictionarySerializer))] public readonly Dictionary WorldSpells = new(); [DataField("entitySpells", customTypeSerializer: typeof(PrototypeIdDictionarySerializer))] public readonly Dictionary EntitySpells = new(); [DataField("instantSpells", customTypeSerializer: typeof(PrototypeIdDictionarySerializer))] public readonly Dictionary InstantSpells = new(); [ViewVariables] [DataField("learnTime")] public float LearnTime = .75f; public CancellationTokenSource? CancelToken; }