Piston and wire cleanups and minor rotation fixes

This commit is contained in:
Carter Kolwey 2016-12-28 05:34:15 -06:00 committed by Jeija
parent 410f43bbc1
commit 774aac6e90
8 changed files with 102 additions and 96 deletions

View File

@ -12,3 +12,86 @@ for hash, _ in pairs(old_forceloaded_blocks) do
minetest.forceload_free_block(unhash_blockpos(hash))
end
os.remove(minetest.get_worldpath()..DIR_DELIM.."mesecon_forceloaded")
-- LBMs to convert old pistons to use facedir instead of separate up/down nodes
minetest.register_lbm({
label = "Convert up pistons to use facedir",
name = ":mesecons_pistons:update_up_pistons",
nodenames = {"mesecons_pistons:piston_up_normal_on","mesecons_pistons:piston_up_normal_off",
"mesecons_pistons:piston_up_sticky_on","mesecons_pistons:piston_up_sticky_off"},
action = function(pos, node)
if string.find(node.name, "sticky") then
if string.sub(node.name, -3, -1) == "_on" then
node.name = "mesecons_pistons:piston_sticky_on"
else
node.name = "mesecons_pistons:piston_sticky_off"
end
else
if string.sub(node.name, -3, -1) == "_on" then
node.name = "mesecons_pistons:piston_normal_on"
else
node.name = "mesecons_pistons:piston_normal_off"
end
end
local dir = {x=0, y=-1, z=0}
node.param2 = minetest.dir_to_facedir(dir, true)
minetest.swap_node(pos, node)
end
})
minetest.register_lbm({
label = "Convert down pistons to use facedir",
name = ":mesecons_pistons:update_down_pistons",
nodenames = {"mesecons_pistons:piston_down_normal_on","mesecons_pistons:piston_down_normal_off",
"mesecons_pistons:piston_down_sticky_on","mesecons_pistons:piston_down_sticky_off"},
action = function(pos, node)
if string.find(node.name, "sticky") then
if string.sub(node.name, -3, -1) == "_on" then
node.name = "mesecons_pistons:piston_sticky_on"
else
node.name = "mesecons_pistons:piston_sticky_off"
end
else
if string.sub(node.name, -3, -1) == "_on" then
node.name = "mesecons_pistons:piston_normal_on"
else
node.name = "mesecons_pistons:piston_normal_off"
end
end
local dir = {x=0, y=1, z=0}
node.param2 = minetest.dir_to_facedir(dir, true)
minetest.swap_node(pos, node)
end
})
minetest.register_lbm({
label = "Convert up piston pushers to use facedir",
name = ":mesecons_pistons:update_up_pushers",
nodenames = {"mesecons_pistons:piston_up_pusher_normal", "mesecons_pistons:piston_up_pusher_sticky"},
action = function(pos, node)
if string.find(node.name, "sticky") then
node.name = "mesecons_pistons:piston_pusher_sticky"
else
node.name = "mesecons_pistons:piston_pusher_normal"
end
local dir = {x=0, y=-1, z=0}
node.param2 = minetest.dir_to_facedir(dir, true)
minetest.swap_node(pos, node)
end
})
minetest.register_lbm({
label = "Convert down piston pushers to use facedir",
name = ":mesecons_pistons:update_down_pushers",
nodenames = {"mesecons_pistons:piston_down_pusher_normal", "mesecons_pistons:piston_down_pusher_sticky"},
action = function(pos, node)
if string.find(node.name, "sticky") then
node.name = "mesecons_pistons:piston_pusher_sticky"
else
node.name = "mesecons_pistons:piston_pusher_normal"
end
local dir = {x=0, y=1, z=0}
node.param2 = minetest.dir_to_facedir(dir, true)
minetest.swap_node(pos, node)
end
})

View File

@ -179,10 +179,6 @@ end
function mesecon.register_node(name, spec_common, spec_off, spec_on)
spec_common.drop = spec_common.drop or name .. "_off"
spec_common.__mesecon_basename = name
if spec_common.mesecon_wire then
-- Prevent wires from being rotated
spec_common.on_rotate = false
end
spec_on.__mesecon_state = "on"
spec_off.__mesecon_state = "off"

View File

@ -37,6 +37,7 @@ minetest.register_node("mesecons_extrawires:corner_on", {
sunlight_propagates = true,
selection_box = corner_selectionbox,
node_box = corner_nodebox,
on_rotate = screwdriver.rotate_simple,
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons_extrawires:corner_off",
mesecons = {conductor =
@ -64,6 +65,7 @@ minetest.register_node("mesecons_extrawires:corner_off", {
sunlight_propagates = true,
selection_box = corner_selectionbox,
node_box = corner_nodebox,
on_rotate = screwdriver.rotate_simple,
groups = {dig_immediate = 3},
mesecons = {conductor =
{

View File

@ -38,6 +38,7 @@ minetest.register_node("mesecons_extrawires:tjunction_on", {
sunlight_propagates = true,
selection_box = tjunction_selectionbox,
node_box = tjunction_nodebox,
on_rotate = screwdriver.rotate_simple,
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons_extrawires:tjunction_off",
mesecons = {conductor =
@ -65,6 +66,7 @@ minetest.register_node("mesecons_extrawires:tjunction_off", {
sunlight_propagates = true,
selection_box = tjunction_selectionbox,
node_box = tjunction_nodebox,
on_rotate = screwdriver.rotate_simple,
groups = {dig_immediate = 3},
mesecons = {conductor =
{

View File

@ -84,6 +84,7 @@ mesecon.register_node("mesecons_extrawires:vertical", {
sunlight_propagates = true,
selection_box = vertical_box,
node_box = vertical_box,
on_rotate = false,
is_vertical_conductor = true,
drop = "mesecons_extrawires:vertical_off",
after_place_node = vertical_update,
@ -116,6 +117,7 @@ mesecon.register_node("mesecons_extrawires:vertical_top", {
groups = {dig_immediate=3, not_in_creative_inventory=1},
selection_box = top_box,
node_box = top_box,
on_rotate = false,
is_vertical_conductor = true,
drop = "mesecons_extrawires:vertical_off",
after_place_node = vertical_update,
@ -146,6 +148,7 @@ mesecon.register_node("mesecons_extrawires:vertical_bottom", {
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
selection_box = bottom_box,
node_box = bottom_box,
on_rotate = false,
is_vertical_conductor = true,
drop = "mesecons_extrawires:vertical_off",
after_place_node = vertical_update,

View File

@ -30,6 +30,7 @@ minetest.register_node("mesecons_insulated:insulated_on", {
type = "fixed",
fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }
},
on_rotate = screwdriver.rotate_simple,
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons_insulated:insulated_off",
mesecons = {conductor = {
@ -62,6 +63,7 @@ minetest.register_node("mesecons_insulated:insulated_off", {
type = "fixed",
fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }
},
on_rotate = screwdriver.rotate_simple,
groups = {dig_immediate = 3},
mesecons = {conductor = {
state = mesecon.state.off,

View File

@ -342,85 +342,3 @@ minetest.register_craft({
}
})
-- LBMs to convert old pistons to use facedir instead of separate up/down nodes
minetest.register_lbm({
label = "Convert up pistons to use facedir",
name = "mesecons_pistons:update_up_pistons",
nodenames = {"mesecons_pistons:piston_up_normal_on","mesecons_pistons:piston_up_normal_off",
"mesecons_pistons:piston_up_sticky_on","mesecons_pistons:piston_up_sticky_off"},
action = function(pos,node)
if string.find(node.name,"sticky") then
if string.sub(node.name,-3,-1) == "_on" then
node.name = "mesecons_pistons:piston_sticky_on"
else
node.name = "mesecons_pistons:piston_sticky_off"
end
else
if string.sub(node.name,-3,-1) == "_on" then
node.name = "mesecons_pistons:piston_normal_on"
else
node.name = "mesecons_pistons:piston_normal_off"
end
end
local dir = {x=0,y=-1,z=0}
node.param2 = minetest.dir_to_facedir(dir,true)
minetest.swap_node(pos,node)
end
})
minetest.register_lbm({
label = "Convert down pistons to use facedir",
name = "mesecons_pistons:update_down_pistons",
nodenames = {"mesecons_pistons:piston_down_normal_on","mesecons_pistons:piston_down_normal_off",
"mesecons_pistons:piston_down_sticky_on","mesecons_pistons:piston_down_sticky_off"},
action = function(pos,node)
if string.find(node.name,"sticky") then
if string.sub(node.name,-3,-1) == "_on" then
node.name = "mesecons_pistons:piston_sticky_on"
else
node.name = "mesecons_pistons:piston_sticky_off"
end
else
if string.sub(node.name,-3,-1) == "_on" then
node.name = "mesecons_pistons:piston_normal_on"
else
node.name = "mesecons_pistons:piston_normal_off"
end
end
local dir = {x=0,y=1,z=0}
node.param2 = minetest.dir_to_facedir(dir,true)
minetest.swap_node(pos,node)
end
})
minetest.register_lbm({
label = "Convert up piston pushers to use facedir",
name = "mesecons_pistons:update_up_pushers",
nodenames = {"mesecons_pistons:piston_up_pusher_normal","mesecons_pistons:piston_up_pusher_sticky"},
action = function(pos,node)
if string.find(node.name,"sticky") then
node.name = "mesecons_pistons:piston_pusher_sticky"
else
node.name = "mesecons_pistons:piston_pusher_normal"
end
local dir = {x=0,y=-1,z=0}
node.param2 = minetest.dir_to_facedir(dir,true)
minetest.swap_node(pos,node)
end
})
minetest.register_lbm({
label = "Convert down piston pushers to use facedir",
name = "mesecons_pistons:update_down_pushers",
nodenames = {"mesecons_pistons:piston_down_pusher_normal","mesecons_pistons:piston_down_pusher_sticky"},
action = function(pos,node)
if string.find(node.name,"sticky") then
node.name = "mesecons_pistons:piston_pusher_sticky"
else
node.name = "mesecons_pistons:piston_pusher_normal"
end
local dir = {x=0,y=1,z=0}
node.param2 = minetest.dir_to_facedir(dir,true)
minetest.swap_node(pos,node)
end
})

View File

@ -200,7 +200,6 @@ local function register_wires()
if nodeid ~= "00000000" then
groups_off["not_in_creative_inventory"] = 1
end
mesecon.register_node(":mesecons:wire_"..nodeid, {
description = "Mesecon",
drawtype = "nodebox",
@ -212,6 +211,7 @@ local function register_wires()
selection_box = selectionbox,
node_box = nodebox,
walkable = false,
on_rotate = false,
drop = "mesecons:wire_00000000_off",
mesecon_wire = true
}, {tiles = tiles_off, mesecons = meseconspec_off, groups = groups_off},