Room - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.World

Room Class

A room is an area on a Map that is surrounded by Wall objects

public class Room

Inheritance System.Object 🡒 Room

Fields

Room.Center Field

The position that is considered to be the center of this room.
This is the average of all of its covered Tiles, and the MapSection that this room is on is determined by this value.

public readonly Point Center;

Field Value

Microsoft.Xna.Framework.Point

Room.CoveredSections Field

A set of MapSection instances that are covered by this room

public readonly HashSet<MapSection> CoveredSections;

Field Value

System.Collections.Generic.HashSet<MapSection>

Room.Map Field

The map that this room is on

public readonly Map Map;

Field Value

Map

Room.Tiles Field

A set of Microsoft.Xna.Framework.Point positions on the Map that are contained in this room

public readonly HashSet<Point> Tiles;

Field Value

System.Collections.Generic.HashSet<Microsoft.Xna.Framework.Point>

Properties

Room.FullyRoofed Property

A property that stores whether this room is fully roofed, that is, whether all of its Tiles are covered by a Roof.
This property is evaluated automatically in Validate().

public bool FullyRoofed { get; set; }

Property Value

System.Boolean

Methods

Room.GetConnectedRooms(Person) Method

Returns a set of Room objects which are connected to this room.
A connected room is a room that is directly adjacent, and that a Person can walk into through an Opening.

public System.Collections.Generic.IEnumerable<TinyLife.World.Room> GetConnectedRooms(TinyLife.Objects.Person person);

Parameters

person Person

Returns

System.Collections.Generic.IEnumerable<Room>
A set of connected rooms

Room.GetDecorativeRating() Method

Returns the combined decorative rating of all of the Furniture in this room.
This method uses the DecorativeRating function.

public int GetDecorativeRating();

Returns

System.Int32
The combined decorative rating

Room.GetLights() Method

Returns all of the Light instances that are contained in this room

public System.Collections.Generic.IEnumerable<TinyLife.Objects.Light> GetLights();

Returns

System.Collections.Generic.IEnumerable<Light>
All of the lights in this room

Room.GetObjects<T>() Method

Returns all of the MapObject instances that are contained in this room

public System.Collections.Generic.IEnumerable<T> GetObjects<T>()
    where T : TinyLife.Objects.MapObject;

Type parameters

T

Returns

System.Collections.Generic.IEnumerable<T>
All of the objects in this room

Room.GetWalls(bool) Method

Returns all of the Wall instances that are border walls or internal walls of this room.
An internal wall is a wall for which both sides are contained in the room, rather than just one.

public System.Collections.Generic.IEnumerable<(TinyLife.World.Wall,int)> GetWalls(bool borderOnly);

Parameters

borderOnly System.Boolean
Whether to return border walls only, or include internal walls

Returns

System.Collections.Generic.IEnumerable<<Wall,System.Int32>>
A set of walls and their included sides of this room

Room.IsSameRoom(ICollection<Point>) Method

Returns whether this room has the same covered Tiles as the given collection

public bool IsSameRoom(System.Collections.Generic.ICollection<Microsoft.Xna.Framework.Point> tiles);

Parameters

tiles System.Collections.Generic.ICollection<Microsoft.Xna.Framework.Point>
The tiles to query

Returns

System.Boolean
true if the covered tiles are the same, false otherwise

Room.Validate() Method

This method is called in ValidateRooms(Point) to ensure that this room is still valid

public bool Validate();

Returns

System.Boolean
false if the object is not valid, true otherwise