Various command-related fixes
This commit is contained in:
parent
8ccf1afbb6
commit
7c55cfaeaf
@ -16,14 +16,18 @@ minetest.register_chatcommand("map", {
|
|||||||
|
|
||||||
if detail then
|
if detail then
|
||||||
detail = tonumber(detail);
|
detail = tonumber(detail);
|
||||||
|
else
|
||||||
|
detail = MAXINT;
|
||||||
end
|
end
|
||||||
|
|
||||||
if scale then
|
if scale then
|
||||||
scale = tonumber(scale);
|
scale = tonumber(scale);
|
||||||
|
else
|
||||||
|
scale = 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
cartographer.map_sound("cartographer_open_map", player);
|
cartographer.map_sound("cartographer_open_map", player);
|
||||||
minetest.show_formspec(name, "map", cartographer.get_map_formspec(data, math.floor(player_x / scale + 0.5), math.floor(player_z / scale + 0.5), 40, 40, detail or MAXINT, scale or 1, true));
|
minetest.show_formspec(name, "map", cartographer.get_map_formspec(data, math.floor((player_x / scale) + 0.5), math.floor((player_z / scale) + 0.5), 40, 40, detail, scale, true));
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ end
|
|||||||
function cartographer.get_map_formspec(data, x, y, w, h, detail, scale, height_mode)
|
function cartographer.get_map_formspec(data, x, y, w, h, detail, scale, height_mode)
|
||||||
local formspec_width = (w + 1) * TILE_OFFSET + 0.01;
|
local formspec_width = (w + 1) * TILE_OFFSET + 0.01;
|
||||||
local formspec_height = (h + 1) * TILE_OFFSET + 0.01;
|
local formspec_height = (h + 1) * TILE_OFFSET + 0.01;
|
||||||
return map_formspec_prefix:format(formspec_width, formspec_height)..generate_map(data, x - (w * 0.5), y - (h * 0.5), w, h, x, z, detail, scale, height_mode),
|
return map_formspec_prefix:format(formspec_width, formspec_height)..generate_map(data, x - (w * 0.5), y - (h * 0.5), w, h, x, y, detail, scale, height_mode),
|
||||||
formspec_width,
|
formspec_width,
|
||||||
formspec_height;
|
formspec_height;
|
||||||
end
|
end
|
||||||
|
12
table.lua
12
table.lua
@ -674,21 +674,21 @@ minetest.register_node("cartographer:advanced_table", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function cartographer.register_map_material_name(name, material, value)
|
function cartographer.register_map_material_name(name, material, value)
|
||||||
if _cartographer.materials_by_name[name] == nil then
|
if _cartographer.materials_by_name[name] then
|
||||||
|
_cartographer.materials_by_name[name][material] = value or 1;
|
||||||
|
else
|
||||||
_cartographer.materials_by_name[name] = {
|
_cartographer.materials_by_name[name] = {
|
||||||
[material] = value or 1,
|
[material] = value or 1,
|
||||||
};
|
};
|
||||||
else
|
|
||||||
_cartographer.materials_by_name[name][material] = value;
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function cartographer.register_map_material_group(name, material, value)
|
function cartographer.register_map_material_group(name, material, value)
|
||||||
if _cartographer.materials_by_group[name] == nil then
|
if _cartographer.materials_by_group[name] then
|
||||||
|
_cartographer.materials_by_group[name][material] = value or 1;
|
||||||
|
else
|
||||||
_cartographer.materials_by_group[name] = {
|
_cartographer.materials_by_group[name] = {
|
||||||
[material] = value or 1,
|
[material] = value or 1,
|
||||||
};
|
};
|
||||||
else
|
|
||||||
_cartographer.materials_by_group[name][material] = value;
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user