aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2022-05-31 14:24:19 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2022-05-31 14:24:19 +0200
commitfae336d1a2d613fd00640ed6ccbb9eb386086c82 (patch)
tree48f0fe2cf3a3d86d2d0e192f1b38da55bc18d2f7 /doc
parent76071affa0f33bef03e323aa0552c750c56a2cab (diff)
downloadhydra-dragonfire-fae336d1a2d613fd00640ed6ccbb9eb386086c82.tar.xz
Add map component
Diffstat (limited to 'doc')
-rw-r--r--doc/api.md1
-rw-r--r--doc/client.md1
-rw-r--r--doc/client_pkts.md2
-rw-r--r--doc/map.md13
-rw-r--r--doc/server_pkts.md2
5 files changed, 17 insertions, 2 deletions
diff --git a/doc/api.md b/doc/api.md
index 8dda81e..2105a81 100644
--- a/doc/api.md
+++ b/doc/api.md
@@ -15,6 +15,7 @@ Hydra uses gopher-lua, Lua 5.1
- `escapes`: contains utility functions to deal with minetest escape sequences, see [escapes.md](escapes.md)
- `client`: a function to create a client from command line arguments in the form `<server> <username> <password>`. This is trivial but so commonly used that this function was added to avoid repetition in scripts.
+- `base64`: contains the `base64.encode(data)` function to base64 encode a string as well as `base64.decode(data)` to decode
## Standard library additions
diff --git a/doc/client.md b/doc/client.md
index 9844591..9c1922e 100644
--- a/doc/client.md
+++ b/doc/client.md
@@ -22,3 +22,4 @@ After being disconnect, a client cannot be reconnected.
Enabled components can be accessed by using `self.<component name>`.
- `self.auth`: Handles authentication. Recommended for the vast majority of scripts. See [auth.md](auth.md).
+- `self.map`: Stores MapBlocks received from server. See [map.md](map.md).
diff --git a/doc/client_pkts.md b/doc/client_pkts.md
index 7f967a0..2594b9d 100644
--- a/doc/client_pkts.md
+++ b/doc/client_pkts.md
@@ -1,4 +1,4 @@
# Client Packets
TODO: automatically generate documentation from spec.
-For now, have a look at [spec/client](../spec/client)
+For now, have a look at [spec/client](../convert/spec/client)
diff --git a/doc/map.md b/doc/map.md
new file mode 100644
index 0000000..26fd51a
--- /dev/null
+++ b/doc/map.md
@@ -0,0 +1,13 @@
+# Map Component
+Source code: [map.go](../map.go)
+
+Map handles the `blk_data` and `node_metas_changed` packets.
+Map may send `got_blks`, `deleted_blks` packets.
+
+## Functions
+
+`self:clear()`: Forget all blocks.
+
+`self:block(blkpos)`: Return the `map_blk` at `blkpos` as found in the `blk_data` packet (See [client_pkts.md](client_pkts.md)). `nil` if block is not present.
+
+`self:node(pos)`: Return a node in the form `{ param0 = 126, param1 = 0, param2 = 0, meta = { ... } }`. The meta field is a `node_meta` as found in the `blk_data` packet. `nil` if node is not present.
diff --git a/doc/server_pkts.md b/doc/server_pkts.md
index 0b34367..ac8741e 100644
--- a/doc/server_pkts.md
+++ b/doc/server_pkts.md
@@ -1,4 +1,4 @@
# Server Packets
TODO: automatically generate documentation from spec.
-For now, have a look at [spec/server](../spec/server)
+For now, have a look at [spec/server](../convert/spec/server)