1
0
mirror of https://github.com/Uberi/Minetest-WorldEdit.git synced 2024-12-26 02:30:40 +01:00

Use rounding rather than flooring for more intuitive player position setting.

This commit is contained in:
Anthony Zhang 2013-02-16 21:14:44 -05:00
parent cfaed1781a
commit 4a98773025

View File

@ -57,7 +57,7 @@ minetest.register_chatcommand("/pos1", {
privs = {worldedit=true}, privs = {worldedit=true},
func = function(name, param) func = function(name, param)
local pos = minetest.env:get_player_by_name(name):getpos() 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.pos1[name] = pos
worldedit.mark_pos1(name) worldedit.mark_pos1(name)
minetest.chat_send_player(name, "WorldEdit position 1 set to " .. minetest.pos_to_string(pos)) 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}, privs = {worldedit=true},
func = function(name, param) func = function(name, param)
local pos = minetest.env:get_player_by_name(name):getpos() 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.pos2[name] = pos
worldedit.mark_pos2(name) worldedit.mark_pos2(name)
minetest.chat_send_player(name, "WorldEdit position 2 set to " .. minetest.pos_to_string(pos)) minetest.chat_send_player(name, "WorldEdit position 2 set to " .. minetest.pos_to_string(pos))