aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-07-11 02:24:00 +0200
committerest31 <MTest31@outlook.com>2015-07-27 06:42:56 +0200
commitc30a2d68541b6ff451d92709478b4e37cac86447 (patch)
tree03b92452d7b63e0a81f7e636e38e3c40c2ba1128 /doc
parent454a29037061ba62d89af41ecae23b4424f41ea5 (diff)
downloadminetest-c30a2d68541b6ff451d92709478b4e37cac86447.tar.gz
minetest-c30a2d68541b6ff451d92709478b4e37cac86447.tar.bz2
minetest-c30a2d68541b6ff451d92709478b4e37cac86447.zip
Add AreaStore data structure
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 75bbbdb07..ab059e182 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -2602,6 +2602,28 @@ An `InvRef` is a reference to an inventory.
* `get_location()`: returns a location compatible to `minetest.get_inventory(location)`
* returns `{type="undefined"}` in case location is not known
+### `AreaStore`
+A fast access data structure to store areas, and find areas near a given position or area.
+Every area has a `data` string attribute to store additional information.
+You can create an empty `AreaStore` by calling `AreaStore()`, or `AreaStore(type_name)`.
+If you chose the parameter-less constructor, a fast implementation will be automatically chosen for you.
+
+#### Methods
+* `get_area(id, include_borders, include_data)`: returns the area with the id `id`. (optional) Boolean values `include_borders` and `include_data` control what's copied.
+* `get_areas_for_pos(pos, include_borders, include_data)`: returns all areas that contain the position `pos`. (optional) Boolean values `include_borders` and `include_data` control what's copied.
+* `get_areas_in_area(edge1, edge2, accept_overlap, include_borders, include_data)`: returns all areas that contain all nodes inside the area specified by `edge1` and `edge2` (inclusive). If `accept_overlap` is true, also areas are returned that have nodes in common with the specified area. (optional) Boolean values `include_borders` and `include_data` control what's copied.
+* `insert_area(edge1, edge2, data)`: inserts an area into the store. Returns the id if successful, nil otherwise. The (inclusive) positions `edge1` and `edge2` describe the area, `data`
+is a string stored with the area.
+* `reserve(count)`: reserves resources for at most `count` many contained areas. Only needed for efficiency, and only some implementations profit.
+* `remove_area(id)`: removes the area with the given id from the store, returns success.
+* `set_cache_params(params)`: sets params for the included prefiltering cache. Calling invalidates the cache, so that its elements have to be newly generated.
+ * `params`:
+ {
+ enabled = boolean, -- whether to enable, default true
+ block_radius = number, -- the radius (in nodes) of the areas the cache generates prefiltered lists for, minimum 16, default 64
+ limit = number, -- the cache's size, minimum 20, default 1000
+ }
+
### `ItemStack`
An `ItemStack` is a stack of items.