Use crack animation on all tile layers (#6104)

This commit is contained in:
Dániel Juhász 2017-08-28 05:51:55 +00:00 committed by Loïc Blot
parent 520b481383
commit 04158d0c84

@ -684,17 +684,16 @@ void getNodeTileN(MapNode mn, v3s16 p, u8 tileindex, MeshMakeData *data, TileSpe
INodeDefManager *ndef = data->m_client->ndef(); INodeDefManager *ndef = data->m_client->ndef();
const ContentFeatures &f = ndef->get(mn); const ContentFeatures &f = ndef->get(mn);
tile = f.tiles[tileindex]; tile = f.tiles[tileindex];
TileLayer *top_layer = NULL; bool has_crack = p == data->m_crack_pos_relative;
for (TileLayer &layer : tile.layers) { for (TileLayer &layer : tile.layers) {
if (layer.texture_id == 0) if (layer.texture_id == 0)
continue; continue;
top_layer = &layer;
if (!layer.has_color) if (!layer.has_color)
mn.getColor(f, &(layer.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;
} }
/* /*