]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/nodedef.cpp
Merge branch 'master' of https://github.com/minetest/minetest
[dragonfireclient.git] / src / nodedef.cpp
index 9c85826c440412d57492618877ef574001390c1b..5954dac1e86200ad7d68e642f9c86542320d1e0c 100644 (file)
@@ -344,7 +344,7 @@ void ContentFeatures::reset()
                Cached stuff
        */
 #ifndef SERVER
-       solidness = 2;
+       solidness = 0;
        visual_solidness = 0;
        backface_culling = true;
 
@@ -1359,15 +1359,31 @@ void NodeDefManager::eraseIdFromGroups(content_t id)
 
 
 // IWritableNodeDefManager
-content_t NodeDefManager::set(const std::string &name, const ContentFeatures &def)
+content_t NodeDefManager::set(const std::string &name, const ContentFeatures &d)
 {
+       ContentFeatures def = d;
+       
        // Pre-conditions
        assert(name != "");
        assert(name != "ignore");
        assert(name == def.name);
 
        content_t id = CONTENT_IGNORE;
-       if (!m_name_id_mapping.getId(name, id)) { // ignore aliases
+       
+       if (m_name_id_mapping.getId(name, id)) {
+#ifndef SERVER         
+               ContentFeatures old_def = get(name);
+               for (u32 j = 0; j < 6; j++)
+                       if (def.tiledef[j].name.empty())
+                               def.tiledef[j] = old_def.tiledef[j];
+               for (u32 j = 0; j < 6; j++)
+                       if (def.tiledef_overlay[j].name.empty())
+                               def.tiledef_overlay[j] = old_def.tiledef_overlay[j];
+               for (u32 j = 0; j < CF_SPECIAL_COUNT; j++)
+                       if (def.tiledef_special[j].name.empty())
+                               def.tiledef_special[j] = old_def.tiledef_special[j];
+#endif
+       } else {
                // Get new id
                id = allocateId();
                if (id == CONTENT_IGNORE) {