using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; namespace Content.Shared.SelectableComponentAdder; /// /// Brings up a verb menu that allows players to select components that will get added to the item with this component. /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] public sealed partial class SelectableComponentAdderComponent : Component { /// /// List of verb -> components to add for that verb when selected basically! /// [DataField(required: true)] public List Entries = new(); /// /// The amount of times players can make a selection and add a component. If null, there is no limit. /// [DataField, AutoNetworkedField] public int? Selections; /// /// The verb category name that will be used. /// [DataField, AutoNetworkedField] public LocId VerbCategoryName = "selectable-component-adder-category-name"; } [DataDefinition] public sealed partial class ComponentAdderEntry { /// /// Name of the verb that will add the components in . /// [DataField(required: true)] public LocId VerbName; /// /// Popup to show when this option is selected. /// [DataField(required: true)] public LocId? Popup; /// /// List of all the components that will get added when the verb is selected. /// [DataField(required: true)] public ComponentRegistry? ComponentsToAdd; /// /// The type of behavior that occurs when the component(s) already exist on the entity. /// [DataField] public ComponentExistsSetting ComponentExistsBehavior = ComponentExistsSetting.Skip; /// /// The priorty of the verb in the list /// [DataField] public int Priority; } [Serializable, NetSerializable] public enum ComponentExistsSetting : byte { // If one of the components exist, skip adding it and continue adding the rest. // If all components already exist, disable the verb. Skip = 0, // If a component already exists, replace it with the new one. // The verb is always enabled. Replace = 1, // Disable the verb if any one of the components already exists. Block = 2, }