From a5eef1c5de77fa7770877802e66c3e1c53f9a0da Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Wed, 24 Apr 2019 18:59:36 -0400 Subject: update castles, areas, homedecor, plantlife, gloopblocks, hotbar, inspector, maptools, mesecons, moreblocks, moreores, technic, teleport_request, and worldedit switched to caverealms_lite (with minor fixes by me) switched to CWz's fork of player_textures The homedecor update brings in the big split, and will require you to re-enable all modpack components in order to avoid loss of content. --- worldedit/manipulations.lua | 42 +++++++++++++++++++++++------------------- worldedit/serialization.lua | 40 ++++++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 35 deletions(-) (limited to 'worldedit') diff --git a/worldedit/manipulations.lua b/worldedit/manipulations.lua index ee51561..a6aad16 100644 --- a/worldedit/manipulations.lua +++ b/worldedit/manipulations.lua @@ -529,20 +529,22 @@ end -- @param pos2 -- @param angle Angle in degrees (90 degree increments only). -- @return The number of nodes oriented. --- TODO: Support 6D facedir rotation along arbitrary axis. function worldedit.orient(pos1, pos2, angle) local pos1, pos2 = worldedit.sort_pos(pos1, pos2) local registered_nodes = minetest.registered_nodes local wallmounted = { - [90] = {[0]=0, 1, 5, 4, 2, 3}, - [180] = {[0]=0, 1, 3, 2, 5, 4}, - [270] = {[0]=0, 1, 4, 5, 3, 2} + [90] = {0, 1, 5, 4, 2, 3, 0, 0}, + [180] = {0, 1, 3, 2, 5, 4, 0, 0}, + [270] = {0, 1, 4, 5, 3, 2, 0, 0} } local facedir = { - [90] = {[0]=1, 2, 3, 0}, - [180] = {[0]=2, 3, 0, 1}, - [270] = {[0]=3, 0, 1, 2} + [90] = { 1, 2, 3, 0, 13, 14, 15, 12, 17, 18, 19, 16, + 9, 10, 11, 8, 5, 6, 7, 4, 23, 20, 21, 22}, + [180] = { 2, 3, 0, 1, 10, 11, 8, 9, 6, 7, 4, 5, + 18, 19, 16, 17, 14, 15, 12, 13, 22, 23, 20, 21}, + [270] = { 3, 0, 1, 2, 19, 16, 17, 18, 15, 12, 13, 14, + 7, 4, 5, 6, 11, 8, 9, 10, 21, 22, 23, 20} } angle = angle % 360 @@ -558,8 +560,7 @@ function worldedit.orient(pos1, pos2, angle) worldedit.keep_loaded(pos1, pos2) local count = 0 - local set_node, get_node, get_meta, swap_node = minetest.set_node, - minetest.get_node, minetest.get_meta, minetest.swap_node + local get_node, swap_node = minetest.get_node, minetest.swap_node local pos = {x=pos1.x, y=0, z=0} while pos.x <= pos2.x do pos.y = pos1.y @@ -569,17 +570,20 @@ function worldedit.orient(pos1, pos2, angle) local node = get_node(pos) local def = registered_nodes[node.name] if def then - if def.paramtype2 == "wallmounted" then - node.param2 = wallmounted_substitution[node.param2] - local meta = get_meta(pos):to_table() - set_node(pos, node) - get_meta(pos):from_table(meta) + local paramtype2 = def.paramtype2 + if paramtype2 == "wallmounted" or + paramtype2 == "colorwallmounted" then + local orient = node.param2 % 8 + node.param2 = node.param2 - orient + + wallmounted_substitution[orient + 1] + swap_node(pos, node) count = count + 1 - elseif def.paramtype2 == "facedir" then - node.param2 = facedir_substitution[node.param2] - local meta = get_meta(pos):to_table() - set_node(pos, node) - get_meta(pos):from_table(meta) + elseif paramtype2 == "facedir" or + paramtype2 == "colorfacedir" then + local orient = node.param2 % 32 + node.param2 = node.param2 - orient + + facedir_substitution[orient + 1] + swap_node(pos, node) count = count + 1 end end diff --git a/worldedit/serialization.lua b/worldedit/serialization.lua index a0848e2..4aef556 100644 --- a/worldedit/serialization.lua +++ b/worldedit/serialization.lua @@ -56,10 +56,19 @@ function worldedit.serialize(pos1, pos2) worldedit.keep_loaded(pos1, pos2) + local get_node, get_meta, hash_node_position = + minetest.get_node, minetest.get_meta, minetest.hash_node_position + + -- Find the positions which have metadata + local has_meta = {} + local meta_positions = minetest.find_nodes_with_meta(pos1, pos2) + for i = 1, #meta_positions do + has_meta[hash_node_position(meta_positions[i])] = true + end + local pos = {x=pos1.x, y=0, z=0} local count = 0 local result = {} - local get_node, get_meta = minetest.get_node, minetest.get_meta while pos.x <= pos2.x do pos.y = pos1.y while pos.y <= pos2.y do @@ -68,20 +77,19 @@ function worldedit.serialize(pos1, pos2) local node = get_node(pos) if node.name ~= "air" and node.name ~= "ignore" then count = count + 1 - local meta = get_meta(pos):to_table() - - local meta_empty = true - -- Convert metadata item stacks to item strings - for name, inventory in pairs(meta.inventory) do - for index, stack in ipairs(inventory) do - meta_empty = false - inventory[index] = stack.to_string and stack:to_string() or stack - end - end - for k in pairs(meta) do - if k ~= "inventory" then - meta_empty = false - break + + local meta + if has_meta[hash_node_position(pos)] then + meta = get_meta(pos):to_table() + + -- Convert metadata item stacks to item strings + for _, invlist in pairs(meta.inventory) do + for index = 1, #invlist do + local itemstack = invlist[index] + if itemstack.to_string then + invlist[index] = itemstack:to_string() + end + end end end @@ -92,7 +100,7 @@ function worldedit.serialize(pos1, pos2) name = node.name, param1 = node.param1 ~= 0 and node.param1 or nil, param2 = node.param2 ~= 0 and node.param2 or nil, - meta = not meta_empty and meta or nil, + meta = meta, } end pos.z = pos.z + 1 -- cgit v1.2.3