Table of Contents

Class SellAction

Namespace
TinyLife.Actions
Assembly
Tiny Life.dll

The Sell action is an action that includes PersonLike of the action picking up the item (if they're not already holding it), and then carrying it to a mailbox and selling it there. To add new sellable items for this action type to support, you can add them to the Items collection.

public class SellAction : MultiAction, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
SellAction
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Fields

Items

A dictionary that maps FurnitureType instances to a condition that allows them to be sold. When the furniture item or a mailbox is clicked on, and the ActionType.CanExecuteDelegate matches, the item can be sold using the Sell action. Note that, to receive the item that is to be sold, GetSoldObject<T>(ActionInfo) should be used.

public static readonly Dictionary<FurnitureType, ActionType.CanExecuteDelegate> Items

Field Value

Dictionary<FurnitureType, ActionType.CanExecuteDelegate>

Methods

AndThenInitialize()

Initializes the main action. This method is called after Handler has all completed.

protected override void AndThenInitialize()

AndThenIsCompleted()

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

protected override CompletionType AndThenIsCompleted()

Returns

CompletionType

Whether the main action is completed

CreateFirstActions()

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 the returned set only contains null items, no first actions will be executed.

protected override IEnumerable<Action> CreateFirstActions()

Returns

IEnumerable<Action>

A set of actions that should run before this action

GetSoldObject<T>(ActionInfo)

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>(ActionInfo info) where T : Furniture

Parameters

info ActionInfo

The action info

Returns

T

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

Type Parameters

T

The type that the object is expected to be