SellAction - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.Actions

SellAction Class

A sell action is an action where an item that can be picked up gets sold at a mailbox.
Since this action can be invoked by clicking on the sold object, or by clicking on a mailbox while holding the sold object, GetSoldObject<T>(ActionInfo) should be used to return the correct object in both circumstances.

public class SellAction : TinyLife.Actions.MultiAction

Inheritance System.Object 🡒 MLEM.Misc.GenericDataHolder 🡒 Action 🡒 MultiAction 🡒 SellAction

Methods

SellAction.AndThenInitialize() Method

Initializes the main action.
This method is called after FirstActions have all completed.

protected override void AndThenInitialize();

SellAction.AndThenIsCompleted() Method

MultiAction version of IsCompleted().
This method returns whether or not the main action is completed.

protected override TinyLife.Actions.Action.CompletionType AndThenIsCompleted();

Returns

CompletionType
Whether the main action is completed

SellAction.CreateFirstActions() Method

Return a set of actions that should be executed before this action.
Even if the yield statement is used, all actions will be collected into a list at the start of this action's invocation.
If no action gets returned in this function, this action fails.
If a null action is returned as the first item, no first actions will be executed.

protected override System.Collections.Generic.IEnumerable<TinyLife.Actions.Action> CreateFirstActions();

Returns

System.Collections.Generic.IEnumerable<Action>
A set of actions that sohuld run before this action

SellAction.GetSoldObject<T>(ActionInfo) Method

A helper method that returns the object that is being sold.
This method returns the action object or the person's held object.

public static T GetSoldObject<T>(TinyLife.Actions.ActionInfo info)
    where T : TinyLife.Objects.Furniture;

Type parameters

T
The type that the object is expected to be

Parameters

info ActionInfo
The action info

Returns

T
The object, or null if there is none or it doesn't match the type