Table of Contents

Class DiscardHeldItemAction

Namespace
TinyLife.Actions
Assembly
Tiny Life.dll

A typeless action that can be used to make tinies get rid of the item that they're currently holding before starting their action, using MultiAction. To add custom default ways of discarding an item, they can be added to the DiscardActions collection.

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

Constructors

DiscardHeldItemAction(Person)

public DiscardHeldItemAction(Person person)

Parameters

person Person

Fields

DiscardActions

The collection of default ways that a tiny will try to discard the item they're currently holding. The collection is ordered by "priority", so items closer to the start will be attempted first. By default, the last item in the collection is the PutDown action, which will be tried as a sort of "last resort".

public static readonly List<(Func<Person, MapObject, bool> Predicate, Func<Person, MapObject, ActionType> DiscardAction)> DiscardActions

Field Value

List<(Func<Person, MapObject, bool> Predicate, Func<Person, MapObject, ActionType> DiscardAction)>

Methods

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