Class Verb
Verb objects describe actions that a user can take. The actions can be specified via an Action, local events, or networked events. Verbs also provide text, icons, and categories for displaying in the context-menu.
Inheritance
Namespace: Content.Shared.Verbs
Assembly: Content.Shared.dll
Syntax
public class Verb : IComparable
Fields
| Improve this Doc View SourceAct
This is an action that will be run when the verb is "acted" out.
Declaration
public Action? Act
Field Value
Type | Description |
---|---|
System.Nullable<Action> |
Remarks
This delegate probably just points to some function in the system assembling this verb. This delegate will be run regardless of whether ExecutionEventArgs is defined.
Category
Name of the category this button is under. Used to group verbs in the context menu.
Declaration
public VerbCategory Category
Field Value
Type | Description |
---|---|
VerbCategory |
ClientExclusive
Whether a verb is only defined client-side. Note that this has nothing to do with whether the target of the verb is client-side
Declaration
public bool ClientExclusive
Field Value
Type | Description |
---|---|
System.Boolean |
Remarks
If true, the client will not also ask the server to run this verb when executed locally. This just prevents unnecessary network events and "404-verb-not-found" log entries.
CloseMenu
Whether or not to close the context menu after using it to run this verb.
Declaration
public bool? CloseMenu
Field Value
Type | Description |
---|---|
System.Nullable<System.Boolean> |
Remarks
Setting this to false may be useful for repeatable actions, like rotating an object or maybe knocking on a window.
ConfirmationPopup
Whether this verb requires confirmation before being executed.
Declaration
public bool ConfirmationPopup
Field Value
Type | Description |
---|---|
System.Boolean |
DefaultTextStyleClass
Declaration
public static string DefaultTextStyleClass
Field Value
Type | Description |
---|---|
System.String |
Disabled
Whether this verb is disabled.
Declaration
public bool Disabled
Field Value
Type | Description |
---|---|
System.Boolean |
Remarks
Disabled verbs are shown in the context menu with a slightly darker background color, and cannot be executed. It is recommended that a Message message be provided outlining why this verb is disabled.
DoContactInteraction
If true, this verb will raise ContactInteractionEvents when executed. If not explicitly specified, this will just default to raising the event if DefaultDoContactInteraction is true and the user is in range.
Declaration
public bool? DoContactInteraction
Field Value
Type | Description |
---|---|
System.Nullable<System.Boolean> |
EventTarget
Where do direct the local event. If invalid, the event is not raised directed at any entity.
Declaration
public EntityUid EventTarget
Field Value
Type | Description |
---|---|
EntityUid |
ExecutionEventArgs
This is a general local event that will be raised when the verb is executed.
Declaration
public object? ExecutionEventArgs
Field Value
Type | Description |
---|---|
System.Nullable<System.Object> |
Remarks
If not null, this event will be raised regardless of whether Act was run. If this event exists purely to call a specific system method, then Act should probably be used instead (method events are a no-go).
Icon
Sprite of the icon that the user sees on the verb button.
Declaration
public SpriteSpecifier Icon
Field Value
Type | Description |
---|---|
Robust.Shared.Utility.SpriteSpecifier |
IconEntity
If this is not null, and no icon or icon texture were specified, a sprite view of this entity will be used as the icon for this verb.
Declaration
public NetEntity? IconEntity
Field Value
Type | Description |
---|---|
System.Nullable<NetEntity> |
Impact
How important is this verb, for the purposes of admin logging?
Declaration
public LogImpact Impact
Field Value
Type | Description |
---|---|
Content.Shared.Database.LogImpact |
Remarks
If this is just opening a UI or ejecting an id card, this should probably be low.
Message
Optional informative message.
Declaration
public string? Message
Field Value
Type | Description |
---|---|
System.Nullable<System.String> |
Remarks
This will be shown as a tooltip when hovering over this verb in the context menu. Additionally, iF a Disabled verb is executed, this message will also be shown as a pop-up message. Useful for disabled verbs to inform users about why they cannot perform a given action.
Priority
Determines the priority of the verb. This affects both how the verb is displayed in the context menu GUI, and which verb is actually executed when left/alt clicking.
Declaration
public int Priority
Field Value
Type | Description |
---|---|
System.Int32 |
Remarks
Bigger is higher priority (appears first, gets executed preferentially).
Text
The text that the user sees on the verb button.
Declaration
public string Text
Field Value
Type | Description |
---|---|
System.String |
TextStyleClass
Style class for drawing in the context menu
Declaration
public string TextStyleClass
Field Value
Type | Description |
---|---|
System.String |
VerbTypes
Collection of all verb types,
Declaration
public static List<Type> VerbTypes
Field Value
Type | Description |
---|---|
List<Type> |
Remarks
Useful when iterating over verb types, though maybe this should be obtained and stored via reflection or something (list of all classes that inherit from Verb). Currently used for networking (apparently Type is not serializable?), and resolving console commands.
Properties
| Improve this Doc View SourceCloseMenuDefault
Declaration
public virtual bool CloseMenuDefault { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
DefaultDoContactInteraction
Declaration
public virtual bool DefaultDoContactInteraction { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
TypePriority
Determines the priority of this type of verb when displaying in the verb-menu. See CompareTo(Nullable<Object>).
Declaration
public virtual int TypePriority { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceCompareTo(Nullable<Object>)
Declaration
public int CompareTo(object? obj)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Object> | obj |
Returns
Type | Description |
---|---|
System.Int32 |
Remarks
This is comparison is used when storing verbs in a SortedSet. The ordering of verbs determines both how the verbs are displayed in the context menu, and the order in which alternative action verbs are executed when alt-clicking.
If two verbs are equal according to this comparison, they cannot both be added to the same sorted set of verbs. This is desirable, given that these verbs would also appear identical in the context menu. Distinct verbs should always have a unique and descriptive combination of text, icon, and category.