Hello everyone!
This is a very simple mod that deletes unkown blocks and removes unkown entities. Just insert there names in the tables in the first two lines and they will be removed when a player is close to them.
local old_nodes = {"mod:a", "mod:b"}
local old_entities = {}
for _,node_name in ipairs(old_nodes) do
minetest.register_node(":"..node_name, {
groups = {old=1},
})
end
minetest.register_abm({
nodenames = {"group:old"},
interval = 1,
chance = 1,
action = function(pos, node)
minetest.env:remove_node(pos)
end,
})
for _,entity_name in ipairs(old_entities) do
minetest.register_entity(":"..entity_name, {
on_activate = function(self, staticdata)
self.object:remove()
end,
})
end
Last edited by PilzAdam on Sat Jun 08, 2013 22:19, edited 1 time in total.
example use: i have a map that uses staircase, which ive updated and renamed since then to nbu, along with some of the nodenames. I cant switch the old mod for the new mod without ruining my map and i dont want to remove the UB's, just switch 'em :-)
example use: i have a map that uses staircase, which ive updated and renamed since then to nbu, along with some of the nodenames. I cant switch the old mod for the new mod without ruining my map and i dont want to remove the UB's, just switch 'em :-)
Good job on this mod. Came in really handy this morning as I'm resurrecting an old server and tossing out old mods that has been resulting in a load of orphaned nodes. As long as you keep track of the console window to get the name, it's a snap to add them to the init.lua, bump the server and away the blocks go.
I'm trying to remove the animals mod as it keeps crashing minetest, I've already removed the mod folder. I try running this mod with the following line
local old_nodes = {"animal_vombie:vombie","animal_dm:dm","animal_big_red:big_red","animal_chicken:chicken","animal_clownfish:clownfish","animal_cow:cow","animal_creeper:creeper","animal_deer:deer","animal_fish_blue_white:fish_blue_white","animal_gull:gull","animal_sheep:sheep","animal_wolf:wolf"}
But this doesnt seem to be working, am I missing something?
local old_entities = {"animal_vombie:vombie","animal_dm:dm","animal_big_red:big_red","animal_chicken:chicken","animal_clownfish:clownfish","animal_cow:cow","animal_creeper:creeper","animal_deer:deer","animal_fish_blue_white:fish_blue_white","animal_gull:gull","animal_sheep:sheep","animal_wolf:wolf"}
13:50:18: ERROR[main]: ========== ERROR FROM LUA ===========
13:50:18: ERROR[main]: Failed to load and run script from
13:50:18: ERROR[main]: C:\Users\Bgreco\Desktop\New foldergames\minetest-0.4.4-win32\bin\..\mods\minetest\clean\init.lua:
13:50:18: ERROR[main]: ...New foldergames\minetest-0.4.4-win32\bin\..\mods\minetest\clean\init.lua:3: 'in' expected near '}'
13:50:18: ERROR[main]: =======END OF ERROR FROM LUA ========
13:50:18: ERROR[main]: Server: Failed to load and run C:\Users\Bgreco\Desktop\New foldergames\minetest-0.4.4-win32\bin\..\mods\minetest\clean\init.lua
13:50:18: INFO[main]: BanManager: saving to C:\Users\Bgreco\Desktop\New foldergames\minetest-0.4.4-win32\bin\..\worlds\Hmmm\ipban.txt
13:50:19: ERROR[main]: ModError: Failed to load and run C:\Users\Bgreco\Desktop\New foldergames\minetest-0.4.4-win32\bin\..\mods\minetest\clean\init.lua
13:50:19: INFO[main]: Searching worlds...
13:50:19: INFO[main]: In C:\Users\Bgreco\Desktop\New foldergames\minetest-0.4.4-win32\bin\..\worlds:
13:50:19: INFO[main]: Hmmm moremods
13:50:19: INFO[main]: 2 found.
13:50:19: INFO[main]: Waiting for other menus
13:50:19: INFO[main]: Waited for other menus
13:50:19: VERBOSE[main]: error_message = ModError: Failed to load and run C:\Users\Bgreco\Desktop\New foldergames\minetest-0.4.4-win32\bin\..\mods\minetest\clean\init.lua
13:50:19: VERBOSE[main]: Check debug.txt for details.
13:50:19: INFO[main]: Created main menu
13:50:19: INFO[main]: locale has been set to:English_United States.1252
13:50:19: INFO[main]: locale has been set to:C
13:50:21: INFO[main]: locale has been set to:English_United States.1252
13:50:21: INFO[main]: locale has been set to:C
13:50:26: INFO[main]: Dropping main menu
13:50:26: INFO[main]: Updating configuration file: "C:\Users\Bgreco\Desktop\New foldergames\minetest-0.4.4-win32\bin\..\minetest.conf"
13:50:26: INFO[main]: Skipping writing of C:\Users\Bgreco\Desktop\New foldergames\minetest-0.4.4-win32\bin\..\minetest.conf because content wouldn't be modified
local old_nodes = {"snow:dirt_with_snow", "snow:snow", "snow:ice"}
local old_entities = {}
for _,node_name in ipairs(old_nodes) do
minetest.register_node(":"..node_name, {
groups = {old=1},
})
end
local old_nodes = {"mod:a", "mod:b"}
local old_entities = {}
for _,node_name in ipairs(old_nodes) do
minetest.register_node(":"..node_name, {
groups = {old=1},
})
end
minetest.register_abm({
nodenames = {"group:old"},
interval = 1,
chance = 1,
action = function(pos, node)
minetest.env:remove_node(pos)
end,
})
for _,entity_name in ipairs(old_entities) do
minetest.register_entity(":"..entity_name, {
on_activate = function(self, staticdata)
self.object:remove()
end,
})
end