![]() |
tModLoader v2024.07
A mod to make and play Terraria mods
|
Used during world generation to track and check important world generation features to prevent overlap. Access this via GenVars.structures. The AddProtectedStructure(Rectangle, int) method is used to indicate an area of the world to be protected from other world generation code. The CanPlace(Rectangle, int) method will check if the designated area is free from protected structures as well as any tiles that are not TileID.Sets.GeneralPlacementTiles. This is used to find an area that is unused. It is up to modders to properly use StructureMap to both mark areas as occupied by structures and check for areas free of existing structures. The Structure Map section of the World Generation wiki pagehas more information and useful visualizations. More...
Public Member Functions | |
void | AddProtectedStructure (Rectangle area, int padding=0) |
Adds an area of the world to the protected structures listing to be protected from other world generation code. Use this after placing a structure if you do not wish other world generation code to overlap with it. | |
void | AddStructure (Rectangle area, int padding=0) |
Unused, use AddProtectedStructure(Rectangle, int) instead. | |
bool | CanPlace (Rectangle area, bool[] validTiles, int padding=0) |
Similar to CanPlace(Rectangle, int), except instead of using TileID.Sets.GeneralPlacementTiles the set of valid tiles to overwrite are passed in. Typically this is used with a copy of GeneralPlacementTiles that is changed slightly to allow or disallow some specific tiles. | |
bool | CanPlace (Rectangle area, int padding=0) |
Checks if the provided tile coordinate area padded by the padding is free from protected structures and tiles that are not TileID.Sets.GeneralPlacementTiles. Use this to find a suitable place for placing a structure feature free from any existing structures or protected tile, then use AddProtectedStructure(Rectangle, int) after placing a structure. | |
Rectangle | GetBoundingBox () |
void | Reset () |
Used during world generation to track and check important world generation features to prevent overlap. Access this via GenVars.structures.
The AddProtectedStructure(Rectangle, int) method is used to indicate an area of the world to be protected from other world generation code.
The CanPlace(Rectangle, int) method will check if the designated area is free from protected structures as well as any tiles that are not TileID.Sets.GeneralPlacementTiles. This is used to find an area that is unused.
It is up to modders to properly use StructureMap to both mark areas as occupied by structures and check for areas free of existing structures.
The Structure Map section of the World Generation wiki page
has more information and useful visualizations.