TinyLife_Actions - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.Actions Namespace

Classes
Action An action is something that a Person does.An action is always derived from an underlying ActionType that contains various action settings.Actions can be queued up for a person (ActionQueue) or currently active (CurrentActions).To create a more complex action, it is best to extend MultiAction.You can find a multitude of action-related events in Person, like OnActionsCompleted.
ActionInfo An action info is a set of information that is required to execute an action
ActionType Action types are blueprints for Action instances which can be registered using Register(TypeSettings).An action type contains information about its action and can create an instance using ConstructedType.
ComputerAction A computer action is an action that is executed at a computer.Using this class automatically turns the computer on (TurnOn(string)) and plays a typing sound.
DieAction An action that is invoked when a Person should Die(DeathReason, bool).All default DeathReason values are handled by this action.To enqueue this action efficiently, use Enqueue(Person, DeathReason).
Emote An emote is a graphic that can be displayed in a bubble over a Person, usually as part of a conversation.
GetAndSitDownAction 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.
GoHereAction 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.
MultiAction A multi action is an action that can have different actions executed before and/or after itself.This is quite useful if an action requires a Person to go somewhere to pick up an item etc.
OutOfTownAction An out-of-town action is an action where the Person finds the closest exit road and then exits the city using that road.Out-of-town actions are things like going to work, where the destination location isn't visible to the player.
PathfindAction A pathfinding action is an action that first finds a path and then allows that path to be traversed.The pathfinding is done using MLEM.Pathfinding.AStar2.
SellAction 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.
SinkAction An action that is invoked at a Sink.If the sink is not the main GetActionObject<T>(), it should be added as an auxiliary object using AddAuxiliaryObject(MapObject, ActionSpot) in AndThenInitialize().This action automatically displays a running water sound and sets the active person's pose to a working version using ToWorking(Pose).
SitAction A sit action is an action in which someone perpetually sits on an object while the action is being executed.This action is the base class used for TinyLife.Actions.ActionType.SitToilet's action class.Note that, for desk object interactions and interactions with movable held items, WorkAtDeskObjectAction or GetAndSitDownAction should be used instead.
SocialAction A social action is an action that involves two Person instances.Before a social action "actually" starts, both parties have to have the action as their current action.For this to happen, the person that initiates the action follows the Partner until they reach them (or give up).
TalkAction TalkAction is a generic social action with a set of pre-defined parameters.Things like PersonalityType and TinyLife.Skills.SkillType.Charisma automatically influence this interaction's FriendshipGain and GoBadlyChance.Create(string, Func<Person,float>, TalkSettings) should be used to create a talk action.
TalkAction.TalkSettings Additional settings for TalkAction, used by Create(string, Func<Person,float>, TalkSettings)
UnderlyingAction An UnderlyingAction is a class that can instantiate a single Action that will be executed as part of the action it is used in.Note that, when using this class, Update(GameTime, TimeSpan, GameSpeed), Validate(Person) and especially OnCompleted(CompletionType) have to be called in the appropriate places.
WalkAction A walk action is the action that gets executed by TinyLife.Actions.ActionType.GoHere if the distance is short enough, or before and after driving part of the way to the action location.
WatchTvAction Watch tv action is the action that is created by the TinyLife.Actions.ActionType.WatchTv action types.This action class is exposed as its behavior is rather complex, taking into account the possible locations that a person can stand or sit while watching TV.See GetViewers(Furniture, int), GetViewingArea(Furniture, int) and GetSeating(Person, Furniture, int) for more information.
WorkAtDeskObjectAction A work at desk object action is an action where a person works at an object that is statically attached to a table or standing desk.Note that this class differs from GetAndSitDownAction in that the object involved in this action cannot be picked up or moved by a person.This class is used by ComputerAction.
Structs
ActionType.AiSettings A set of settings that TypeSettings uses to determine how PersonAi should deal with this ActionType
ActionType.TypeSettings A struct that contains information about an ActionType
ActionVariety An action variety is a modification to a ActionType that represents a slightly changed version of the generic action type.Action varieties are used, for example, by TinyLife.Actions.ActionType.PrepareFood to determine the kind of food that should be prepared.
Enums
Action.CompletionType An enumeration that represents the various states that an Action can be in.
ActionType.CanExecuteResult An enumeration that represents whether or not an action can be executed. This is used by CanExecuteDelegate(ActionInfo, bool).
EmoteCategory A flag enumeration that represents the types of Emote that are available
WatchTvAction.Channel An enumeration that represents channels that a tv can display in WatchTvAction
Delegates
ActionType.CanExecuteDelegate(ActionInfo, bool) A delegate method used for CanExecute
TalkAction.TalkSettings.EvaluationResult(SocialAction, float, float, float, float, float) A delegate that is used for Evaluate(SocialAction)