Show / Hide Table of Contents

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
System.Object
Verb
ActivationVerb
AlternativeVerb
EquipmentVerb
ExamineVerb
InnateVerb
InteractionVerb
UtilityVerb
VvVerb
Namespace: Content.Shared.Verbs
Assembly: Content.Shared.dll
Syntax
public class Verb : IComparable

Fields

| Improve this Doc View Source

Act

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.

| Improve this Doc View Source

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
| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

ConfirmationPopup

Whether this verb requires confirmation before being executed.

Declaration
public bool ConfirmationPopup
Field Value
Type Description
System.Boolean
| Improve this Doc View Source

DefaultTextStyleClass

Declaration
public static string DefaultTextStyleClass
Field Value
Type Description
System.String
| Improve this Doc View Source

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.

| Improve this Doc View Source

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>
| Improve this Doc View Source

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
| Improve this Doc View Source

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).

| Improve this Doc View Source

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
| Improve this Doc View Source

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>
| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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).

| Improve this Doc View Source

Text

The text that the user sees on the verb button.

Declaration
public string Text
Field Value
Type Description
System.String
| Improve this Doc View Source

TextStyleClass

Style class for drawing in the context menu

Declaration
public string TextStyleClass
Field Value
Type Description
System.String
| Improve this Doc View Source

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 Source

CloseMenuDefault

Declaration
public virtual bool CloseMenuDefault { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

DefaultDoContactInteraction

Declaration
public virtual bool DefaultDoContactInteraction { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

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 Source

CompareTo(Nullable<Object>)

Compares two verbs based on their Priority, Category, Text, and .

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.

  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾