2023-09-08 18:16:05 -07:00
|
|
|
|
using Robust.Shared.Prototypes;
|
2022-05-29 02:29:10 -04:00
|
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
|
|
|
|
|
|
2023-05-01 04:29:18 -04:00
|
|
|
|
namespace Content.Server.Magic.Components;
|
2022-05-29 02:29:10 -04:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Spellbooks for having an entity learn spells as long as they've read the book and it's in their hand.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[RegisterComponent]
|
2023-08-22 18:14:33 -07:00
|
|
|
|
public sealed partial class SpellbookComponent : Component
|
2022-05-29 02:29:10 -04:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// List of spells that this book has. This is a combination of the WorldSpells, EntitySpells, and InstantSpells.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[ViewVariables]
|
2023-09-08 18:16:05 -07:00
|
|
|
|
public readonly List<EntityUid> Spells = new();
|
2022-05-29 02:29:10 -04:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The three fields below is just used for initialization.
|
|
|
|
|
|
/// </summary>
|
2023-09-08 18:16:05 -07:00
|
|
|
|
[DataField("spells", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<int, EntityPrototype>))]
|
2023-05-01 04:29:18 -04:00
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2023-09-08 18:16:05 -07:00
|
|
|
|
public Dictionary<string, int> SpellActions = new();
|
2022-05-29 02:29:10 -04:00
|
|
|
|
|
|
|
|
|
|
[DataField("learnTime")]
|
2023-05-01 04:29:18 -04:00
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2022-05-29 02:29:10 -04:00
|
|
|
|
public float LearnTime = .75f;
|
2023-05-01 04:29:18 -04:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// If true, the spell action stays even after the book is removed
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[DataField("learnPermanently")]
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
|
public bool LearnPermanently;
|
2022-05-29 02:29:10 -04:00
|
|
|
|
}
|