TinyLifeExampleMod/Api/TinyLife/Objects/FurnitureType.md

11 KiB

FurnitureType

Namespace: TinyLife > Objects

Assembly: Tiny Life.dll

Implements IGenericDataHolder, IPricedObject

Summary

A furniture type is basically a blueprint for TinyLife.Objects.Furniture objects. Each furniture type can create a furniture instance and the type's data will be transferred to the instance. Furniture types are automatically listed in the TinyLife.Tools.FurnitureTool if registered using TinyLife.Objects.FurnitureType.Register(TinyLife.Objects.FurnitureType.TypeSettings).

Fields

Type Name Summary
Dictionary<Direction2, TextureRegion[]> Textures The textures that this furniture type has. Each texture is automatically loaded based on the registered MLEM.Data.DataTextureAtlas instances. If a furniture type has multiple TinyLife.Objects.FurnitureType.TypeSettings.ColorMap entries (or multiple TinyLife.Objects.FurnitureType.TypeSettings.ColorSchemes), additional texture regions will automatically be created to the right of the original texture region.

Properties

Type Name Summary
TextureRegion ReferenceTexture A reference texture that is used for visual size calculations. Always returns the first available texture of TinyLife.Objects.FurnitureType.TypeSettings.DefaultRotation in TinyLife.Objects.FurnitureType.Textures
ICollection<Direction2> Rotations The valid rotations that this furniture has, which are automatically determined based on the available TinyLife.Objects.FurnitureType.Textures
TypeSettings Settings This furniture type's settings

Methods

Return Name Summary
Boolean AreWallsInTheWay ( Map, Vector2, Direction2 ) Returns whether or not there would be walls in the way if this furniture type was placed at the given position with the given rotation
Furniture Construct ( Int32[], Map, Vector2, Nullable<Guid> ) Constructs a new TinyLife.Objects.Furniture object from this furniture type
void DrawLayers ( Map, Vector2, SpriteBatch, Vector2, Direction2, TextureRegion[], Int32[], Single, Boolean, Furniture, ObjectSpot, Nullable<Color>, Single, Boolean ) Draws the furniture type with the given data
Direction2 GetBestRotation ( Direction2 ) Returns a MLEM.Misc.Direction2 that is closest to , but that this object is allowed to have. The return value is guaranteed to be contained in `TinyLife.Objects.FurnitureType.Rotations` and have the same verticality as , or be the same value.
Int32 GetColumns ( Direction2 ) Returns the amount of columns that this furniture should be drawn in, based on the given rotation.
Single GetPrice ( )
Point GetSize ( Direction2 ) Returns the TinyLife.Objects.FurnitureType.TypeSettings.Size of this furniture type, modified based on the given rotation.
IEnumerable<Wall> GetWallsInTheWay ( Map, Vector2, Direction2 ) Returns a set of walls that would be in the way if this furniture type was placed at the given position with the given rotation
Boolean HasCategory ( ObjectCategory ) Returns whether this type's TinyLife.Objects.FurnitureType.Settings have any of the supplied TinyLife.Objects.ObjectCategory values
void SlotIntoActionSpot ( Vector2, Direction2, Single, Int32, out Vector2, out Single ) A helper method that modifies and so that they can be used for depth calculations that will make an object look as if it was slotted into the given action spot

Static Fields

Type Name Summary
FurnitureType Book
FurnitureType CountryFence
FurnitureType CustomPainting
FurnitureType EmptyPlate
FurnitureType FoodPlate
FurnitureType GrassPatch
FurnitureType Gravestone
FurnitureType Hedge
FurnitureType LongDinnerTable
FurnitureType Mailbox
FurnitureType MapleTree
FurnitureType ModernBed
FurnitureType ModernComputer
FurnitureType ModernFridge
FurnitureType ModernSingleBed
FurnitureType ModernSink
FurnitureType ModernStove
FurnitureType ModernTv
FurnitureType PaintBrush
FurnitureType Pot
FurnitureType PotPlant
FurnitureType PreparedFood
FurnitureType Puddle
FurnitureType SimpleBench
FurnitureType SimpleBookshelf
FurnitureType SimpleChair
FurnitureType SimpleCounter
FurnitureType SimpleDesk
FurnitureType SimpleDrawer
FurnitureType SimpleEasel
FurnitureType SimpleShower
FurnitureType SimpleToilet
FurnitureType SmallBush
FurnitureType SmallMirror
FurnitureType SmallPlant
FurnitureType Spanner
FurnitureType Sponge
FurnitureType SquareDinnerTable
IDictionary<String, FurnitureType> Types A list of all available furniture types. Register furniture types using TinyLife.Objects.FurnitureType.Register(TinyLife.Objects.FurnitureType.TypeSettings).
FurnitureType UnpreparedFood
FurnitureType YarnBox

Static Methods

Return Name Summary
void DrawColumns ( Map, Vector2, Direction2, SpriteBatch, Vector2, TextureRegion, Color, Single, Point, Boolean, Furniture, ObjectSpot, Single, Boolean, Boolean, Boolean ) Draws the given texture region in columns, which allows for depth calculation in isometric view to be possible. Bigger objects, including all furniture, are drawn in this matter.
Rectangle GetCoveredTiles ( Vector2, Point ) Returns a rectangle that contains all of the tiles which intersect with the furniture when placed at the given position, with the given size.
TextureRegion GetTexture ( String ) Returns a MLEM.Textures.TextureRegion with the given name, based on all of the textures in the base game and all TinyLife.Mods.Mod.GetCustomFurnitureTextures textures.
Dictionary<Direction2, TextureRegion[]> GetTextures ( String, Int32 ) Create a dictionary of textures for all MLEM.Misc.Direction2Helper.Adjacent directions that have a texture registered for them. Textures are gathered using TinyLife.Mods.Mod.GetCustomFurnitureTextures, and textures need to be suffixed with the direction's string to be recognized. This method is used for furniture of all kinds.
FurnitureType Register ( TypeSettings )
void SlotIntoObjectSpot ( Furniture, ObjectSpot, Point, out Vector2, out Point ) A helper method that modifies and to make an object look like it is slotted into the given TinyLife.Objects.ObjectSpot