Skip to content

Commit

Permalink
Fix missing ignore textures
Browse files Browse the repository at this point in the history
Revert "Fix "Ignoring CONTENT_IGNORE redefinition" warning (minetest#4393)"

This reverts commit 46bbace.

Then do the ignore tests in l_item.cpp instead of builtin/
  • Loading branch information
HybridDog committed May 13, 2018
1 parent d5d248c commit 3c2835f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 23 deletions.
10 changes: 1 addition & 9 deletions builtin/game/register.lua
Expand Up @@ -116,8 +116,6 @@ function core.register_item(name, itemdef)
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
Expand Down Expand Up @@ -179,13 +177,7 @@ function core.register_item(name, itemdef)
--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)
Expand Down
8 changes: 1 addition & 7 deletions src/nodedef.cpp
Expand Up @@ -1228,15 +1228,9 @@ content_t NodeDefManager::set(const std::string &name, const ContentFeatures &de
{
// 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
Expand Down
18 changes: 11 additions & 7 deletions src/script/lua_api/l_item.cpp
Expand Up @@ -536,14 +536,18 @@ int ModApiItemMod::l_register_item_raw(lua_State *L)
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);
content_t id = ndef->set(f.name, f);

if(id > MAX_REGISTERED_CONTENT){
throw LuaError("Number of registerable nodes ("
+ itos(MAX_REGISTERED_CONTENT+1)
+ ") exceeded (" + name + ")");
// when a mod reregisters ignore, only texture changes and such should
// be done
if (f.name != "ignore") {
content_t id = ndef->set(f.name, f);

if (id > MAX_REGISTERED_CONTENT) {
throw LuaError("Number of registerable nodes ("
+ itos(MAX_REGISTERED_CONTENT+1)
+ ") exceeded (" + name + ")");
}
}
}

Expand Down

0 comments on commit 3c2835f

Please sign in to comment.