-
Notifications
You must be signed in to change notification settings - Fork 7
MultiStructureGenerator (3.0)
In this class, you will find various utilities related to generating multi-structures and obtaining important information from them, such as their dimensions or structure count.
public static bool IsInBounds(MultiStructureData data, int index, Point16 pos)Helper to check bounds on a generation call. You can also use this to check the bounds of your own structure.
-
data: The MultiStructureData to check. -
index: The index in the multi-structure to check the dimensions of. -
pos: The position to check from, this would be the top-left of the structure.
- If the structure is in bounds or not.
public static bool IsInBounds(string path, Mod mod, int index, Point16 pos, bool fullPath = false)Helper to check bounds on a generation call. You can also use this to check the bounds of your own structure.
-
path: The path to search for the multi-structure file. -
mod: The mod to search for the multi-structure file in. -
index: The index in the multi-structure to check the dimensions of. -
pos: The position to check from, this would be the top-left of the structure. -
fullPath: If the search path starts at the root of your file system(true) or the provided mod(false). This should usually be false.
- If the structure is in bounds or not.
public static Point16 GetStructureDimensions(string path, Mod mod, int index, bool fullPath = false)Gets the dimensions (width and height) of a structure in a multi-structure.
-
path: The path to search for the structure file. If it is in a mod, it should not include the mod's name (for example, it should be "structures/coolHouse", not "CoolHouseMod/structures/coolHouse"). -
mod: The mod to search for the structure file in. -
index: The index in the multi-structure to check the dimensions of. -
fullPath: If the search path starts at the root of your file system(true) or the provided mod(false). This should usually be false.
public static int GetStructureCount(string path, Mod mod, bool fullPath = false)Gets the number of structures inside a multi-structure file.
-
path: The path to search for the structure file. -
mod: The mod to search for the structure file in. -
fullPath: If the search path starts at the root of your file system(true) or the provided mod(false). This should usually be false.
- The number of structures in the file.
public static MultiStructureData GetMultiStructureData(string path, Mod mod, bool fullPath = false)Gets the MultiStructureData for a given path in a given mod (or absolute path if fullPath is true). Will attempt to retrieve from the MultiStructureData cache first if possible before doing I/O.
-
path: The path to search for the multi-structure file. -
mod: The mod to search for the multi-structure file in. -
fullPath: If the search path starts at the root of your file system(true) or the provided mod(false). This should usually be false.
- The MultiStructureData associated with the desired file.
FileNotFoundException
public static void GenerateMultistructureRandom(string path, Point16 pos, Mod mod, bool fullPath = false, bool ignoreNull = false, GenFlags flags = GenFlags.None)This method generates a random structure from a multi-structure file.
-
path: The path to search for the structure file. -
pos: The position in the world to place the top-left of the structure, in tile coordinates. -
mod: The mod to search for the structure file in. -
fullPath: If the search path starts at the root of your file system(true) or the provided mod(false). This should usually be false. -
ignoreNull: If the structure should respect the normal behavior of null tiles or not. This should never be true if you're using the mod as a DLL reference. -
flags: Allows you to pass flags for special generation behavior. SeeGenFlags.
public static void GenerateMultistructureSpecific(string path, int index, Point16 pos, Mod mod, bool fullPath = false, bool ignoreNull = false, GenFlags flags = GenFlags.None)Generates a specific structure from a multi-structure file.
-
path: The path to search for the structure file. -
index: The index of the structure to generate out of the multi-structure. -
pos: The position in the world to place the top-left of the structure, in tile coordinates. -
mod: The mod to search for the structure file in. -
fullPath: If the search path starts at the root of your file system(true) or the provided mod(false). This should usually be false. -
ignoreNull: If the structure should respect the normal behavior of null tiles or not. This should never be true if you're using the mod as a DLL reference. -
flags: Allows you to pass flags for special generation behavior. SeeGenFlags.
