add upgrader for old vine mod's nodes

This commit is contained in:
FaceDeer 2017-01-31 21:53:56 -07:00
parent 289a3c4c2d
commit c4d1bed474

@ -20,4 +20,29 @@ dofile( minetest.get_modpath( ropes.name ) .. "/crafts.lua" )
dofile( minetest.get_modpath( ropes.name ) .. "/ropeboxes.lua" )
dofile( minetest.get_modpath( ropes.name ) .. "/ladder.lua" )
local upgrade_counter = 1
-- For players who used to use the combined vine/rope mod fork I split this out of
local swapper = function(old_node, new_node)
minetest.register_lbm({
name = "ropes:vines_to_ropes_upgrade_" .. tostring(upgrade_counter),
nodenames = {old_node},
action = function(pos, node)
minetest.swap_node(pos, {name=new_node, param2=node.param2})
end
})
upgrade_counter = upgrade_counter + 1
end
for i=1,5 do
swapper(string.format("vines:%irope_block", i), string.format("ropes:%irope_block", i))
end
swapper("vines:rope", "ropes:rope")
swapper("vines:rope_bottom", "ropes:rope_bottom")
swapper("vines:rope_end", "ropes:rope_bottom")
swapper("vines:rope_top", "ropes:rope_top")
swapper("vines:ropeladder_top", "ropes:ropeladder_top")
swapper("vines:ropeladder", "ropes:ropeladder")
swapper("vines:ropeladder_bottom", "ropes:ropeladder_bottom")
swapper("vines:ropeladder_falling", "ropes:ropeladder_falling")
print("[Ropes] Loaded!")