using Content.Shared.DoAfter; using Robust.Shared.Prototypes; namespace Content.Shared._DV.Psionics.Components.PsionicPowers; /// /// Entities with this component are psionically insulated from a source. /// public abstract partial class BasePsionicPowerComponent : Component { /// /// The actual UID for the action entity. It'll be saved here when the component is initialized. /// [DataField, AutoNetworkedField] public EntityUid? ActionEntity; /// /// The prototype ID for the action. /// It's set up in the component, optionally overriden via YML and then referenced via a string here. /// [DataField] public abstract EntProtoId ActionProtoId { get; set; } /// /// The Loc string for the name of the power. /// [DataField] public abstract string PowerName { get; set; } /// /// The minimum glimmer amount that will be changed upon use of the psionic power. /// Should be lower than . /// [DataField] public abstract int MinGlimmerChanged { get; set; } /// /// The maximum glimmer amount that will be changed upon use of the psionic power. /// Should be higher than . /// [DataField] public abstract int MaxGlimmerChanged { get; set; } /// /// Whether this ability can be removed via mindbreaking. /// /// Revenants shouldn't be able to lose their powers. [DataField] public bool CanBeRemoved = true; /// /// When a power uses a DoAfter, the ID can be saved here for convenience. /// It'll handle being dispelled automatically. /// It'll need to be broken up into the DoAfter EntityUid and ushort index first. /// [DataField, AutoNetworkedField] public EntityUid? DoAfterEntityId; /// /// When a power uses a DoAfter, the index can be saved here for convenience. /// It'll handle being dispelled automatically. /// It'll need to be broken up into the DoAfter EntityUid and ushort index first. /// [DataField, AutoNetworkedField] public ushort? DoAfterIdIndex; /// /// Helper method to save a DoAfterId as DoAfterIds are not serializable and therefore cannot be networked. /// It's parts can be though, and can be rebuilt. /// /// The DoAfterId to save. If null, it'll remove the saved DoAfterId. public void SaveDoAfterId(DoAfterId doAfterId) { DoAfterEntityId = doAfterId.Uid; DoAfterIdIndex = doAfterId.Index; } /// /// Helper method to remove the saved DoAfterId. /// public void RemoveSavedDoAfterId() { DoAfterEntityId = null; DoAfterIdIndex = null; } /// /// A helper method to get a saved DoAfterId. /// /// Returns a DoAfterId if one is present, null if not. public DoAfterId? GetDoAfterId() { if (DoAfterEntityId is not { } doAfterId || DoAfterIdIndex is not { } doAfterIndex) return null; return new DoAfterId(doAfterId, doAfterIndex); } }