GoHereAction - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life


GoHereAction Class

A go here action is an action that uses two underlying actions for its execution: an action where a person walks to a goal and an action where a person drives to a goal.
This is the action class used by TinyLife.Actions.ActionType.GoHere.

public class GoHereAction : TinyLife.Actions.MultiAction

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


GoHereAction.GoHereAction(ActionType, ActionInfo) Constructor

Creates a new action from the given ActionType

public GoHereAction(TinyLife.Actions.ActionType type, TinyLife.Actions.ActionInfo info);


type ActionType
The type to create this action from

info ActionInfo
The information for this action


GoHereAction.AndThenInitialize() Method

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

protected override void AndThenInitialize();

GoHereAction.AndThenIsCompleted() Method

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

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


Whether the main action is completed

GoHereAction.CanCancel(Action) Method

Returns whether or not this action can be canceled by the given outside source.
Note that the outside source can be null, and if it is, it means that the player canceled the action manually.
By default, actions can only be canceled if the cancelSource is null.

public override bool CanCancel(TinyLife.Actions.Action cancelSource);


cancelSource Action
The source of the cancelation, or null if the player canceled it


true if the action can be canceled

GoHereAction.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();


A set of actions that sohuld run before this action

GoHereAction.ShouldFail(Action, CompletionType) Method

A method that returns whether or not this main action should fail if the previous or next completedAction completed with the given completion.
By default, this method returns true only if completion is not Completed.

protected override bool ShouldFail(TinyLife.Actions.Action completedAction, TinyLife.Actions.Action.CompletionType completion);


completedAction Action
The action that has completed

completion CompletionType
The completion type of the action


true if we should fail due to this completion