Table of Contents

Class PersonAi

Namespace
TinyLife.Objects
Assembly
TinyLife.dll

This class holds the artificial intelligence implementation for a PersonLike. The AI automatically selects actions based on their ActionType.AiSettings.

public class PersonAi : GenericDataHolder, IGenericDataHolder
Inheritance
GenericDataHolder
PersonAi
Implements
IGenericDataHolder
Inherited Members
GenericDataHolder.GetDataKeys()
Extension Methods

Methods

StartAutomatically(PersonLike, ActionType, bool, bool, params ActionArgument[])

Causes a person to start the given action automatically with the same behavior that it would have if started by the PersonAi

public static bool StartAutomatically(PersonLike person, ActionType type, bool forcePriority = false, bool force = false, params ActionArgument[] chosenArguments)

Parameters

person PersonLike

The person who should start the action

type ActionType

The action to start

forcePriority bool

Whether to add this action to the start of the action queue rather than the end, regardless of the return value of EnqueuePriority.

force bool

Whether to force-start the action. This is passed to EnqueueAction<T>(ActionType, ActionInfo, bool, bool, bool, params ActionArgument[]).

chosenArguments ActionArgument[]

The set of ActionArgument values to pass to EnqueueAction<T>(ActionType, ActionInfo, bool, bool, bool, params ActionArgument[]). If this is empty or null, arguments will automatically be generated randomly.

Returns

bool

Whether the action was successfully started

Events

OnUpdate

An event that is invoked when a PersonAi instance is updated, in Update(GameTime, TimeSpan, float). This event allows mods to change the various cooldowns used by the AI, as well as whether the AI should currently be considered disabled. It also allows adding new actions to a person's ActionQueue through the EnqueueAction<T>(ActionType, ActionInfo, bool, bool, bool, params ActionArgument[]) method.

public static event PersonAi.UpdateDelegate OnUpdate

Event Type

PersonAi.UpdateDelegate