TinyLifeExampleMod/Api/TinyLife/Actions/ActionInfo.md

4.5 KiB

ActionInfo

Namespace: TinyLife > Actions

Assembly: Tiny Life.dll

Implements IGenericDataHolder

Summary

An action info is a set of information that is required to execute an action

Fields

Type Name Summary
Vector2 ActionLocation The location that this action should be executed in. Note that this is mostly only relevant if there is no TinyLife.Actions.ActionInfo.ActionObject.
Guid ActionObject The System.Guid of the object that this action is related to. Can be System.Guid.Empty, which indicates that there is no action object. To retrieve the actual object, use TinyLife.Actions.ActionInfo.GetActionObject``1.

Properties

Type Name Summary
ActionSpot ActionSpot The TinyLife.Actions.ActionInfo.ActionSpot that this action is related to. Can be null, even if the TinyLife.Actions.ActionInfo.ActionObject exists.
Map Map The TinyLife.Actions.ActionInfo.Map that the action is executed on
Person Person The TinyLife.Actions.ActionInfo.Person that is currently executing the action

Methods

Return Name Summary
void AddAuxiliaryObject ( MapObject ) Adds an additional object that, along with the TinyLife.Actions.ActionInfo.ActionObject, is involved in this action. Adding an auxiliary object causes TinyLife.Actions.ActionInfo.GetInvolvedObjects``1(TinyLife.Objects.ObjectCategory) to consider it, as well as TinyLife.Objects.MapObject.ActionUpdate(TinyLife.Actions.Action,Microsoft.Xna.Framework.GameTime,System.TimeSpan,TinyLife.GameSpeed,System.Boolean) to be called for it.
T GetActionObject ( ) Returns the object that this action is related to, or null if there is none or the object isn't of the given type.
T GetInvolvedObject ( ObjectCategory ) A helper method that returns the first available entry from TinyLife.Actions.ActionInfo.GetInvolvedObjects``1(TinyLife.Objects.ObjectCategory) or null if there is none
IEnumerable<T> GetInvolvedObjects ( ObjectCategory ) Returns a set of objects of the given type type that match the given . The objects considered are the `TinyLife.Actions.ActionInfo.ActionObject`, the `TinyLife.Actions.ActionInfo.Person`'s `TinyLife.Objects.Person.GetHeldObject1and the auxiliary objects added usingTinyLife.Actions.ActionInfo.AddAuxiliaryObject(TinyLife.Objects.MapObject)`.
Boolean OccupyFreeActionSpot ( ObjectCategory, Boolean, Nullable<Direction2> ) This is a shorthand method for TinyLife.Objects.Furniture.GetFreeActionSpot(TinyLife.Objects.Person,TinyLife.Objects.ObjectCategory) and TinyLife.Objects.Person.OccupyActionSpot(TinyLife.Objects.Furniture,TinyLife.Objects.ActionSpot,System.Boolean,System.Nullable{MLEM.Misc.Direction2}). Note that this method needs to be called every update frame for the person to keep occupying the action spot.
ActionInfo ToFreeActionSpot ( ObjectCategory ) This is a shorthand method for TinyLife.Objects.Furniture.GetFreeActionSpotInfo(TinyLife.Objects.Person,TinyLife.Objects.ObjectCategory) that is applied to our action object (TinyLife.Actions.ActionInfo.GetActionObject``1).
void Validate ( Person ) Validates this action info. This method should only be called when this action info is read from disk.

Static Methods

Return Name Summary
ActionInfo FromLocation ( Person, Vector2 ) Returns a new TinyLife.Actions.ActionInfo based on the given location (and no objects)
ActionInfo FromObjectGeneric ( Person, MapObject ) Returns a new TinyLife.Actions.ActionInfo basd on the given object, but no object spot