Update mcl_item_id

This commit is contained in:
the-real-herowl 2024-05-02 06:21:52 +02:00 committed by teknomunk
parent cd8d82aa60
commit ebd9be84fd

@ -2,7 +2,7 @@ mcl_item_id = {
mod_namespaces = {}, mod_namespaces = {},
} }
local game = "mineclone" local game = "voxelibre"
function mcl_item_id.set_mod_namespace(modname, namespace) function mcl_item_id.set_mod_namespace(modname, namespace)
local namespace = namespace or modname local namespace = namespace or modname
@ -42,11 +42,13 @@ tt.register_snippet(function(itemstring)
local id_string = itemstring:sub(item_split) local id_string = itemstring:sub(item_split)
local id_modname = itemstring:sub(1, item_split - 1) local id_modname = itemstring:sub(1, item_split - 1)
local new_id = game .. id_string local new_id = game .. id_string
local alt_id = "mineclone" .. id_string
local mod_namespace = mcl_item_id.get_mod_namespace(id_modname) local mod_namespace = mcl_item_id.get_mod_namespace(id_modname)
for mod, ids in pairs(same_id) do for mod, ids in pairs(same_id) do
for _, id in pairs(ids) do for _, id in pairs(ids) do
if itemstring == "mcl_" .. mod .. ":" .. id then if itemstring == "mcl_" .. mod .. ":" .. id then
new_id = game .. ":" .. id .. "_" .. mod:gsub("s", "") new_id = game .. ":" .. id .. "_" .. mod:gsub("s", "")
alt_id = "mineclone:" .. id .. "_" .. mod:gsub("s", "")
end end
end end
end end
@ -55,6 +57,7 @@ tt.register_snippet(function(itemstring)
end end
if mod_namespace ~= id_modname then if mod_namespace ~= id_modname then
minetest.register_alias_force(new_id, itemstring) minetest.register_alias_force(new_id, itemstring)
minetest.register_alias_force(alt_id, itemstring)
end end
if minetest.settings:get_bool("mcl_item_id_debug", false) then if minetest.settings:get_bool("mcl_item_id_debug", false) then
return new_id, "#555555" return new_id, "#555555"