Fix remaining luacheck warnings in commands.lua
This commit is contained in:
parent
51ef36c50c
commit
3f641f6d63
13
commands.lua
13
commands.lua
@ -9,12 +9,6 @@ local MAXINT = 2147483647;
|
|||||||
minetest.register_chatcommand("map", {
|
minetest.register_chatcommand("map", {
|
||||||
params = "[<detail>] [<scale>]",
|
params = "[<detail>] [<scale>]",
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local player = minetest.get_player_by_name(name);
|
|
||||||
local pos = player:get_pos();
|
|
||||||
|
|
||||||
local player_x = chunk.to(pos.x);
|
|
||||||
local player_z = chunk.to(pos.z);
|
|
||||||
|
|
||||||
local detail, scale = param:match("(%d*) (%d*)");
|
local detail, scale = param:match("(%d*) (%d*)");
|
||||||
|
|
||||||
if detail then
|
if detail then
|
||||||
@ -29,8 +23,13 @@ minetest.register_chatcommand("map", {
|
|||||||
scale = 1;
|
scale = 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local player = minetest.get_player_by_name(name);
|
||||||
|
local pos = player:get_pos();
|
||||||
|
local player_x = math.floor((chunk.to(pos.x) / scale) + 0.5);
|
||||||
|
local player_z = math.floor((chunk.to(pos.z) / scale) + 0.5);
|
||||||
|
|
||||||
audio.play_feedback("cartographer_open_map", player);
|
audio.play_feedback("cartographer_open_map", player);
|
||||||
minetest.show_formspec(name, "map", map_formspec.from_coords(math.floor((player_x / scale) + 0.5), math.floor((player_z / scale) + 0.5), 40, 40, detail, scale, true));
|
minetest.show_formspec(name, "map", map_formspec.from_coords(player_x, player_z, 40, 40, detail, scale, true));
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user