Fix copied maps not retaining marker information
This commit is contained in:
parent
0f706533b6
commit
4cc3a4cfaa
@ -149,6 +149,10 @@ function cartographer.create_map_item(size, detail, scale)
|
|||||||
return map;
|
return map;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Create a copy of the given map
|
||||||
|
-- stack: An itemstack containing a map
|
||||||
|
--
|
||||||
|
-- Returns an itemstack with the copied map
|
||||||
function cartographer.copy_map_item(stack)
|
function cartographer.copy_map_item(stack)
|
||||||
local meta = stack:get_meta();
|
local meta = stack:get_meta();
|
||||||
|
|
||||||
@ -169,6 +173,9 @@ function cartographer.copy_map_item(stack)
|
|||||||
for k,v in pairs(src.fill) do
|
for k,v in pairs(src.fill) do
|
||||||
dest.fill[k] = v;
|
dest.fill[k] = v;
|
||||||
end
|
end
|
||||||
|
for k,v in pairs(src.markers) do
|
||||||
|
dest.markers[k] = v;
|
||||||
|
end
|
||||||
|
|
||||||
copy_meta:set_int("cartographer:map_id", new_id);
|
copy_meta:set_int("cartographer:map_id", new_id);
|
||||||
copy_meta:set_string("description", "Map #" .. tostring(new_id) .. "\n[" .. tostring(fromchunk(dest.x)) .. "," .. tostring(fromchunk(dest.z)) .. "] - [" .. tostring(fromchunk(dest.x + dest.w)) .. "," .. tostring(fromchunk(dest.z + dest.h)) .. "]")
|
copy_meta:set_string("description", "Map #" .. tostring(new_id) .. "\n[" .. tostring(fromchunk(dest.x)) .. "," .. tostring(fromchunk(dest.z)) .. "] - [" .. tostring(fromchunk(dest.x + dest.w)) .. "," .. tostring(fromchunk(dest.z + dest.h)) .. "]")
|
||||||
|
@ -415,7 +415,6 @@ minetest.register_on_player_receive_fields(function(player, name, fields)
|
|||||||
|
|
||||||
inv:set_stack("copy_output", 1, cartographer.copy_map_item(in_stack));
|
inv:set_stack("copy_output", 1, cartographer.copy_map_item(in_stack));
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
table_formspec(player:get_player_name(), 3)
|
table_formspec(player:get_player_name(), 3)
|
||||||
|
Loading…
Reference in New Issue
Block a user