cartographer/commands.lua

33 lines
1.1 KiB
Lua

local MAXINT = 2147483647;
-- /map <detail> -- Displays a regional map around the player
-- (Optional)detail: Specifies the map's detail level. Defaults to the highest
-- available detail.
minetest.register_chatcommand("map", {
params = "[<detail>]",
func = function(name, detail)
local player = minetest.get_player_by_name(name);
local pos = player:get_pos();
local player_x, player_z = cartographer.to_map_coordinates(nil, pos.x, pos.z);
if detail == "" then
detail = MAXINT;
end
minetest.sound_play("cartographer_open_map", { to_player=name }, true);
minetest.show_formspec(name, "map", cartographer.get_map_formspec(data, player_x, player_z, 40, 40, detail));
end,
})
-- TODO: Remove before release
minetest.register_chatcommand("scan", {
func = function(name)
local player = minetest.get_player_by_name(name);
local pos = player:get_pos();
local b = minetest.get_biome_data(pos).biome;
minetest.chat_send_all(minetest.get_biome_name(b));
end,
})