Skip to main content

AssistedSpawnCommandDefinition

A class in Root.Township, Alta.Menu.

Menu command asset that builds a spawn command for the local player from a chosen prefab and quantity, then routes it to the server. Created from the Township/Assisted Spawn asset menu.

Constructors​

MemberWhat it is
AssistedSpawnCommandDefinition()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

MemberWhat it is
const string PrefabArgument name for the prefab (prefab).
const string QuantityArgument name for the quantity (quantity).
4 private and internal fields
MemberWhat it is
private readonly Dictionary<string, string> argumentMapCurrent prefab and quantity values by argument name.
private Object autoCompletionSourceBacking object for AutoCompletionSource.
private const string SpawnCommandBaseThe command template, spawn {localplayer} {prefab} {quantity}.
private int[] spawnQuantitiesBacking field for SpawnQuantities.

Properties​

MemberWhat it is
string[] Labels { get; }The spawn quantities as button labels.
override string SettingDescription { get; }Always empty for this command.
int[] SpawnQuantities { get; }The quantities offered as buttons.
1 private and internal property
MemberWhat it is
private IAutoCompletionSource AutoCompletionSource { get; }The completion source that lists valid prefab names.

Methods​

MemberWhat it is
bool ArgumentIsValid(string argumentName)Checks one argument: the prefab must be in the completion source, the quantity must parse as an int.
bool CommandIsValid()True when both the prefab and quantity arguments are valid.
string GetArgument(string name)Returns an argument's current value, or an empty string if unknown.
override void RunCommandOnClient()Builds the command and sends it through CommandSync.Instance.RouteCommand.
void SetArgument(string name, string argument)Sets an argument's value by name.
1 private and internal method
MemberWhat it is
private string ParseCommand()Fills the prefab and quantity into the command template, removing spaces from the values.

Used in​

Members of other types that take, return or hold a AssistedSpawnCommandDefinition: