using Content.Shared.Actions.ActionTypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary; namespace Content.Server.Magic.Components; /// /// 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))] [ViewVariables(VVAccess.ReadWrite)] public readonly Dictionary WorldSpells = new(); [DataField("entitySpells", customTypeSerializer: typeof(PrototypeIdDictionarySerializer))] [ViewVariables(VVAccess.ReadWrite)] public readonly Dictionary EntitySpells = new(); [DataField("instantSpells", customTypeSerializer: typeof(PrototypeIdDictionarySerializer))] [ViewVariables(VVAccess.ReadWrite)] public readonly Dictionary InstantSpells = new(); [DataField("learnTime")] [ViewVariables(VVAccess.ReadWrite)] public float LearnTime = .75f; /// /// If true, the spell action stays even after the book is removed /// [DataField("learnPermanently")] [ViewVariables(VVAccess.ReadWrite)] public bool LearnPermanently; }