diff --git a/items.lua b/items.lua index 990ac4b..b81ae05 100644 --- a/items.lua +++ b/items.lua @@ -149,6 +149,10 @@ function cartographer.create_map_item(size, detail, scale) return map; 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) local meta = stack:get_meta(); @@ -169,6 +173,9 @@ function cartographer.copy_map_item(stack) for k,v in pairs(src.fill) do dest.fill[k] = v; 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_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)) .. "]") diff --git a/table.lua b/table.lua index df15c14..c2c8316 100644 --- a/table.lua +++ b/table.lua @@ -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)); end - end table_formspec(player:get_player_name(), 3)