DMM
— Map Processing and Manipulation¶
- class DMM¶
The
DMM
class provides an extensive API for reading and modifying BYOND map files.DMM
instances are created with the following methods:- static from_file(filename: str | os.PathLike[str])¶
Read the map file from the filename referring to a “.dmm” file.
Once instantiated, the following properties and methods are available:
- property filepath: pathlib.Path¶
A Pathlib path pointing to the DMM’s original filename.
- save_to(filename: str | os.PathLike[str])¶
Save the map into the file filename.
- coords()¶
Return an iterator over all possible 3D coordinates.
- class Tile¶
Tile
objects returned fromDMM.tiledef()
can be read and operated upon with the following methods.- property area_path: Path¶
Returns the tile’s area. It is expected that only one
/area
is present on a tile.
- property turf_path: Path¶
Returns the tile’s turf. It is expected that only one
/turf
is present on a tile.
- find(prefix: str, exact=False) list[int] ¶
Returns the indexes of all the prefabs on the tile with the given prefix. If exact is
True
, then the prefab path must match exactly.
- only(prefix: str, exact=False) int | None ¶
Returns the index of the only prefab with the given prefix, or
None
if no such prefab exists. Raises an error if there is more than one prefab with the given prefix. If exact isTrue
, then the prefab path must match exactly.
Once the indexes of the prefabs you wish to work with are returned from
Tile.find()
orTile.only()
, they may be used to operate on the prefabs of the tile with the following methods.Prefabs¶
Every Tile is made up of an ordered list of prefabs. Each prefab corresponds to an atom on that tile’s definition, and has a path and optional set of varedits.
Avulto attempts to represent variable edit values with native Python values whenever possible. When a varedit is a type path, it is represented with a
Path
. When a varedit is a list, it is represented asDmlist
.Prefabs are always accessed via their index, which can be retrieved with
Tile.find()
orTile.only()
.Reading Prefab Data¶
Modifying Prefab Data¶