[IDE Hint]: add VoxelManip & VoxelArea classes.
This commit is contained in:
@@ -1,5 +1,45 @@
|
||||
---@class VoxelArea
|
||||
--- @class VoxelArea
|
||||
--- A helper class for voxel areas.
|
||||
--- It can be created via `VoxelArea(pmin, pmax)` or
|
||||
--- `VoxelArea:new({MinEdge = pmin, MaxEdge = pmax})`.
|
||||
--- The coordinates are *inclusive*, like most other things in Minetest.
|
||||
VoxelArea = {}
|
||||
|
||||
---@param cuboid { MinEdge: any, MaxEdge: any }
|
||||
--- @param cuboid { MinEdge: any, MaxEdge: any }
|
||||
function VoxelArea:new(cuboid) end
|
||||
|
||||
--- returns a 3D vector containing the size of the area formed by
|
||||
--- `MinEdge` and `MaxEdge`.
|
||||
function VoxelArea:getExtent() end
|
||||
--- returns the volume of the area formed by `MinEdge` and
|
||||
--- `MaxEdge`.
|
||||
function VoxelArea:getVolume() end
|
||||
--- returns the index of an absolute position in a flat array
|
||||
--- starting at `1`.
|
||||
--- * `x`, `y` and `z` must be integers to avoid an incorrect index result.
|
||||
--- * The position (x, y, z) is not checked for being inside the area volume,
|
||||
--- being outside can cause an incorrect index result.
|
||||
--- * Useful for things like `VoxelManip`, raw Schematic specifiers,
|
||||
--- `PerlinNoiseMap:get2d`/`3dMap`, and so on.
|
||||
function VoxelArea:index(x, y, z) end
|
||||
--- same functionality as `index(x, y, z)` but takes a vector.
|
||||
--- * As with `index(x, y, z)`, the components of `p` must be integers, and `p`
|
||||
--- is not checked for being inside the area volume.
|
||||
function VoxelArea:indexp(p) end
|
||||
--- returns the absolute position vector corresponding to index
|
||||
--- `i`.
|
||||
function VoxelArea:position(i) end
|
||||
--- check if (`x`,`y`,`z`) is inside area formed by
|
||||
--- `MinEdge` and `MaxEdge`.
|
||||
function VoxelArea:contains(x, y, z) end
|
||||
--- same as above, except takes a vector
|
||||
function VoxelArea:containsp(p) end
|
||||
--- same as above, except takes an index `i`
|
||||
function VoxelArea:containsi(i) end
|
||||
--- returns an iterator that returns
|
||||
--- indices.
|
||||
--- * from (`minx`,`miny`,`minz`) to (`maxx`,`maxy`,`maxz`) in the order of
|
||||
--- `[z [y [x]]]`.
|
||||
function VoxelArea:iter(minx, miny, minz, maxx, maxy, maxz) end
|
||||
--- same as above, except takes a vector
|
||||
function VoxelArea:iterp(minp, maxp) end
|
||||
|
||||
87
classes/VoxelManip.lua
Normal file
87
classes/VoxelManip.lua
Normal file
@@ -0,0 +1,87 @@
|
||||
|
||||
--- @class VoxelManip
|
||||
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.7.0/doc/lua_api.txt#L4244)
|
||||
VoxelManip = {}
|
||||
|
||||
--- Loads a chunk of map into the VoxelManip object
|
||||
--- containing the region formed by `p1` and `p2`.
|
||||
--- * returns actual emerged `pmin`, actual emerged `pmax`
|
||||
function VoxelManip:read_from_map(p1, p2) end
|
||||
--- Writes the data loaded from the `VoxelManip` back to
|
||||
--- the map.
|
||||
--- * **important**: data must be set using `VoxelManip:set_data()` before
|
||||
--- calling this.
|
||||
--- * if `light` is true, then lighting is automatically recalculated.
|
||||
--- The default value is true.
|
||||
--- If `light` is false, no light calculations happen, and you should correct
|
||||
--- all modified blocks with `minetest.fix_light()` as soon as possible.
|
||||
--- Keep in mind that modifying the map where light is incorrect can cause
|
||||
--- more lighting bugs.
|
||||
function VoxelManip:write_to_map(light) end
|
||||
--- Returns a `MapNode` table of the node currently loaded in
|
||||
--- the `VoxelManip` at that position
|
||||
function VoxelManip:get_node_at(pos) end
|
||||
--- Sets a specific `MapNode` in the `VoxelManip` at
|
||||
--- that position.
|
||||
function VoxelManip:set_node_at(pos, node) end
|
||||
--- Retrieves the node content data loaded into the
|
||||
--- `VoxelManip` object.
|
||||
--- * returns raw node data in the form of an array of node content IDs
|
||||
--- * if the param `buffer` is present, this table will be used to store the
|
||||
--- result instead.
|
||||
function VoxelManip:get_data(buffer) end
|
||||
--- Sets the data contents of the `VoxelManip` object
|
||||
--- function VoxelManip:set_data(data) end
|
||||
--- Does nothing, kept for compatibility.
|
||||
--- function VoxelManip:update_map() end
|
||||
--- Set the lighting within the `VoxelManip` to
|
||||
--- a uniform value.
|
||||
--- * `light` is a table, `{day=<0...15>, night=<0...15>}`
|
||||
--- * To be used only by a `VoxelManip` object from
|
||||
--- `minetest.get_mapgen_object`.
|
||||
--- * (`p1`, `p2`) is the area in which lighting is set, defaults to the whole
|
||||
--- area if left out.
|
||||
function VoxelManip:set_lighting(light, p1, p2) end
|
||||
--- Gets the light data read into the
|
||||
--- `VoxelManip` object
|
||||
--- * Returns an array (indices 1 to volume) of integers ranging from `0` to
|
||||
--- `255`.
|
||||
--- * Each value is the bitwise combination of day and night light values
|
||||
--- (`0` to `15` each).
|
||||
--- * `light = day + (night * 16)`
|
||||
--- * If the param `buffer` is present, this table will be used to store the
|
||||
--- result instead.
|
||||
function VoxelManip:get_light_data(buffer) end
|
||||
--- Sets the `param1` (light) contents of each node
|
||||
--- in the `VoxelManip`.
|
||||
--- * expects lighting data in the same format that `get_light_data()` returns
|
||||
function VoxelManip:set_light_data(light_data) end
|
||||
--- Gets the raw `param2` data read into the
|
||||
--- `VoxelManip` object.
|
||||
--- * Returns an array (indices 1 to volume) of integers ranging from `0` to
|
||||
--- `255`.
|
||||
--- * If the param `buffer` is present, this table will be used to store the
|
||||
--- result instead.
|
||||
function VoxelManip:get_param2_data(buffer) end
|
||||
--- Sets the `param2` contents of each node in
|
||||
--- the `VoxelManip`.
|
||||
function VoxelManip:set_param2_data(param2_data) end
|
||||
--- Calculate lighting within the
|
||||
--- `VoxelManip`.
|
||||
--- * To be used only by a `VoxelManip` object from
|
||||
--- `minetest.get_mapgen_object`.
|
||||
--- * (`p1`, `p2`) is the area in which lighting is set, defaults to the whole
|
||||
--- area if left out or nil. For almost all uses these should be left out
|
||||
--- or nil to use the default.
|
||||
--- * `propagate_shadow` is an optional boolean deciding whether shadows in a
|
||||
--- generated mapchunk above are propagated down into the mapchunk, defaults
|
||||
--- to `true` if left out.
|
||||
function VoxelManip:calc_lighting(p1, p2, propagate_shadow) end
|
||||
--- Update liquid flow
|
||||
function VoxelManip:update_liquids() end
|
||||
--- Returns `true` or `false` if the data in the voxel
|
||||
--- manipulator had been modified since the last read from map, due to a call to
|
||||
--- `minetest.set_data()` on the loaded area elsewhere.
|
||||
function VoxelManip:was_modified() end
|
||||
--- Returns actual emerged minimum and maximum positions.
|
||||
function VoxelManip:get_emerged_area() end
|
||||
@@ -19,9 +19,6 @@ NodeTable = {}
|
||||
|
||||
--- See ./classes/NodeMetaRef.lua
|
||||
|
||||
---@class VoxelManip
|
||||
VoxelManip = {}
|
||||
|
||||
--- See ./classes/VoxelArea.lua
|
||||
|
||||
--- See ./classes/ObjectRef.lua
|
||||
@@ -1068,6 +1065,7 @@ function minetest.get_perlin(seeddiff, octaves, persistence, spread) end
|
||||
---
|
||||
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4955-L4957)
|
||||
--- @param positions table array [pos1, pos2]
|
||||
--- @return VoxelManip
|
||||
function minetest.get_voxel_manip(positions) end
|
||||
--- * Set the types of on-generate notifications that should be collected.
|
||||
--- * `flags` is a flag field with the available flags:
|
||||
|
||||
Reference in New Issue
Block a user