Skip to content

Commit 0d8cb84

Browse files
committedMar 16, 2018
Lua_api.txt: Split long lines part 5, fix hardware colouring docs
1 parent 19c993b commit 0d8cb84

File tree

1 file changed

+209
-150
lines changed

1 file changed

+209
-150
lines changed
 

Diff for: ‎doc/lua_api.txt

+209-150
Original file line numberDiff line numberDiff line change
@@ -580,25 +580,25 @@ index of the pixel to use.
580580
When registering a node, set the item definition's `palette` field to
581581
a texture. You can also use texture modifiers.
582582
The node's color depends on its `param2`, so you also must set an
583-
appropriate `drawtype`:
583+
appropriate `paramtype2`:
584584

585-
* `drawtype = "color"` for nodes which use their full `param2` for
585+
* `paramtype2 = "color"` for nodes which use their full `param2` for
586586
palette indexing. These nodes can have 256 different colors.
587587
The palette should contain 256 pixels.
588-
* `drawtype = "colorwallmounted"` for nodes which use the first
588+
* `paramtype2 = "colorwallmounted"` for nodes which use the first
589589
five bits (most significant) of `param2` for palette indexing.
590590
The remaining three bits are describing rotation, as in `wallmounted`
591-
draw type. Division by 8 yields the palette index (without stretching the
591+
drawtype. Division by 8 yields the palette index (without stretching the
592592
palette). These nodes can have 32 different colors, and the palette
593593
should contain 32 pixels.
594594
Examples:
595595
* `param2 = 17` is 2 * 8 + 1, so the rotation is 1 and the third (= 2 + 1)
596596
pixel will be picked from the palette.
597597
* `param2 = 35` is 4 * 8 + 3, so the rotation is 3 and the fifth (= 4 + 1)
598598
pixel will be picked from the palette.
599-
* `drawtype = "colorfacedir"` for nodes which use the first
599+
* `paramtype2 = "colorfacedir"` for nodes which use the first
600600
three bits of `param2` for palette indexing. The remaining
601-
five bits are describing rotation, as in `facedir` draw type.
601+
five bits are describing rotation, as in `facedir` drawtype.
602602
Division by 32 yields the palette index (without stretching the
603603
palette). These nodes can have 8 different colors, and the
604604
palette should contain 8 pixels.
@@ -4302,61 +4302,80 @@ table.
43024302
### `VoxelManip`
43034303

43044304
#### About VoxelManip
4305-
VoxelManip is a scripting interface to the internal 'Map Voxel Manipulator' facility. The purpose of
4306-
this object is for fast, low-level, bulk access to reading and writing Map content. As such, setting
4307-
map nodes through VoxelManip will lack many of the higher level features and concepts you may be used
4308-
to with other methods of setting nodes. For example, nodes will not have their construction and
4309-
destruction callbacks run, and no rollback information is logged.
4310-
4311-
It is important to note that VoxelManip is designed for speed, and *not* ease of use or flexibility.
4312-
If your mod requires a map manipulation facility that will handle 100% of all edge cases, or the use
4313-
of high level node placement features, perhaps `minetest.set_node()` is better suited for the job.
4314-
4315-
In addition, VoxelManip might not be faster, or could even be slower, for your specific use case.
4316-
VoxelManip is most effective when setting very large areas of map at once - for example, if only
4317-
setting a 5x5x5 node area, a `minetest.set_node()` loop may be more optimal. Always profile code
4318-
using both methods of map manipulation to determine which is most appropriate for your usage.
4305+
VoxelManip is a scripting interface to the internal 'Map Voxel Manipulator'
4306+
facility. The purpose of this object is for fast, low-level, bulk access to
4307+
reading and writing Map content. As such, setting map nodes through VoxelManip
4308+
will lack many of the higher level features and concepts you may be used to
4309+
with other methods of setting nodes. For example, nodes will not have their
4310+
construction and destruction callbacks run, and no rollback information is
4311+
logged.
4312+
4313+
It is important to note that VoxelManip is designed for speed, and *not* ease
4314+
of use or flexibility. If your mod requires a map manipulation facility that
4315+
will handle 100% of all edge cases, or the use of high level node placement
4316+
features, perhaps `minetest.set_node()` is better suited for the job.
4317+
4318+
In addition, VoxelManip might not be faster, or could even be slower, for your
4319+
specific use case. VoxelManip is most effective when setting large areas of map
4320+
at once - for example, if only setting a 3x3x3 node area, a
4321+
`minetest.set_node()` loop may be more optimal. Always profile code using both
4322+
methods of map manipulation to determine which is most appropriate for your
4323+
usage.
4324+
4325+
A recent simple test of setting cubic areas showed that `minetest.set_node()`
4326+
is faster than a VoxelManip for a 3x3x3 node cube or smaller.
43194327

43204328
#### Using VoxelManip
43214329
A VoxelManip object can be created any time using either:
43224330
`VoxelManip([p1, p2])`, or `minetest.get_voxel_manip([p1, p2])`.
43234331

4324-
If the optional position parameters are present for either of these routines, the specified region
4325-
will be pre-loaded into the VoxelManip object on creation. Otherwise, the area of map you wish to
4326-
manipulate must first be loaded into the VoxelManip object using `VoxelManip:read_from_map()`.
4332+
If the optional position parameters are present for either of these routines,
4333+
the specified region will be pre-loaded into the VoxelManip object on creation.
4334+
Otherwise, the area of map you wish to manipulate must first be loaded into the
4335+
VoxelManip object using `VoxelManip:read_from_map()`.
43274336

4328-
Note that `VoxelManip:read_from_map()` returns two position vectors. The region formed by these
4329-
positions indicate the minimum and maximum (respectively) positions of the area actually loaded in
4330-
the VoxelManip, which may be larger than the area requested. For convenience, the loaded area
4331-
coordinates can also be queried any time after loading map data with `VoxelManip:get_emerged_area()`.
4337+
Note that `VoxelManip:read_from_map()` returns two position vectors. The region
4338+
formed by these positions indicate the minimum and maximum (respectively)
4339+
positions of the area actually loaded in the VoxelManip, which may be larger
4340+
than the area requested. For convenience, the loaded area coordinates can also
4341+
be queried any time after loading map data with `VoxelManip:get_emerged_area()`.
43324342

4333-
Now that the VoxelManip object is populated with map data, your mod can fetch a copy of this data
4334-
using either of two methods. `VoxelManip:get_node_at()`, which retrieves an individual node in a
4335-
MapNode formatted table at the position requested is the simplest method to use, but also the slowest.
4343+
Now that the VoxelManip object is populated with map data, your mod can fetch a
4344+
copy of this data using either of two methods. `VoxelManip:get_node_at()`,
4345+
which retrieves an individual node in a MapNode formatted table at the position
4346+
requested is the simplest method to use, but also the slowest.
43364347

4337-
Nodes in a VoxelManip object may also be read in bulk to a flat array table using:
4338-
`VoxelManip:get_data()` for node content (in Content ID form, see section 'Content IDs'),
4339-
`VoxelManip:get_light_data()` for node light levels, and
4340-
`VoxelManip:get_param2_data()` for the node type-dependent "param2" values.
4348+
Nodes in a VoxelManip object may also be read in bulk to a flat array table
4349+
using:
4350+
4351+
* `VoxelManip:get_data()` for node content (in Content ID form, see section
4352+
'Content IDs'),
4353+
* `VoxelManip:get_light_data()` for node light levels, and
4354+
* `VoxelManip:get_param2_data()` for the node type-dependent "param2" values.
43414355

43424356
See section 'Flat array format' for more details.
43434357

4344-
It is very important to understand that the tables returned by any of the above three functions
4345-
represent a snapshot of the VoxelManip's internal state at the time of the call. This copy of the
4346-
data will *not* magically update itself if another function modifies the internal VoxelManip state.
4347-
Any functions that modify a VoxelManip's contents work on the VoxelManip's internal state unless
4348-
otherwise explicitly stated.
4358+
It is very important to understand that the tables returned by any of the above
4359+
three functions represent a snapshot of the VoxelManip's internal state at the
4360+
time of the call. This copy of the data will not magically update itself if
4361+
another function modifies the internal VoxelManip state.
4362+
Any functions that modify a VoxelManip's contents work on the VoxelManip's
4363+
internal state unless otherwise explicitly stated.
4364+
4365+
Once the bulk data has been edited to your liking, the internal VoxelManip
4366+
state can be set using:
43494367

4350-
Once the bulk data has been edited to your liking, the internal VoxelManip state can be set using:
4351-
`VoxelManip:set_data()` for node content (in Content ID form, see section 'Content IDs'),
4352-
`VoxelManip:set_light_data()` for node light levels, and
4353-
`VoxelManip:set_param2_data()` for the node type-dependent `param2` values.
4368+
* `VoxelManip:set_data()` for node content (in Content ID form, see section
4369+
'Content IDs'),
4370+
* `VoxelManip:set_light_data()` for node light levels, and
4371+
* `VoxelManip:set_param2_data()` for the node type-dependent `param2` values.
43544372

4355-
The parameter to each of the above three functions can use any table at all in the same flat array
4356-
format as produced by `get_data()` et al. and is *not required* to be a table retrieved from `get_data()`.
4373+
The parameter to each of the above three functions can use any table at all in
4374+
the same flat array format as produced by `get_data()` etc. and is not required
4375+
to be a table retrieved from `get_data()`.
43574376

4358-
Once the internal VoxelManip state has been modified to your liking, the changes can be committed back
4359-
to the map by calling `VoxelManip:write_to_map()`.
4377+
Once the internal VoxelManip state has been modified to your liking, the
4378+
changes can be committed back to the map by calling `VoxelManip:write_to_map()`
43604379

43614380

43624381
##### Flat array format
@@ -4365,8 +4384,8 @@ Let
43654384
`Ny = p2.Y - p1.Y + 1`, and
43664385
`Nz = p2.Z - p1.Z + 1`.
43674386

4368-
Then, for a loaded region of p1..p2, this array ranges from `1` up to and including the value of
4369-
the expression `Nx * Ny * Nz`.
4387+
Then, for a loaded region of p1..p2, this array ranges from `1` up to and
4388+
including the value of the expression `Nx * Ny * Nz`.
43704389

43714390
Positions offset from p1 are present in the array with the format of:
43724391

@@ -4388,75 +4407,93 @@ and the array index for a position p contained completely in p1..p2 is:
43884407

43894408
`(p.Z - p1.Z) * Ny * Nx + (p.Y - p1.Y) * Nx + (p.X - p1.X) + 1`
43904409

4391-
Note that this is the same "flat 3D array" format as `PerlinNoiseMap:get3dMap_flat()`.
4392-
VoxelArea objects (see section 'VoxelArea') can be used to simplify calculation of the index
4393-
for a single point in a flat VoxelManip array.
4410+
Note that this is the same "flat 3D array" format as
4411+
`PerlinNoiseMap:get3dMap_flat()`.
4412+
VoxelArea objects (see section 'VoxelArea') can be used to simplify calculation
4413+
of the index for a single point in a flat VoxelManip array.
43944414

43954415
##### Content IDs
4396-
A Content ID is a unique integer identifier for a specific node type. These IDs are used by VoxelManip
4397-
in place of the node name string for `VoxelManip:get_data()` and `VoxelManip:set_data()`. You can use
4398-
`minetest.get_content_id()` to look up the Content ID for the specified node name, and
4399-
`minetest.get_name_from_content_id()` to look up the node name string for a given Content ID.
4400-
After registration of a node, its Content ID will remain the same throughout execution of the mod.
4416+
A Content ID is a unique integer identifier for a specific node type.
4417+
These IDs are used by VoxelManip in place of the node name string for
4418+
`VoxelManip:get_data()` and `VoxelManip:set_data()`. You can use
4419+
`minetest.get_content_id()` to look up the Content ID for the specified node
4420+
name, and `minetest.get_name_from_content_id()` to look up the node name string
4421+
for a given Content ID.
4422+
After registration of a node, its Content ID will remain the same throughout
4423+
execution of the mod.
44014424
Note that the node being queried needs to have already been been registered.
44024425

44034426
The following builtin node types have their Content IDs defined as constants:
44044427

4405-
* `minetest.CONTENT_UNKNOWN`: ID for "unknown" nodes
4406-
* `minetest.CONTENT_AIR`: ID for "air" nodes
4407-
* `minetest.CONTENT_IGNORE`: ID for "ignore" nodes
4428+
* `minetest.CONTENT_UNKNOWN`: ID for "unknown" nodes
4429+
* `minetest.CONTENT_AIR`: ID for "air" nodes
4430+
* `minetest.CONTENT_IGNORE`: ID for "ignore" nodes
44084431

44094432
##### Mapgen VoxelManip objects
4410-
Inside of `on_generated()` callbacks, it is possible to retrieve the same VoxelManip object used by the
4411-
core's Map Generator (commonly abbreviated Mapgen). Most of the rules previously described still apply
4412-
but with a few differences:
4413-
4414-
* The Mapgen VoxelManip object is retrieved using: `minetest.get_mapgen_object("voxelmanip")`
4415-
* This VoxelManip object already has the region of map just generated loaded into it; it's not necessary
4416-
to call `VoxelManip:read_from_map()` before using a Mapgen VoxelManip.
4417-
* The `on_generated()` callbacks of some mods may place individual nodes in the generated area using
4418-
non-VoxelManip map modification methods. Because the same Mapgen VoxelManip object is passed through
4419-
each `on_generated()` callback, it becomes necessary for the Mapgen VoxelManip object to maintain
4420-
consistency with the current map state. For this reason, calling any of the following functions:
4433+
Inside of `on_generated()` callbacks, it is possible to retrieve the same
4434+
VoxelManip object used by the core's Map Generator (commonly abbreviated
4435+
Mapgen). Most of the rules previously described still apply but with a few
4436+
differences:
4437+
4438+
* The Mapgen VoxelManip object is retrieved using:
4439+
`minetest.get_mapgen_object("voxelmanip")`
4440+
* This VoxelManip object already has the region of map just generated loaded
4441+
into it; it's not necessary to call `VoxelManip:read_from_map()` before using
4442+
a Mapgen VoxelManip.
4443+
* The `on_generated()` callbacks of some mods may place individual nodes in the
4444+
generated area using non-VoxelManip map modification methods. Because the
4445+
same Mapgen VoxelManip object is passed through each `on_generated()`
4446+
callback, it becomes necessary for the Mapgen VoxelManip object to maintain
4447+
consistency with the current map state. For this reason, calling any of the
4448+
following functions:
44214449
`minetest.add_node()`, `minetest.set_node()`, or `minetest.swap_node()`
4422-
will also update the Mapgen VoxelManip object's internal state active on the current thread.
4423-
* After modifying the Mapgen VoxelManip object's internal buffer, it may be necessary to update lighting
4424-
information using either: `VoxelManip:calc_lighting()` or `VoxelManip:set_lighting()`.
4450+
will also update the Mapgen VoxelManip object's internal state active on the
4451+
current thread.
4452+
* After modifying the Mapgen VoxelManip object's internal buffer, it may be
4453+
necessary to update lighting information using either:
4454+
`VoxelManip:calc_lighting()` or `VoxelManip:set_lighting()`.
44254455

44264456
##### Other API functions operating on a VoxelManip
4427-
If any VoxelManip contents were set to a liquid node, `VoxelManip:update_liquids()` must be called
4428-
for these liquid nodes to begin flowing. It is recommended to call this function only after having
4429-
written all buffered data back to the VoxelManip object, save for special situations where the modder
4430-
desires to only have certain liquid nodes begin flowing.
4457+
If any VoxelManip contents were set to a liquid node,
4458+
`VoxelManip:update_liquids()` must be called for these liquid nodes to begin
4459+
flowing. It is recommended to call this function only after having written all
4460+
buffered data back to the VoxelManip object, save for special situations where
4461+
the modder desires to only have certain liquid nodes begin flowing.
44314462

4432-
The functions `minetest.generate_ores()` and `minetest.generate_decorations()` will generate all
4433-
registered decorations and ores throughout the full area inside of the specified VoxelManip object.
4463+
The functions `minetest.generate_ores()` and `minetest.generate_decorations()`
4464+
will generate all registered decorations and ores throughout the full area
4465+
inside of the specified VoxelManip object.
44344466

4435-
`minetest.place_schematic_on_vmanip()` is otherwise identical to `minetest.place_schematic()`,
4436-
except instead of placing the specified schematic directly on the map at the specified position, it
4437-
will place the schematic inside of the VoxelManip.
4467+
`minetest.place_schematic_on_vmanip()` is otherwise identical to
4468+
`minetest.place_schematic()`, except instead of placing the specified schematic
4469+
directly on the map at the specified position, it will place the schematic
4470+
inside the VoxelManip.
44384471

44394472
##### Notes
4440-
* Attempting to read data from a VoxelManip object before map is read will result in a zero-length
4441-
array table for `VoxelManip:get_data()`, and an "ignore" node at any position for
4442-
`VoxelManip:get_node_at()`.
4443-
* If either a region of map has not yet been generated or is out-of-bounds of the map, that region is
4444-
filled with "ignore" nodes.
4445-
* Other mods, or the core itself, could possibly modify the area of map currently loaded into a VoxelManip
4446-
object. With the exception of Mapgen VoxelManips (see above section), the internal buffers are not
4447-
updated. For this reason, it is strongly encouraged to complete the usage of a particular VoxelManip
4448-
object in the same callback it had been created.
4449-
* If a VoxelManip object will be used often, such as in an `on_generated()` callback, consider passing
4450-
a file-scoped table as the optional parameter to `VoxelManip:get_data()`, which serves as a static
4451-
buffer the function can use to write map data to instead of returning a new table each call. This
4452-
greatly enhances performance by avoiding unnecessary memory allocations.
4473+
* Attempting to read data from a VoxelManip object before map is read will
4474+
result in a zero-length array table for `VoxelManip:get_data()`, and an
4475+
"ignore" node at any position for `VoxelManip:get_node_at()`.
4476+
* If either a region of map has not yet been generated or is out-of-bounds of
4477+
the map, that region is filled with "ignore" nodes.
4478+
* Other mods, or the core itself, could possibly modify the area of map
4479+
currently loaded into a VoxelManip object. With the exception of Mapgen
4480+
VoxelManips (see above section), the internal buffers are not updated. For
4481+
this reason, it is strongly encouraged to complete the usage of a particular
4482+
VoxelManip object in the same callback it had been created.
4483+
* If a VoxelManip object will be used often, such as in an `on_generated()`
4484+
callback, consider passing a file-scoped table as the optional parameter to
4485+
`VoxelManip:get_data()`, which serves as a static buffer the function can use
4486+
to write map data to instead of returning a new table each call. This greatly
4487+
enhances performance by avoiding unnecessary memory allocations.
44534488

44544489
#### Methods
4455-
* `read_from_map(p1, p2)`: Loads a chunk of map into the VoxelManip object containing
4456-
the region formed by `p1` and `p2`.
4490+
* `read_from_map(p1, p2)`: Loads a chunk of map into the VoxelManip object
4491+
containing the region formed by `p1` and `p2`.
44574492
* returns actual emerged `pmin`, actual emerged `pmax`
4458-
* `write_to_map([light])`: Writes the data loaded from the `VoxelManip` back to the map.
4459-
* **important**: data must be set using `VoxelManip:set_data()` before calling this
4493+
* `write_to_map([light])`: Writes the data loaded from the `VoxelManip` back to
4494+
the map.
4495+
* **important**: data must be set using `VoxelManip:set_data()` before
4496+
calling this.
44604497
* if `light` is true, then lighting is automatically recalculated.
44614498
The default value is true.
44624499
If `light` is false, no light calculations happen, and you should correct
@@ -4465,38 +4502,52 @@ will place the schematic inside of the VoxelManip.
44654502
more lighting bugs.
44664503
* `get_node_at(pos)`: Returns a `MapNode` table of the node currently loaded in
44674504
the `VoxelManip` at that position
4468-
* `set_node_at(pos, node)`: Sets a specific `MapNode` in the `VoxelManip` at that position
4469-
* `get_data([buffer])`: Retrieves the node content data loaded into the `VoxelManip` object
4505+
* `set_node_at(pos, node)`: Sets a specific `MapNode` in the `VoxelManip` at
4506+
that position.
4507+
* `get_data([buffer])`: Retrieves the node content data loaded into the
4508+
`VoxelManip` object.
44704509
* returns raw node data in the form of an array of node content IDs
4471-
* if the param `buffer` is present, this table will be used to store the result instead
4510+
* if the param `buffer` is present, this table will be used to store the
4511+
result instead.
44724512
* `set_data(data)`: Sets the data contents of the `VoxelManip` object
44734513
* `update_map()`: Does nothing, kept for compatibility.
4474-
* `set_lighting(light, [p1, p2])`: Set the lighting within the `VoxelManip` to a uniform value
4514+
* `set_lighting(light, [p1, p2])`: Set the lighting within the `VoxelManip` to
4515+
a uniform value.
44754516
* `light` is a table, `{day=<0...15>, night=<0...15>}`
4476-
* To be used only by a `VoxelManip` object from `minetest.get_mapgen_object`
4477-
* (`p1`, `p2`) is the area in which lighting is set;
4478-
defaults to the whole area if left out
4517+
* To be used only by a `VoxelManip` object from
4518+
`minetest.get_mapgen_object`.
4519+
* (`p1`, `p2`) is the area in which lighting is set, defaults to the whole
4520+
area if left out.
44794521
* `get_light_data()`: Gets the light data read into the `VoxelManip` object
4480-
* Returns an array (indices 1 to volume) of integers ranging from `0` to `255`
4481-
* Each value is the bitwise combination of day and night light values (`0` to `15` each)
4522+
* Returns an array (indices 1 to volume) of integers ranging from `0` to
4523+
`255`.
4524+
* Each value is the bitwise combination of day and night light values
4525+
(`0` to `15` each).
44824526
* `light = day + (night * 16)`
44834527
* `set_light_data(light_data)`: Sets the `param1` (light) contents of each node
4484-
in the `VoxelManip`
4528+
in the `VoxelManip`.
44854529
* expects lighting data in the same format that `get_light_data()` returns
4486-
* `get_param2_data([buffer])`: Gets the raw `param2` data read into the `VoxelManip` object
4487-
* Returns an array (indices 1 to volume) of integers ranging from `0` to `255`
4488-
* If the param `buffer` is present, this table will be used to store the result instead
4489-
* `set_param2_data(param2_data)`: Sets the `param2` contents of each node in the `VoxelManip`
4490-
* `calc_lighting([p1, p2], [propagate_shadow])`: Calculate lighting within the `VoxelManip`
4491-
* To be used only by a `VoxelManip` object from `minetest.get_mapgen_object`
4492-
* (`p1`, `p2`) is the area in which lighting is set; defaults to the whole area
4493-
if left out or nil
4494-
* `propagate_shadow` is an optional boolean deciding whether shadows in a generated
4495-
mapchunk above are propagated down into the mapchunk; defaults to `true` if left out
4530+
* `get_param2_data([buffer])`: Gets the raw `param2` data read into the
4531+
`VoxelManip` object.
4532+
* Returns an array (indices 1 to volume) of integers ranging from `0` to
4533+
`255`.
4534+
* If the param `buffer` is present, this table will be used to store the
4535+
result instead.
4536+
* `set_param2_data(param2_data)`: Sets the `param2` contents of each node in
4537+
the `VoxelManip`.
4538+
* `calc_lighting([p1, p2], [propagate_shadow])`: Calculate lighting within the
4539+
`VoxelManip`.
4540+
* To be used only by a `VoxelManip` object from
4541+
`minetest.get_mapgen_object`.
4542+
* (`p1`, `p2`) is the area in which lighting is set, defaults to the whole
4543+
area if left out or nil.
4544+
* `propagate_shadow` is an optional boolean deciding whether shadows in a
4545+
generated mapchunk above are propagated down into the mapchunk, defaults
4546+
to `true` if left out.
44964547
* `update_liquids()`: Update liquid flow
4497-
* `was_modified()`: Returns `true` or `false` if the data in the voxel manipulator
4498-
had been modified since the last read from map, due to a call to
4499-
`minetest.set_data()` on the loaded area elsewhere
4548+
* `was_modified()`: Returns `true` or `false` if the data in the voxel
4549+
manipulator had been modified since the last read from map, due to a call to
4550+
`minetest.set_data()` on the loaded area elsewhere.
45004551
* `get_emerged_area()`: Returns actual emerged minimum and maximum positions.
45014552

45024553
### `VoxelArea`
@@ -4506,18 +4557,24 @@ The coordinates are *inclusive*, like most other things in Minetest.
45064557

45074558
#### Methods
45084559
* `getExtent()`: returns a 3D vector containing the size of the area formed by
4509-
`MinEdge` and `MaxEdge`
4510-
* `getVolume()`: returns the volume of the area formed by `MinEdge` and `MaxEdge`
4511-
* `index(x, y, z)`: returns the index of an absolute position in a flat array starting at `1`
4560+
`MinEdge` and `MaxEdge`.
4561+
* `getVolume()`: returns the volume of the area formed by `MinEdge` and
4562+
`MaxEdge`.
4563+
* `index(x, y, z)`: returns the index of an absolute position in a flat array
4564+
starting at `1`.
45124565
* useful for things like `VoxelManip`, raw Schematic specifiers,
4513-
`PerlinNoiseMap:get2d`/`3dMap`, and so on
4566+
`PerlinNoiseMap:get2d`/`3dMap`, and so on.
45144567
* `indexp(p)`: same as above, except takes a vector
4515-
* `position(i)`: returns the absolute position vector corresponding to index `i`
4516-
* `contains(x, y, z)`: check if (`x`,`y`,`z`) is inside area formed by `MinEdge` and `MaxEdge`
4568+
* `position(i)`: returns the absolute position vector corresponding to index
4569+
`i`.
4570+
* `contains(x, y, z)`: check if (`x`,`y`,`z`) is inside area formed by
4571+
`MinEdge` and `MaxEdge`.
45174572
* `containsp(p)`: same as above, except takes a vector
45184573
* `containsi(i)`: same as above, except takes an index `i`
4519-
* `iter(minx, miny, minz, maxx, maxy, maxz)`: returns an iterator that returns indices
4520-
* from (`minx`,`miny`,`minz`) to (`maxx`,`maxy`,`maxz`) in the order of `[z [y [x]]]`
4574+
* `iter(minx, miny, minz, maxx, maxy, maxz)`: returns an iterator that returns
4575+
indices.
4576+
* from (`minx`,`miny`,`minz`) to (`maxx`,`maxy`,`maxz`) in the order of
4577+
`[z [y [x]]]`.
45214578
* `iterp(minp, maxp)`: same as above, except takes a vector
45224579

45234580
### `Settings`
@@ -4534,7 +4591,8 @@ It can be created via `Settings(filename)`.
45344591
* `set(key, value)`
45354592
* Setting names can't contain whitespace or any of `="{}#`.
45364593
* Setting values can't contain the sequence `\n"""`.
4537-
* Setting names starting with "secure." can't be set on the main settings object (`minetest.settings`).
4594+
* Setting names starting with "secure." can't be set on the main settings
4595+
object (`minetest.settings`).
45384596
* `set_bool(key, value)`
45394597
* See documentation for set() above.
45404598
* `set_np_group(key, value)`
@@ -4568,17 +4626,18 @@ It can be created via `Raycast(pos1, pos2, objects, liquids)` or
45684626

45694627
Mapgen objects
45704628
--------------
4571-
A mapgen object is a construct used in map generation. Mapgen objects can be used
4572-
by an `on_generate` callback to speed up operations by avoiding unnecessary
4573-
recalculations; these can be retrieved using the `minetest.get_mapgen_object()`
4574-
function. If the requested Mapgen object is unavailable, or `get_mapgen_object()`
4575-
was called outside of an `on_generate()` callback, `nil` is returned.
4629+
A mapgen object is a construct used in map generation. Mapgen objects can be
4630+
used by an `on_generate` callback to speed up operations by avoiding
4631+
unnecessary recalculations, these can be retrieved using the
4632+
`minetest.get_mapgen_object()` function. If the requested Mapgen object is
4633+
unavailable, or `get_mapgen_object()` was called outside of an `on_generate()`
4634+
callback, `nil` is returned.
45764635

45774636
The following Mapgen objects are currently available:
45784637

45794638
### `voxelmanip`
4580-
This returns three values; the `VoxelManip` object to be used, minimum and maximum
4581-
emerged position, in that order. All mapgens support this object.
4639+
This returns three values; the `VoxelManip` object to be used, minimum and
4640+
maximum emerged position, in that order. All mapgens support this object.
45824641

45834642
### `heightmap`
45844643
Returns an array containing the y coordinates of the ground levels of nodes in
@@ -4601,9 +4660,9 @@ Returns a table mapping requested generation notification types to arrays of
46014660
positions at which the corresponding generated structures are located within
46024661
the current chunk. To set the capture of positions of interest to be recorded
46034662
on generate, use `minetest.set_gen_notify()`.
4604-
For decorations, the returned positions are the ground surface 'place_on' nodes,
4605-
not the decorations themselves. A 'simple' type decoration is often 1 node above
4606-
the returned position and possibly displaced by 'place_offset_y'.
4663+
For decorations, the returned positions are the ground surface 'place_on'
4664+
nodes, not the decorations themselves. A 'simple' type decoration is often 1
4665+
node above the returned position and possibly displaced by 'place_offset_y'.
46074666

46084667
Possible fields of the table returned are:
46094668

@@ -4622,7 +4681,8 @@ Registered entities
46224681
-------------------
46234682
* Functions receive a "luaentity" as `self`:
46244683
* It has the member `.name`, which is the registered name `("mod:thing")`
4625-
* It has the member `.object`, which is an `ObjectRef` pointing to the object
4684+
* It has the member `.object`, which is an `ObjectRef` pointing to the
4685+
object.
46264686
* The original prototype stuff is visible directly via a metatable
46274687
* Callbacks:
46284688
* `on_activate(self, staticdata, dtime_s)`
@@ -4631,14 +4691,15 @@ Registered entities
46314691
be used for updating the entity state.
46324692
* `on_step(self, dtime)`
46334693
* Called on every server tick, after movement and collision processing.
4634-
`dtime` is usually 0.1 seconds, as per the `dedicated_server_step` setting
4635-
`in minetest.conf`.
4694+
`dtime` is usually 0.1 seconds, as per the `dedicated_server_step`
4695+
setting `in minetest.conf`.
46364696
* `on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)`
46374697
* Called when somebody punches the object.
46384698
* Note that you probably want to handle most punches using the
46394699
automatic armor group system.
46404700
* `puncher`: an `ObjectRef` (can be `nil`)
4641-
* `time_from_last_punch`: Meant for disallowing spamming of clicks (can be `nil`)
4701+
* `time_from_last_punch`: Meant for disallowing spamming of clicks
4702+
(can be `nil`).
46424703
* `tool_capabilities`: capability table of used tool (can be `nil`)
46434704
* `dir`: unit vector of direction of punch. Always defined. Points from
46444705
the puncher to the punched.
@@ -4652,9 +4713,6 @@ Registered entities
46524713

46534714
L-system trees
46544715
--------------
4655-
**Warning**
4656-
L-system generation currently creates lighting bugs in the form of mapblock-sized shadows.
4657-
Often these bugs appear as subtle shadows in water.
46584716

46594717
### Tree definition
46604718

@@ -4676,7 +4734,8 @@ Often these bugs appear as subtle shadows in water.
46764734
thin_branches, --boolean true -> use thin (1 node) branches
46774735
fruit, --string fruit node name
46784736
fruit_chance, --num chance (0-100) to replace leaves with fruit node
4679-
seed, --num random seed; if no seed is provided, the engine will create one
4737+
seed, --num random seed, if no seed is provided, the engine
4738+
will create one.
46804739
}
46814740

46824741
### Key for Special L-System Symbols used in Axioms

0 commit comments

Comments
 (0)
Please sign in to comment.