Create indestructible nodes after all mods load
This commit is contained in:
parent
665ec17c69
commit
8b1de22854
1 changed files with 17 additions and 15 deletions
|
@ -117,20 +117,22 @@ local function make_immortal(def)
|
||||||
def.description = def.description and ("Indestructible " .. def.description)
|
def.description = def.description and ("Indestructible " .. def.description)
|
||||||
end
|
end
|
||||||
|
|
||||||
local registered_nodes = table.copy(minetest.registered_nodes)
|
minetest.register_on_mods_loaded(function()
|
||||||
for name, def in pairs(registered_nodes) do
|
local registered_nodes = table.copy(minetest.registered_nodes)
|
||||||
local mod, nodename = name:match"(..-):(.+)"
|
for name, def in pairs(registered_nodes) do
|
||||||
local prefix = mod_prefixes[mod]
|
local mod, nodename = name:match"(..-):(.+)"
|
||||||
if nodename and prefix and not (def.groups and def.groups.mortal) then
|
local prefix = mod_prefixes[mod]
|
||||||
-- HACK to preserve backwards compatibility
|
if nodename and prefix and not (def.groups and def.groups.mortal) then
|
||||||
local new_name = ":ctf_map:" .. prefix .. nodename
|
-- HACK to preserve backwards compatibility
|
||||||
if def.drop == name then
|
local new_name = ":ctf_map:" .. prefix .. nodename
|
||||||
def.drop = new_name
|
if def.drop == name then
|
||||||
end
|
def.drop = new_name
|
||||||
make_immortal(def)
|
end
|
||||||
minetest.register_node(new_name, def)
|
make_immortal(def)
|
||||||
if mod == "wool" then
|
minetest.register_node(new_name, def)
|
||||||
minetest.register_alias("ctf_map:" .. nodename, new_name)
|
if mod == "wool" then
|
||||||
|
minetest.register_alias("ctf_map:" .. nodename, new_name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end)
|
||||||
|
|
Loading…
Reference in a new issue