clean old nodes

This commit is contained in:
Brett O'Donnell 2012-09-20 17:19:52 +09:30
parent 096ede397b
commit f2acb29911
2 changed files with 34 additions and 0 deletions

9
mods/_clean/README.txt Normal file
View File

@ -0,0 +1,9 @@
This mod deletes old blocks and objects from Minetest.
Insert the names of the old nodes in the table "old_nodes" like this:
local old_nodes = {"modname:nodename1", "modname:nodename2"}
The nodes will automatically be removed when a player is close to them.
The same will happen to entities when you insert there names
into the table "old_entities".
License:
Sourcecode: WTFPL

25
mods/_clean/init.lua Normal file
View File

@ -0,0 +1,25 @@
local old_nodes = {"flowers:flower_seaweed"}
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