Namespace TinyLife.Actions
Classes
- Action
An action is something that a PersonLike 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 PersonLike, like OnActionsCompleted.
- ActionArgument
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 PrepareFood to determine the kind of food that should be prepared.
- 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.
- BehaviorAction
A behavior-based action is an Action that invokes an underlying ActionBehavior in the appropriate places. This type of action can be useful for when an action uses a basic behavior, but does a more complex additional action. See BehaviorAction<T> for a generic version with some additional functionality.
- BehaviorAction<T>
A generic version of BehaviorAction<T> with some additional functionality. If the chosen behavior type
T
does not have a constructor that only accepts an Action as an argument, the Behavior property has to be set manually in the subclass constructor.
- ChoicePromptInfo
A choice prompt info is a set of data that can be used in OpenChoicePrompt(ChoicePromptInfo) to display a set of options to the player, one of which is randomly chosen to be "correct", causing a positive effect to happen. Choice prompts are used by JobType, but can also be used in custom circumstances.
- ChoicePromptInfo.Option
An option is a possible action and outcome for a ChoicePromptInfo. It is randomly chosen to be correct or incorrect, based on a multitude of factors that can be specified in the constructors.
- CleanEverythingAction
An action is something that a PersonLike 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 PersonLike, like OnActionsCompleted.
- DebugAction
An abstract class that can be used to easily create debug-only actions that are available when TinyLife.Debug.ShowDebugActions is enabled. They complete immediately when started and invoke their Run() method once on completion. A debug action type should be created using Create(string, ObjectCategory, Type, CanExecuteDelegate) or one of its overloads.
- DeferredAction
A deferred action is an Action that, when started, invokes an underlying action using UnderlyingActionHandler. This is useful for situations where a MultiActionHandler would construct an action prematurely, before its ActionInfo is properly available.
- DieAction
An action that is invoked when a PersonLike should Die(DeathReason). All default DeathReason values are handled by this action. To enqueue this action effectively, use Enqueue(PersonLike, DeathReason).
- DiscardHeldItemAction
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.
- DriveAction
A drive action is the action that gets executed by GoHere if the distance long enough to drive. This action involves a Tiny getting into a Vehicle that this action spawns, driving on a road and then exiting and deleting the Vehicle.
- Emote
An emote is a graphic that can be displayed in a bubble over a PersonLike, usually as part of a conversation.
- 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 GoHere.
- HelpAction
An action class derived from SocialAction that represents a complex action that involves a person being helped by a helper, and that can be started from both parties ("Ask for Help" and "Offer Help"). An action type for actions of this class should be created using CreateActions(string, ObjectCategory, Type, CanExecuteDelegate, CanExecuteDelegate, AiSettings?, AiSettings?).
- HoldingPersonAction
This is a SocialAction with additional capabilities that can be used for actions that involve one PersonLike picking up and holding another PersonLike, especially babies.
- 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 PersonLike to go somewhere to pick up an item etc.
- OrderFromStaffAction
An abstract action class that allows creating actions where a PersonLike orders a given item from a LotEmployment employee. This action expects the employee to then execute an action that leaves them with an item in their hand that can be passed to the one who submitted the order.
- OutOfTownAction
An out-of-town action is an action where the PersonLike 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.
- PathfindToPersonAction
An Action that causes the underlying PersonLike to pathfind to another person repeatedly until they have reached them, or until GetMaxPathfindTime() is up. This action is used by SocialAction.
- PutAwayAction
An action class used by PutAway. This action is exposed to allow the addition of custom put-away-able items by adding them to the Items collection.
- SellAction
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.
- SimpleBehaviorAction
A simple behavior action is a BehaviorAction that can be constructed simply without requiring a custom class that extends BehaviorAction. It does this through the Create(ActionSettings) method, similarly to TalkAction.
- 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 SitToilet's action class. Note that, for desk object interactions and interactions with movable held items, WorkAtDeskObjectBehavior or GetAndSitDownBehavior should be used instead.
- SocialAction
A social action is an action that involves two PersonLike 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).
- SocialAction.StartPartnerAction
An action is something that a PersonLike 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 PersonLike, like OnActionsCompleted.
- StartTogetherAction
An action type that automatically invokes another action after asking someone to start that action together. The resulting actions will not be executed in any type of "together" form, so they must implement togetherness behavior themselves. A start together action type can be created using Create(string, ActionType, int).
- StoreAction
The Store action can be invoked by a PersonLike, causing them to walk to the object, pick it up and then store it into their Household's FurnitureStorage. To add new items that have this ability, you can add them to the Items collection.
- TalkAction
TalkAction is a generic social action with a set of pre-defined parameters. Things like PersonalityType and Charisma automatically influence this interaction's FriendshipGain and GoBadlyChance. Create(string, Func<PersonLike, float>, TalkSettings) should be used to create a talk action.
- TellPeopleToLeaveRoomAction
An action that causes the current PersonLike to tell everyone else who is currently in the room to leave it. When initializing this action, a set of ExcludedPeople can optionally be specified.
- TryGoHereAction
This action is similar to GoHereAction, but considers all involved locations (GetInvolvedLocations()) rather than a single position. The action's PersonLike will then try to pathfind to each one of the positions in a random order, until one of them is valid, and go to it.
- WalkAction
A walk action is the action that gets executed by GoHere if the distance is short enough, or before and after driving part of the way to the action location.
- WatchTvAction
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 PersonLike to go somewhere to pick up an item etc.
- WorkAction
A work action is the action that is used for Job instances when a person goes to work
Structs
- ActionType.AiSettings
A set of settings that ActionType.TypeSettings uses to determine how PersonAi should deal with this ActionType
- ActionType.TypeSettings
A struct that contains information about an ActionType
- CanExecuteResult
A utility structure used by ActionType.CanExecuteDelegate and other situations where an action can fail, or fail to start, due to a specific circumstance. The Name of the CanExecuteResult will be localized and displayed to the player if the CanExecuteResult.ResultType is not Hidden or Valid.
- EmoteChoices
A structure used by DisplayEmote(EmoteChoices, bool, float, float) to allow passing either a combined EmoteCategory flag, or a set of specific Emote instances, from which a final emote should be chosen.
- SimpleBehaviorAction.ActionSettings
A struct used by SimpleBehaviorAction's Create(ActionSettings) method to pass settings onto a simple behavior action.
- TalkAction.TalkSettings
Additional settings for TalkAction, used by Create(string, Func<PersonLike, float>, TalkSettings)
Enums
- CanExecuteResult.ResultType
A type of result that a CanExecuteResult can have. In general, custom CanExecuteResult instances will have the Invalid result type, as Valid and Hidden are already covered by their respective CanExecuteResult counterparts.
- CompletionType
An enumeration that represents the various states that an Action can be in.
- EmoteCategory
A flag enumeration that represents the types of Emote that are available
- MultiAction.Stage
An enumeration that defines the stage that a MultiAction is currently in.
Delegates
- Action.ActionTypeConstructedDelegate
A delegate method used by OnActionTypeConstructed.
- ActionType.CanExecuteDelegate
A delegate method used for CanExecute
- TalkAction.TalkSettings.EvaluationResult
A delegate that is used for EvaluateSimple(Action, PersonLike, float, float) and EvaluateFully(SocialAction).