end
itemdef.name = name
- local is_overriding = core.registered_items[name]
-
-- Apply defaults and add to registered_* table
if itemdef.type == "node" then
-- Use the nodebox as selection box if it's not set manually
--core.log("Registering item: " .. itemdef.name)
core.registered_items[itemdef.name] = itemdef
core.registered_aliases[itemdef.name] = nil
-
- -- Used to allow builtin to register ignore to registered_items
- if name ~= "ignore" then
- register_item_raw(itemdef)
- elseif is_overriding then
- core.log("warning", "Attempted redefinition of \"ignore\"")
- end
+ register_item_raw(itemdef)
end
function core.unregister_item(name)
{
// Pre-conditions
assert(name != "");
+ assert(name != "ignore");
assert(name == def.name);
- // Don't allow redefining ignore (but allow air and unknown)
- if (name == "ignore") {
- warningstream << "NodeDefManager: Ignoring "
- "CONTENT_IGNORE redefinition"<<std::endl;
- return CONTENT_IGNORE;
- }
-
content_t id = CONTENT_IGNORE;
if (!m_name_id_mapping.getId(name, id)) { // ignore aliases
// Get new id
idef->registerItem(def);
// Read the node definition (content features) and register it
- if(def.type == ITEM_NODE){
+ if (def.type == ITEM_NODE) {
ContentFeatures f = read_content_features(L, table);
+ // when a mod reregisters ignore, only texture changes and such should
+ // be done
+ if (f.name == "ignore")
+ return 0;
+
content_t id = ndef->set(f.name, f);
- if(id > MAX_REGISTERED_CONTENT){
+ if (id > MAX_REGISTERED_CONTENT) {
throw LuaError("Number of registerable nodes ("
+ itos(MAX_REGISTERED_CONTENT+1)
+ ") exceeded (" + name + ")");