GetAndSitDownAction - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.Actions

GetAndSitDownAction Class

A get-and-sit-down action is an action where a person gets an action object that can be picked up (like a plate of food) and interacts with it on a chair or at a standing desk.
This action considers a multitude of possible circumstances for the action, including the item being on a counter, on the ground, already on a valid table, in the person's hand, and more.
Note that GetInteractingItemForAction<T>(ActionInfo, FurnitureType[]) should be used to ensure that the correct interaction item is returned in every circumstance.

public abstract class GetAndSitDownAction : TinyLife.Actions.MultiAction

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

Constructors

GetAndSitDownAction.GetAndSitDownAction(ActionType, ActionInfo) Constructor

Creates a new action from the given ActionType

protected GetAndSitDownAction(TinyLife.Actions.ActionType type, TinyLife.Actions.ActionInfo info);

Parameters

type ActionType
The type to create this action from

info ActionInfo
The information for this action

Properties

GetAndSitDownAction.AllowStandingDesk Property

A property that determines whether this action can be executed at a StandingDesk

protected abstract bool AllowStandingDesk { get; }

Property Value

System.Boolean

GetAndSitDownAction.ForceTable Property

A property that determines whether this action requires a table to be executed.
If this value is false, the person is able to sit down on a chair or a bench without a table if there is none present.

protected abstract bool ForceTable { get; }

Property Value

System.Boolean

GetAndSitDownAction.WorkItems Property

An array of FurnitureType instances that represents all ietms which can be gotten and sat down with.
This array is used to check the validity of a person's held item and items on tables.

protected abstract TinyLife.Objects.FurnitureType[] WorkItems { get; }

Property Value

FurnitureType[]

Methods

GetAndSitDownAction.AndThenInitialize() Method

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

protected override void AndThenInitialize();

GetAndSitDownAction.AndThenUpdate(GameTime, TimeSpan, GameSpeed) Method

MultiAction version of Update(GameTime, TimeSpan, GameSpeed).
This method is called every update frame while the main action is active.
By default, only MainElapsedTime is increased.

protected override void AndThenUpdate(Microsoft.Xna.Framework.GameTime time, System.TimeSpan passedInGame, TinyLife.GameSpeed speed);

Parameters

time Microsoft.Xna.Framework.GameTime
The current game time

passedInGame System.TimeSpan
The amount of time that has passed, in game time

speed GameSpeed
The game's speed

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

GetAndSitDownAction.GetIconObject() Method

Returns the map object that is displayed in the action queue in the top left of the screen.
Note that this value is ignored if this action's type has a Texture.
By default, the GetActionObject<T>() is returned.

public override TinyLife.Objects.MapObject GetIconObject();

Returns

MapObject
The icon object

GetAndSitDownAction.GetInteractingItem<T>() Method

A helper method that returns the item instance that is currently being interacted with in this action.
Since this action type is rather complex, this is the favored way over GetActionObject<T>().

protected T GetInteractingItem<T>()
    where T : TinyLife.Objects.Furniture;

Type parameters

T
The type that the object is expected to be

Returns

T
The object, or null if there is none

GetAndSitDownAction.GetInteractingItemForAction<T>(ActionInfo, FurnitureType[]) Method

A helper method that returns the item instance that is currently being interacted with in this action.
Since this action type is rather complex, this is the favored way over GetActionObject<T>().

public static T GetInteractingItemForAction<T>(TinyLife.Actions.ActionInfo info, params TinyLife.Objects.FurnitureType[] workItems)
    where T : TinyLife.Objects.Furniture;

Type parameters

T
The type that the object is expected to be

Parameters

info ActionInfo

workItems FurnitureType[]

Returns

T
The object, or null if there is none

GetAndSitDownAction.GetNextAction(CompletionType) Method

Returns an action that should be queued up immediately after this action completes.
The queued up action is immediately started in the slot that this action occupied.
Can be null, and is null by default.

public override TinyLife.Actions.Action GetNextAction(TinyLife.Actions.Action.CompletionType completion);

Parameters

completion CompletionType
The type that this action completed with

Returns

Action
The follow-up action