-
Notifications
You must be signed in to change notification settings - Fork 6
Generator (3.0)
In this class you will find various utilities related to generating structures and getting important information from them such as their dimensions.
public static bool IsInBounds(StructureData data, 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 StructureData to check. -
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, 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 structure file. -
mod
: The mod to search for the structure file in. -
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, bool fullPath = false)
Gets the dimensions (width and height) of a 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. -
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 StructureData GetStructureData(string path, Mod mod, bool fullPath = false)
Gets the StructureData for a given path in a given mod (or absolute path if fullPath is true). Will attempt to retrieve from the StructureData cache first if possible before doing I/O.
-
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. -
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 StructureData associated with the desired file.
FileNotFoundException
public static void GenerateStructure(string path, Point16 pos, Mod mod, bool fullPath = false, bool ignoreNull = false, GenFlags flags = GenFlags.None)
This method generates a structure from a structure file.
-
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"). -
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 GenerateFromData(StructureData data, Point16 pos, bool ignoreNull = false, GenFlags flags = GenFlags.None)
Directly generates a given StructureData into the world. Use this directly if you have a StructureData object in memory you want to generate from.
-
data
: The StructureData to generate. -
pos
: The position in the world to place the top-left of the structure, in tile coordinates. -
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
.