Fix crash when scanning biome data

- Cleanup table node definitions a little
This commit is contained in:
Hugues Ross 2020-03-08 09:55:51 -04:00
parent 950414baf2
commit 17e0ade3f4
2 changed files with 20 additions and 36 deletions

View File

@ -179,9 +179,9 @@ function cartographer.scan_regions()
return;
end
local biome = get_biome(startpos, endpos);
local biome,height = get_biome(startpos, endpos);
if biome ~= nil then
register_mapchunk(startpos.x / CHUNK_SIZE, startpos.z / CHUNK_SIZE, biome)
register_mapchunk(startpos.x / CHUNK_SIZE, startpos.z / CHUNK_SIZE, biome, height)
end
cartographer.scan_queue[len] = nil;

View File

@ -360,6 +360,18 @@ minetest.register_on_player_receive_fields(function(player, name, fields)
end
end);
local function setup_table_node(pos)
local meta = minetest.get_meta(pos);
meta:get_inventory():set_size("input", 1);
meta:get_inventory():set_size("output", 1);
meta:get_inventory():set_size("copy_input", 1);
meta:get_inventory():set_size("copy_output", 1);
meta:set_int("size", SIZE_SMALL);
meta:set_int("scale", 1);
meta:set_int("detail", 0);
end
minetest.register_node("cartographer:simple_table", {
description = "Shabby Cartographer's Table",
drawtype = "mesh",
@ -375,16 +387,7 @@ minetest.register_node("cartographer:simple_table", {
table_formspec(player:get_player_name(), 1)
end,
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos);
meta:get_inventory():set_size("input", 1);
meta:get_inventory():set_size("output", 1);
meta:set_int("size", SIZE_SMALL);
meta:set_int("detail", 0);
return res;
end,
after_place_node = setup_table_node,
});
minetest.register_node("cartographer:standard_table", {
@ -402,21 +405,13 @@ minetest.register_node("cartographer:standard_table", {
table_formspec(player:get_player_name(), 1)
end,
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos);
meta:get_inventory():set_size("input", 1);
meta:get_inventory():set_size("output", 1);
meta:get_inventory():set_size("copy_input", 1);
meta:get_inventory():set_size("copy_output", 1);
meta:set_int("size", SIZE_SMALL);
meta:set_int("detail", 0);
return res;
end,
after_place_node = setup_table_node,
});
minetest.register_node("cartographer:advanced_table", {
description = "Advanced Cartographer's Table",
tiles = { "cartographer_advanced_table.png" },
paramtype2 = "facedir",
groups = {
choppy = 2,
oddly_breakable_by_hand = 2,
@ -426,18 +421,7 @@ minetest.register_node("cartographer:advanced_table", {
table_formspec(player:get_player_name(), 1)
end,
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos);
meta:get_inventory():set_size("input", 1);
meta:get_inventory():set_size("output", 1);
meta:get_inventory():set_size("copy_input", 1);
meta:get_inventory():set_size("copy_output", 1);
meta:set_int("size", SIZE_SMALL);
meta:set_int("detail", 0);
return res;
end,
after_place_node = setup_table_node,
});
function cartographer.register_map_material_name(name, material, value)