Page 1 of 2

[Mod] Delete unknown blocks and objects [1] [clean]

PostPosted: Mon Aug 13, 2012 11:06
by PilzAdam
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.

Depends:
nothing

License:
Sourcecode: WTFPL

Download:
http://ompldr.org/vZjM5MA/clean.zip Broken (R.I.P. omploader)
Anyway, here is the init.lua:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
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

PostPosted: Mon Aug 13, 2012 11:45
by mauvebic
Feature request: renaming/migration

Say when you change the name of your mod, or the node, that you could do something like
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
nodeswitch('teacup:teacup','tea:cup')


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 :-)

PostPosted: Mon Aug 13, 2012 11:53
by PilzAdam
mauvebic wrote:Feature request: renaming/migration

Say when you change the name of your mod, or the node, that you could do something like
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
nodeswitch('teacup:teacup','tea:cup')


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 :-)

From lua-api.txt
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_alias(new_name, old_name)


After that you can use both in code and game, new_name and old_name.

PostPosted: Mon Aug 13, 2012 13:16
by cornernote
Thank you. +1

PostPosted: Mon Aug 13, 2012 13:27
by Neuromancer
+1. Nice.

PostPosted: Thu Aug 16, 2012 16:45
by sfan5
+1

PostPosted: Thu Aug 16, 2012 22:42
by RabbiBob
+1

PostPosted: Fri Aug 24, 2012 13:25
by rubenwardy
How to use?

local old_nodes = {xpanes:pane} does not work

PostPosted: Fri Aug 24, 2012 13:41
by PilzAdam
rubenwardy wrote:How to use?

local old_nodes = {xpanes:pane} does not work

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local old_nodes = {"xpanes:pane"}

PostPosted: Fri Aug 24, 2012 14:06
by xyz
rubenwardy wrote:How to use?

local old_nodes = {xpanes:pane} does not work

That will not work, to remove panes you should do it in such way:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local old_nodes = {"xpanes:pane_1", "xpanes:pane_2" [and so on] "xpanes:pane_15"}

PostPosted: Sun Sep 02, 2012 12:11
by RabbiBob
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.

PostPosted: Wed Sep 12, 2012 01:53
by SegFault22
+1

PostPosted: Thu Sep 27, 2012 03:30
by dleong21
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
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
 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?

PostPosted: Thu Sep 27, 2012 04:28
by cornernote
use old_entities for animals.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
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"}

PostPosted: Fri Nov 02, 2012 19:39
by Dragonop
YOU ARE MY HERO all tose ''old'' trees from mods and that can disapear COOL!

PostPosted: Sat Jan 19, 2013 19:46
by BenAmaranth
ModError: Failed to load and run C:\User\Bgreco\Desktop\Newfoldergames\minetest-0.4.4-win32\bin\..\mods\minetest\clean\init.lua

PostPosted: Sat Jan 19, 2013 19:49
by PilzAdam
BenAmaranth wrote:ModError: Failed to laod and run C:\User\Bgreco\Desktop\Newfoldergames\minetest-0.4.4-win32\bin\..\mods\minetest\clean\init.lua

Can you post the last ~20 lines of your debug.txt in the bin/ folder?

PostPosted: Sat Jan 19, 2013 19:57
by PilzAdam
BenAmaranth wrote:
PilzAdam wrote:
BenAmaranth wrote:ModError: Failed to laod and run C:\User\Bgreco\Desktop\Newfoldergames\minetest-0.4.4-win32\bin\..\mods\minetest\clean\init.lua

Can you post the last ~20 lines of your debug.txt in the bin/ folder?



Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
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

Can you post your first 2 lines of the init.lua?

PostPosted: Sat Jan 19, 2013 20:12
by BenAmaranth
Caught it upon examining the back up. Deleted one of these guys --> }

PostPosted: Sat Jan 19, 2013 20:13
by PilzAdam
BenAmaranth wrote:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local old_nodes = {"snow:dirt_with_snow", "snow:snow", "snow:ice"}

for _,node}
local old_entities = {_name in ipairs(old_nodes)

You messed it up a bit :-)
Here are the correct first 8 lines:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
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

PostPosted: Sat Jan 19, 2013 20:14
by BenAmaranth
Edit: Deleted old posts, thanks PilzAdam

PostPosted: Tue Feb 19, 2013 11:19
by socramazibi
Thanks, I found it very useful.

PostPosted: Wed Jun 05, 2013 20:20
by BrandonReese
Can you upload this to your dropbox or somewhere that actually works :-)

PostPosted: Wed Jun 05, 2013 21:58
by Casimir
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
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

PostPosted: Sat Jun 08, 2013 22:18
by keyxmakerx
Any news when the download will be fixed?

PostPosted: Sat Jun 08, 2013 22:19
by PilzAdam
keyxmakerx wrote:Any news when the download will be fixed?

See first post.

PostPosted: Sat Jun 08, 2013 22:23
by keyxmakerx
PilzAdam wrote:
keyxmakerx wrote:Any news when the download will be fixed?

See first post.


Sorry I'm not understanding. What if I don't know what the unknown blocks were?

PostPosted: Sat Jun 08, 2013 22:26
by PilzAdam
keyxmakerx wrote:
PilzAdam wrote:
keyxmakerx wrote:Any news when the download will be fixed?

See first post.


Sorry I'm not understanding. What if I don't know what the unknown blocks were?

Then you cant remove them with this mod.

PostPosted: Sun Jun 09, 2013 01:16
by BrandonReese
keyxmakerx wrote:
PilzAdam wrote:
keyxmakerx wrote:Any news when the download will be fixed?

See first post.


Sorry I'm not understanding. What if I don't know what the unknown blocks were?


Dig one and watch the console it will say <Player> digs <node name> at <position>

PostPosted: Sun Jun 09, 2013 04:53
by keyxmakerx
BrandonReese wrote:
keyxmakerx wrote:
PilzAdam wrote:See first post.


Sorry I'm not understanding. What if I don't know what the unknown blocks were?


Dig one and watch the console it will say <Player> digs <node name> at <position>


Thanks! It works now ^^