using Content.Shared.Mind; using Content.Shared.Objectives; using Content.Shared.Objectives.Systems; using Robust.Shared.Utility; using Robust.Shared.Prototypes; namespace Content.Shared.Objectives.Components; /// /// Required component for an objective entity prototype. /// [RegisterComponent, Access(typeof(SharedObjectivesSystem))] [EntityCategory("Objectives")] public sealed partial class ObjectiveComponent : Component { /// /// Difficulty rating used to avoid assigning too many difficult objectives. /// [DataField(required: true)] public float Difficulty; /// /// Organisation that issued this objective, used for grouping and as a header above common objectives. /// [DataField("issuer", required: true)] private LocId Issuer { get; set; } [ViewVariables(VVAccess.ReadOnly)] public string LocIssuer => Loc.GetString(Issuer); /// /// Unique objectives can only have 1 per prototype id. /// Set this to false if you want multiple objectives of the same prototype. /// [DataField] public bool Unique = true; /// /// Icon of this objective to display in the character menu. /// Can be specified by an handler but is usually done in the prototype. /// [DataField] public SpriteSpecifier? Icon; } /// /// Event raised on an objective after spawning it to see if it meets all the requirements. /// Requirement components should have subscriptions and cancel if the requirements are not met. /// If a requirement is not met then the objective is deleted. /// [ByRefEvent] public record struct RequirementCheckEvent(EntityUid MindId, MindComponent Mind, bool Cancelled = false); /// /// Event raised on an objective after its requirements have been checked. /// If is set to true, the objective is deleted. /// Use this if the objective cannot be used, like a kill objective with no people alive. /// [ByRefEvent] public record struct ObjectiveAssignedEvent(EntityUid MindId, MindComponent Mind, bool Cancelled = false); /// /// Event raised on an objective after everything has handled . /// Use this to set the objective's title description or icon. /// [ByRefEvent] public record struct ObjectiveAfterAssignEvent(EntityUid MindId, MindComponent Mind, ObjectiveComponent Objective, MetaDataComponent Meta); /// /// Event raised on an objective to update the Progress field. /// To use this yourself call with the mind. /// [ByRefEvent] public record struct ObjectiveGetProgressEvent(EntityUid MindId, MindComponent Mind, float? Progress = null);