@@ -301,10 +301,10 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne
301
301
end
302
302
303
303
-- 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
308
308
end
309
309
310
310
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
361
361
end
362
362
end
363
363
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
+
364
370
vm :set_data (data )
365
371
vm :write_to_map ()
366
372
vm :update_map ()
367
373
vm :update_liquids ()
368
374
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
+
369
381
-- call check_single_for_falling for everything within 1.5x blast radius
370
382
for y = - radius * 1.5 , radius * 1.5 do
371
383
for z = - radius * 1.5 , radius * 1.5 do
@@ -433,6 +445,13 @@ minetest.register_node("tnt:boom", {
433
445
groups = {dig_immediate = 3 , not_in_creative_inventory = 1 },
434
446
-- unaffected by explosions
435
447
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 ,
436
455
})
437
456
438
457
minetest .register_node (" tnt:gunpowder" , {
0 commit comments