TinyLifeExampleMod/Api/TinyLife/Objects/MapObject.md

6.1 KiB

MapObject

Namespace: TinyLife > Objects

Assembly: Tiny Life.dll

Implements IGenericDataHolder

Summary

An instance of this class represents an object that can be, or is, part of a TinyLife.Objects.MapObject.Map. If this object's TinyLife.Objects.MapObject.Position is set to -1, -1, that is usually an indicator that the object is currently not in the world.

Constructors

Name Summary
MapObject ( Guid, Map, Vector2 ) Creates a new map object with the given settings

Fields

Type Name Summary
Guid Id The System.Guid of this object instance

Properties

Type Name Summary
Lot CurrentLot A property that returns the TinyLife.Objects.MapObject.CurrentLot that this object is currently on
Boolean IsInWorld A property that returns true if this object is currently present on a TinyLife.Objects.MapObject.Map
Map Map The map that this object is currently on. If this is null, the object is not currently on a map.
Vector2 Position The position on the TinyLife.Objects.MapObject.Map of this object. If this is set to -1, -1, that is usually an indicator that the object is currently not in the world.

Methods

Return Name Summary
void ActionUpdate ( Action, GameTime, TimeSpan, GameSpeed, Boolean ) This method is called when an TinyLife.Actions.Action that this object is involved in updates, which is every Microsoft.Xna.Framework.Game.Update(Microsoft.Xna.Framework.GameTime) frame. This object counts as involved in the action if its TinyLife.Actions.ActionInfo's TinyLife.Actions.ActionInfo.GetInvolvedObjects``1(TinyLife.Objects.ObjectCategory) includes this object
void Draw ( GameTime, SpriteBatch, Vector2, Nullable<Color> ) Draws this object on the current TinyLife.Objects.MapObject.Map, at the current TinyLife.Objects.MapObject.Position.
Int32 GetAiPriority ( Person, ObjectCategory ) Returns an integer that represents a priority for the TinyLife.Objects.PersonAi's interaction with this object. A higher priority means that this object will be picked over other objects (with lower priority). The default return value is 0, meaning that no special priority is assigned to this object. For any TinyLife.Objects.Furniture with the TinyLife.Objects.ObjectCategory.Bed category that is the person's TinyLife.Objects.Person.LastBedSleptIn, 10 is returned.
ObjectCategory GetCategories ( Person ) Returns a set of TinyLife.Objects.ObjectCategory flags that this object has, based on the given TinyLife.Objects.Person.
Tooltip GetHoverInfo ( ) Returns a MLEM.Ui.Elements.Tooltip object that is displayed whenever the mouse is hovered over this object in the world. By default, this method returns null, which will cause no tooltip to be displayed.
Boolean HasCategory ( Person, ObjectCategory ) A shorthand that checks whether TinyLife.Objects.MapObject.GetCategories(TinyLife.Objects.Person) overlaps with the given `` flags
Boolean Intersects ( RectangleF ) Returns whether this map object intersects with the given rectangle. This is used for TinyLife.World.Map.GetObjects``1(MLEM.Misc.RectangleF)
void OnActionCompleted ( Action, CompletionType, Boolean )
void OnAdded ( ) This method is called when this object is added to a TinyLife.Objects.MapObject.Map. By default, it does nothing.
void OnRemoved ( ) This method is called when this object is removed from a TinyLife.Objects.MapObject.Map. By default, it does nothing.
Boolean SetMapAndValidate ( Map ) This method is the same as TinyLife.Objects.MapObject.Validate, but it also sets the TinyLife.Objects.MapObject.Map.
Boolean Validate ( ) This method is called when this object is loaded from disk. Returning false on this method causes the object to be removed from the map. By default, this method does nothing.

Static Fields

Type Name Summary
ObjectCategory[] Categories A list of all of the TinyLife.Objects.ObjectCategory flags that exist
Direction2[] PersonRotationOrder The order of MLEM.Misc.Direction2 that the texture atlas for TinyLife.Objects.Person has for its textures, from left to right

Static Methods

Return Name Summary
ObjectCategory GetModCategory ( String ) Adds and returns a custom TinyLife.Objects.ObjectCategory with the given name. Note that the returned category is not System.Enum.IsDefined(System.Type,System.Object), and thus, does not have a name. The returned category is guaranteed to be unique and mapped to the given name. Additionally, it can be used in combined flags, as it is not a combined flag itself.