summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUberi <azhang9@gmail.com>2013-12-10 01:47:32 -0500
committerUberi <azhang9@gmail.com>2013-12-10 01:47:32 -0500
commitac7430e02fe0d8dfcef08ab4eda4877241b332df (patch)
tree2a109e707234322ad893266094bcde1a9c54cfe5
parentb3ba6f2433c428af9c4068023a533341251686ec (diff)
Version information is now available via the API.
-rw-r--r--WorldEdit API.md13
-rw-r--r--worldedit/init.lua4
-rw-r--r--worldedit_commands/init.lua8
3 files changed, 20 insertions, 5 deletions
diff --git a/WorldEdit API.md b/WorldEdit API.md
index 22441d2..4169cbe 100644
--- a/WorldEdit API.md
+++ b/WorldEdit API.md
@@ -6,13 +6,24 @@ If needed, individual modules such as visualization.lua can be removed without a
For more information, see the [README](README.md).
+General
+-------
+
+### value = worldedit.version
+
+Contains the current version of WorldEdit in a table of the form `{major=MAJOR_INTEGER, minor=MINOR_INTEGER}`, where `MAJOR_INTEGER` is the major version (the number before the period) as an integer, and `MINOR_INTEGER` is the minor version (the number after the period) as an integer. This is intended for version checking purposes.
+
+### value = worldedit.version_string
+
+Contains the current version of WorldEdit in the form of a string `"MAJOR_INTEGER.MINOR_INTEGER"`, where `MAJOR_INTEGER` is the major version (the number before the period) as an integer, and `MINOR_INTEGER` is the minor version (the number after the period) as an integer. This is intended for display purposes.
+
Manipulations
-------------
Contained in manipulations.lua, this module allows several node operations to be applied over a region.
### count = worldedit.set(pos1, pos2, nodename)
-Sets a region defined by positions `pos1` and `pos2` to `nodename`. To clear to region, use "air" as the value of `nodename`.
+Sets a region defined by positions `pos1` and `pos2` to `nodename`. To clear a region, use "air" as the value of `nodename`.
Returns the number of nodes set.
diff --git a/worldedit/init.lua b/worldedit/init.lua
index 6d3efe4..a6361b5 100644
--- a/worldedit/init.lua
+++ b/worldedit/init.lua
@@ -1,3 +1,7 @@
+worldedit = worldedit or {}
+worldedit.version = {major=1, minor=0}
+worldedit.version_string = "1.0"
+
assert(minetest.get_voxel_manip, string.rep(">", 300) .. "HEY YOU! YES, YOU OVER THERE. THIS VERSION OF WORLDEDIT REQUIRES MINETEST 0.4.8 OR LATER! YOU HAVE AN OLD VERSION." .. string.rep("<", 300))
local path = minetest.get_modpath(minetest.get_current_modname())
diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua
index 9977674..3ce26eb 100644
--- a/worldedit_commands/init.lua
+++ b/worldedit_commands/init.lua
@@ -54,7 +54,7 @@ minetest.register_chatcommand("/about", {
params = "",
description = "Get information about the mod",
func = function(name, param)
- worldedit.player_notify(name, "WorldEdit 1.0 is available on this server. Type /help to get a list of commands, or get more information at https://github.com/Uberi/MineTest-WorldEdit/")
+ worldedit.player_notify(name, "WorldEdit " .. worldedit.version_string .. " is available on this server. Type /help to get a list of commands, or get more information at https://github.com/Uberi/MineTest-WorldEdit/")
end,
})
@@ -247,9 +247,9 @@ minetest.register_chatcommand("/volume", {
local volume = worldedit.volume(pos1, pos2)
local abs = math.abs
worldedit.player_notify(name, "current region has a volume of " .. volume .. " nodes ("
- .. abs(pos2.x - pos1.x) .. "*"
- .. abs(pos2.y - pos1.y) .. "*"
- .. abs(pos2.z - pos1.z) .. ")")
+ .. abs(pos2.x - pos1.x) + 1 .. "*"
+ .. abs(pos2.y - pos1.y) + 1 .. "*"
+ .. abs(pos2.z - pos1.z) + 1 .. ")")
end,
})