summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Zhang <azhang9@gmail.com>2013-02-16 21:14:44 -0500
committerAnthony Zhang <azhang9@gmail.com>2013-02-16 21:14:44 -0500
commit4a987730253e85ba2cf39185eda61896e51abaf4 (patch)
tree01044e1789fc1ffda28eb30c457f91fb2b51d421
parentcfaed1781a79fce286c7e1daad480673a8f0787e (diff)
Use rounding rather than flooring for more intuitive player position setting.
-rw-r--r--worldedit_commands/init.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua
index c30a75e..67f50e3 100644
--- a/worldedit_commands/init.lua
+++ b/worldedit_commands/init.lua
@@ -57,7 +57,7 @@ minetest.register_chatcommand("/pos1", {
privs = {worldedit=true},
func = function(name, param)
local pos = minetest.env:get_player_by_name(name):getpos()
- pos.x, pos.y, pos.z = math.floor(pos.x), math.floor(pos.y), math.floor(pos.z)
+ pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5)
worldedit.pos1[name] = pos
worldedit.mark_pos1(name)
minetest.chat_send_player(name, "WorldEdit position 1 set to " .. minetest.pos_to_string(pos))
@@ -70,7 +70,7 @@ minetest.register_chatcommand("/pos2", {
privs = {worldedit=true},
func = function(name, param)
local pos = minetest.env:get_player_by_name(name):getpos()
- pos.x, pos.y, pos.z = math.floor(pos.x), math.floor(pos.y), math.floor(pos.z)
+ pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5)
worldedit.pos2[name] = pos
worldedit.mark_pos2(name)
minetest.chat_send_player(name, "WorldEdit position 2 set to " .. minetest.pos_to_string(pos))