@@ -301,10 +301,10 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne
301301 end
302302
303303 -- don't double-count tnt @ the center
304- local v = a :index (pos .x , pos .y , pos .z )
305- local c = data [v ]
306- if (c == c_tnt or c == c_tnt_boom or c == c_tnt_burning ) then
307- data [v ] = c_air
304+ local vc = a :index (pos .x , pos .y , pos .z )
305+ local ccid = data [vc ]
306+ if (ccid == c_tnt or ccid == c_tnt_boom or ccid == c_tnt_burning ) then
307+ data [vc ] = c_air
308308 end
309309
310310 for z = pos .z - 2 , pos .z + 2 do
@@ -361,11 +361,23 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne
361361 end
362362 end
363363
364+ -- make the center of the explosion flash, if it's safe
365+ ccid = data [vc ]
366+ if ccid == c_air then
367+ data [vc ] = c_tnt_boom
368+ end
369+
364370 vm :set_data (data )
365371 vm :write_to_map ()
366372 vm :update_map ()
367373 vm :update_liquids ()
368374
375+ -- make the center of the explosion flash, if it's safe
376+ -- have to set the timer *after* data is written to the map
377+ if ccid == c_air then
378+ minetest .get_node_timer (pos ):start (0 )
379+ end
380+
369381 -- call check_single_for_falling for everything within 1.5x blast radius
370382 for y = - radius * 1.5 , radius * 1.5 do
371383 for z = - radius * 1.5 , radius * 1.5 do
@@ -433,6 +445,13 @@ minetest.register_node("tnt:boom", {
433445 groups = {dig_immediate = 3 , not_in_creative_inventory = 1 },
434446 -- unaffected by explosions
435447 on_blast = function () end ,
448+ on_timer = function (pos , elapsed )
449+ if elapsed > 0 then
450+ minetest .remove_node (pos )
451+ else
452+ return true
453+ end
454+ end ,
436455})
437456
438457minetest .register_node (" tnt:gunpowder" , {
0 commit comments