Table of Contents

Class MapSection

Namespace
TinyLife.World
Assembly
Tiny Life.dll

A map section is a small area in a Map that actually contains the area's objects. A map section is always SizexSize tiles large.

[DataContract]
public class MapSection : JsonTypeSafeGenericDataHolder, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
MapSection
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

MapSection(Map, Point)

Creates a new map section on the given map, with the given section position. Also fills this map's tile array with the Grass tile.

public MapSection(Map map, Point sectionPos)

Parameters

map Map

The map

sectionPos Point

The section coordinates

Fields

Bleed

A constant value that determines the radius of how many sections (in addition to its own section) a Room or Roof can span. This value is used by GetRoom(Point, int), GetRoofs(RectangleF) and GetRoof(Point, int) to query additional sections. This value is set to 2.

public const int Bleed = 2

Field Value

int

SectionPos

The position, in section coordinates, of this section on the map.

[DataMember]
public readonly Point SectionPos

Field Value

Point

Size

The constant size of each map section. This value is set to 8.

public const int Size = 8

Field Value

int

Properties

OtherFloorsWithTiles

Returns a set of floors that also have tiles on them, in addition to the ground floor (or the zeroth floor).

public ICollection<int> OtherFloorsWithTiles { get; }

Property Value

ICollection<int>

Pos

The position, in tile coordinates, of this section's top left corner.

public Point Pos { get; }

Property Value

Point

Methods

GetAllTiles()

Returns a set of all the tiles in this map section, including all tiles on the ground floor and all additional nonnull tiles on floors above.

public IEnumerable<(Point Pos, int Floor, Tile Tile)> GetAllTiles()

Returns

IEnumerable<(Point Pos, int Floor, Tile Tile)>

A set of all tiles in this section.

Validate()

This method is called when this object is loaded from disk. When called on a map section, each of its MapObject instances is validated.

public void Validate()

ValidateEarly(Map)

Validates this map section early, setting its map, and adding its objects to the appropriate collections, and validating the section's tiles. This method is called for all Map sections before Validate() is called for any sections.

public void ValidateEarly(Map map)

Parameters

map Map

The map that this section is on.