Mapgen objects

From Minetest Developer Wiki
Revision as of 16:14, 13 May 2019 by Wuzzy (talk | contribs) (Add UnofficialLua warning)
Jump to navigation Jump to search
Mbox warning.png This page contains unofficial, low-quality Lua API documentation and is likely to be outdated or wrong. Do not rely on it!
For the official and up-to-date documentation, see Lua API Documentation.
Mbox warning.png This page has been proposed for deletion for the following reason: "Contains unofficial and potentially outdated, redundant and inconsistent Lua API information"
If you don't think that this page should be deleted, please explain why on the talk page.

A mapgen object is a construct used in map generation. Mapgen objects can be used by an `on_generate` callback to speed up operations by avoiding unnecessary recalculations; these can be retrieved using the `minetest.get_mapgen_object()` function. If the requested Mapgen object is unavailable, or `get_mapgen_object()` was called outside of an `on_generate()` callback, `nil` is returned.

voxelmanip

This returns three values; the `VoxelManip` object to be used, minimum and maximum emerged position, in that order. All mapgens support this object.
Currently the emerged positions contain a mapblock outside the field of minp and maxp in every direction.

heightmap

Returns an array containing the y coordinates of the ground levels of nodes in the most recently generated chunk by the current mapgen.

biomemap

Returns an array containing the biome IDs of nodes in the most recently generated chunk by the current mapgen.

heatmap

Returns an array containing the temperature values of nodes in the most recently generated chunk by the current mapgen.

humiditymap

Returns an array containing the humidity values of nodes in the most recently generated chunk by the current mapgen.

gennotify

Returns a table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located at within the current chunk. To set the capture of positions of interest to be recorded on generate, use `minetest.set_gen_notify()`.

Possible fields of the table returned are:

  • `dungeon`
  • `temple`
  • `cave_begin`
  • `cave_end`
  • `large_cave_begin`
  • `large_cave_end`
  • `decoration`

Decorations have a key in the format of `"decoration#id"`, where `id` is the numeric unique decoration ID.

Mbox important.png This article is incomplete.
Please help expand this article to include more useful information.