Skip to content

MultiStructureGenerator (3.0)

ScalarVector edited this page Mar 11, 2025 · 2 revisions

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.

Methods

IsInBounds

public static bool IsInBounds(MultiStructureData data, int index, Point16 pos)

Summary

Helper to check bounds on a generation call. You can also use this to check the bounds of your own structure.

Parameters

  • 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.

Returns

  • If the structure is in bounds or not.

IsInBounds

public static bool IsInBounds(string path, Mod mod, int index, Point16 pos, bool fullPath = false)

Summary

Helper to check bounds on a generation call. You can also use this to check the bounds of your own structure.

Parameters

  • 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.

Returns

  • If the structure is in bounds or not.

GetStructureDimensions

public static Point16 GetStructureDimensions(string path, Mod mod, int index, bool fullPath = false)

Summary

Gets the dimensions (width and height) of a structure in a multi-structure.

Parameters

  • 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.

GetStructureCount

public static int GetStructureCount(string path, Mod mod, bool fullPath = false)

Summary

Gets the number of structures inside a multi-structure file.

Parameters

  • 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.

Returns

  • The number of structures in the file.

GetMultiStructureData

public static MultiStructureData GetMultiStructureData(string path, Mod mod, bool fullPath = false)

Summary

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.

Parameters

  • 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.

Returns

  • The MultiStructureData associated with the desired file.

Exceptions

  • FileNotFoundException

GenerateMultistructureRandom

public static void GenerateMultistructureRandom(string path, Point16 pos, Mod mod, bool fullPath = false, bool ignoreNull = false, GenFlags flags = GenFlags.None)

Summary

This method generates a random structure from a multi-structure file.

Parameters

  • 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. See GenFlags.

GenerateMultistructureSpecific

public static void GenerateMultistructureSpecific(string path, int index, Point16 pos, Mod mod, bool fullPath = false, bool ignoreNull = false, GenFlags flags = GenFlags.None)

Summary

Generates a specific structure from a multi-structure file.

Parameters

  • 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. See GenFlags.

Clone this wiki locally