Use crack animation on all tile layers (#6104)
authorDániel Juhász <juhdanad@gmail.com>
Mon, 28 Aug 2017 05:51:55 +0000 (05:51 +0000)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Mon, 28 Aug 2017 05:51:55 +0000 (07:51 +0200)
src/mapblock_mesh.cpp

index 0980d6ecd24647322f4b76afff2f399083567020..8fe00b052b27280c8904e1152338978fe78b69a5 100644 (file)
@@ -684,17 +684,16 @@ void getNodeTileN(MapNode mn, v3s16 p, u8 tileindex, MeshMakeData *data, TileSpe
        INodeDefManager *ndef = data->m_client->ndef();
        const ContentFeatures &f = ndef->get(mn);
        tile = f.tiles[tileindex];
-       TileLayer *top_layer = NULL;
+       bool has_crack = p == data->m_crack_pos_relative;
        for (TileLayer &layer : tile.layers) {
                if (layer.texture_id == 0)
                        continue;
-               top_layer = &layer;
                if (!layer.has_color)
                        mn.getColor(f, &(layer.color));
+               // Apply temporary crack
+               if (has_crack)
+                       layer.material_flags |= MATERIAL_FLAG_CRACK;
        }
-       // Apply temporary crack
-       if (p == data->m_crack_pos_relative)
-               top_layer->material_flags |= MATERIAL_FLAG_CRACK;
 }
 
 /*