@@ -5005,7 +5005,8 @@ A VoxelManip object can be created any time using either:
50055005If the optional position parameters are present for either of these routines,
50065006the specified region will be pre-loaded into the VoxelManip object on creation.
50075007Otherwise, the area of map you wish to manipulate must first be loaded into the
5008- VoxelManip object using ` VoxelManip:read_from_map() ` .
5008+ VoxelManip object using ` VoxelManip:read_from_map() ` , or an empty one created
5009+ with ` VoxelManip:initialize() ` .
50095010
50105011Note that ` VoxelManip:read_from_map() ` returns two position vectors. The region
50115012formed by these positions indicate the minimum and maximum (respectively)
@@ -5016,14 +5017,14 @@ be queried any time after loading map data with `VoxelManip:get_emerged_area()`.
50165017Now that the VoxelManip object is populated with map data, your mod can fetch a
50175018copy of this data using either of two methods. ` VoxelManip:get_node_at() ` ,
50185019which retrieves an individual node in a MapNode formatted table at the position
5019- requested is the simplest method to use, but also the slowest.
5020+ requested. This is the simplest method to use, but also the slowest.
50205021
50215022Nodes in a VoxelManip object may also be read in bulk to a flat array table
50225023using:
50235024
50245025* ` VoxelManip:get_data() ` for node content (in Content ID form, see section
50255026 [ Content IDs] ),
5026- * ` VoxelManip:get_light_data() ` for node light levels, and
5027+ * ` VoxelManip:get_light_data() ` for node param (usually light levels) , and
50275028* ` VoxelManip:get_param2_data() ` for the node type-dependent "param2" values.
50285029
50295030See section [ Flat array format] for more details.
@@ -5038,17 +5039,16 @@ internal state unless otherwise explicitly stated.
50385039Once the bulk data has been edited to your liking, the internal VoxelManip
50395040state can be set using:
50405041
5041- * ` VoxelManip:set_data() ` for node content (in Content ID form, see section
5042- [ Content IDs] ),
5043- * ` VoxelManip:set_light_data() ` for node light levels, and
5044- * ` VoxelManip:set_param2_data() ` for the node type-dependent ` param2 ` values.
5042+ * ` VoxelManip:set_data() ` or
5043+ * ` VoxelManip:set_light_data() ` or
5044+ * ` VoxelManip:set_param2_data() `
50455045
50465046The parameter to each of the above three functions can use any table at all in
50475047the same flat array format as produced by ` get_data() ` etc. and is not required
50485048to be a table retrieved from ` get_data() ` .
50495049
50505050Once the internal VoxelManip state has been modified to your liking, the
5051- changes can be committed back to the map by calling ` VoxelManip:write_to_map() `
5051+ changes can be committed back to the map by calling ` VoxelManip:write_to_map() ` .
50525052
50535053### Flat array format
50545054
@@ -5180,15 +5180,22 @@ inside the VoxelManip.
51805180Methods
51815181-------
51825182
5183- * ` read_from_map(p1, p2) ` : Loads a chunk of map into the VoxelManip object
5183+ * ` read_from_map(p1, p2) ` : Loads a part of the map into the VoxelManip object
51845184 containing the region formed by ` p1 ` and ` p2 ` .
5185- * returns actual emerged ` pmin ` , actual emerged ` pmax `
5185+ * returns actual emerged ` pmin ` , actual emerged ` pmax ` (MapBlock-aligned)
51865186 * Note that calling this multiple times will * add* to the area loaded in the
51875187 VoxelManip, and not reset it.
5188+ * ` initialize(p1, p2, [node]) ` : Clears and resizes the VoxelManip object to
5189+ comprise the region formed by ` p1 ` and ` p2 ` .
5190+ * ** No data** is read from the map, so you can use this to treat ` VoxelManip `
5191+ objects as general containers of node data.
5192+ * ` node ` : if present the data will be filled with this node; if not it will
5193+ be uninitialized
5194+ * returns actual emerged ` pmin ` , actual emerged ` pmax ` (MapBlock-aligned)
5195+ * (introduced in 5.13.0)
51885196* ` write_to_map([light]) ` : Writes the data loaded from the ` VoxelManip ` back to
51895197 the map.
5190- * ** important** : data must be set using ` VoxelManip:set_data() ` before
5191- calling this.
5198+ * ** important** : you should call ` set_data() ` before this, or nothing will change.
51925199 * if ` light ` is true, then lighting is automatically recalculated.
51935200 The default value is true.
51945201 If ` light ` is false, no light calculations happen, and you should correct
@@ -5249,6 +5256,8 @@ Methods
52495256 where the engine will keep the map and the VM in sync automatically.
52505257 * Note: this doesn't do what you think it does and is subject to removal. Don't use it!
52515258* ` get_emerged_area() ` : Returns actual emerged minimum and maximum positions.
5259+ * "Emerged" does not imply that this region was actually loaded from the map,
5260+ if ` initialize() ` has been used.
52525261* ` close() ` : Frees the data buffers associated with the VoxelManip object.
52535262 It will become empty.
52545263 * Since Lua's garbage collector is not aware of the potentially significant
0 commit comments