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

User avatar
PilzAdam
Developer
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
Location: Germany
GitHub: PilzAdam
IRC: PilzAdam

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

by PilzAdam » Mon Aug 13, 2012 11:06

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:
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
Last edited by PilzAdam on Sat Jun 08, 2013 22:19, edited 1 time in total.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32
Location: Klach D'Kel Brakt, Canada

by mauvebic » Mon Aug 13, 2012 11:45

Feature request: renaming/migration

Say when you change the name of your mod, or the node, that you could do something like
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 :-)
"Fuck the hat." - Paulie Gualtieri
 

User avatar
PilzAdam
Developer
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
Location: Germany
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Mon Aug 13, 2012 11:53

mauvebic wrote:Feature request: renaming/migration

Say when you change the name of your mod, or the node, that you could do something like
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
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.
Last edited by PilzAdam on Mon Aug 13, 2012 11:53, edited 1 time in total.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02
 

User avatar
Neuromancer
Member
 
Posts: 794
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56
 

User avatar
sfan5
Moderator
 
Posts: 3678
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Thu Aug 16, 2012 16:45

+1
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
RabbiBob
Member
 
Posts: 335
Joined: Sat Jan 28, 2012 22:40
Location: /teleport 54,47,28
 

User avatar
rubenwardy
Developer
 
Posts: 4710
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Fri Aug 24, 2012 13:25

How to use?

local old_nodes = {xpanes:pane} does not work
 

User avatar
PilzAdam
Developer
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
Location: Germany
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Fri Aug 24, 2012 13:41

rubenwardy wrote:How to use?

local old_nodes = {xpanes:pane} does not work

Code: Select all
local old_nodes = {"xpanes:pane"}
 

User avatar
xyz
Member
 
Posts: 450
Joined: Thu Nov 10, 2011 14:25

by xyz » Fri Aug 24, 2012 14:06

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:
Code: Select all
local old_nodes = {"xpanes:pane_1", "xpanes:pane_2" [and so on] "xpanes:pane_15"}
 

User avatar
RabbiBob
Member
 
Posts: 335
Joined: Sat Jan 28, 2012 22:40
Location: /teleport 54,47,28

by RabbiBob » Sun Sep 02, 2012 12:11

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.
 

User avatar
SegFault22
Member
 
Posts: 870
Joined: Mon May 21, 2012 03:17
Location: NaN

by SegFault22 » Wed Sep 12, 2012 01:53

+1
Resources are abundant; only money is scarce. People should not have to work hard and remain poor just to pay for the needs of survival.
Society can thrive without money - but only if productive members of society are rewarded for being productive.
 

dleong21
 

by dleong21 » Thu Sep 27, 2012 03:30

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
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?
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Thu Sep 27, 2012 04:28

use old_entities for animals.

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"}
 

Dragonop
Member
 
Posts: 1178
Joined: Tue Oct 23, 2012 12:59
Location: Argentina
GitHub: Dragonop
IRC: Dragonop
In-game: Dragonop

by Dragonop » Fri Nov 02, 2012 19:39

YOU ARE MY HERO all tose ''old'' trees from mods and that can disapear COOL!
It's "Drag" for the friends.

Sorry I haven't been online as much lately, I'm real busy.
https://forum.minetest.net/download/file.php?id=4472
 

BenAmaranth
Member
 
Posts: 60
Joined: Thu Oct 04, 2012 15:14

by BenAmaranth » Sat Jan 19, 2013 19:46

ModError: Failed to load and run C:\User\Bgreco\Desktop\Newfoldergames\minetest-0.4.4-win32\bin\..\mods\minetest\clean\init.lua
Last edited by BenAmaranth on Sat Jan 19, 2013 19:49, edited 1 time in total.
Air (you hacker you!)
 

User avatar
PilzAdam
Developer
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
Location: Germany
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sat Jan 19, 2013 19:49

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?
 

User avatar
PilzAdam
Developer
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
Location: Germany
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sat Jan 19, 2013 19:57

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?



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?
 

BenAmaranth
Member
 
Posts: 60
Joined: Thu Oct 04, 2012 15:14

by BenAmaranth » Sat Jan 19, 2013 20:12

Caught it upon examining the back up. Deleted one of these guys --> }
Air (you hacker you!)
 

User avatar
PilzAdam
Developer
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
Location: Germany
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sat Jan 19, 2013 20:13

BenAmaranth wrote:
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:
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
 

BenAmaranth
Member
 
Posts: 60
Joined: Thu Oct 04, 2012 15:14

by BenAmaranth » Sat Jan 19, 2013 20:14

Edit: Deleted old posts, thanks PilzAdam
Air (you hacker you!)
 

socramazibi
Member
 
Posts: 81
Joined: Mon Jan 28, 2013 12:29
Location: España

by socramazibi » Tue Feb 19, 2013 11:19

Thanks, I found it very useful.
Forgive my English, but it is the translator of google.My Spanish.
My mod:
Pictures wool 1.0 3x5 , Charcoal+Textures , Map
 

User avatar
BrandonReese
Member
 
Posts: 837
Joined: Wed Sep 12, 2012 00:44
Location: USA
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese

by BrandonReese » Wed Jun 05, 2013 20:20

Can you upload this to your dropbox or somewhere that actually works :-)
 

User avatar
Casimir
Member
 
Posts: 1150
Joined: Fri Aug 03, 2012 16:59

by Casimir » Wed Jun 05, 2013 21:58

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
 

keyxmakerx
Member
 
Posts: 104
Joined: Mon Apr 08, 2013 23:53

by keyxmakerx » Sat Jun 08, 2013 22:18

Any news when the download will be fixed?
 

Next

Return to Mod Releases



Who is online

Users browsing this forum: Bing [Bot] and 6 guests