@@ -300,10 +300,10 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne
300
300
end
301
301
302
302
-- don't double-count tnt @ the center
303
- local v = a :index (pos .x , pos .y , pos .z )
304
- local c = data [v ]
305
- if (c == c_tnt or c == c_tnt_boom or c == c_tnt_burning ) then
306
- data [v ] = c_air
303
+ local vc = a :index (pos .x , pos .y , pos .z )
304
+ local ccid = data [vc ]
305
+ if (ccid == c_tnt or ccid == c_tnt_boom or ccid == c_tnt_burning ) then
306
+ data [vc ] = c_air
307
307
end
308
308
309
309
for z = pos .z - 2 , pos .z + 2 do
@@ -360,11 +360,23 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne
360
360
end
361
361
end
362
362
363
+ -- make the center of the explosion flash, if it's safe
364
+ ccid = data [vc ]
365
+ if ccid == c_air then
366
+ data [vc ] = c_tnt_boom
367
+ end
368
+
363
369
vm :set_data (data )
364
370
vm :write_to_map ()
365
371
vm :update_map ()
366
372
vm :update_liquids ()
367
373
374
+ -- make the center of the explosion flash, if it's safe
375
+ -- have to set the timer *after* data is written to the map
376
+ if ccid == c_air then
377
+ minetest .get_node_timer (pos ):start (0 )
378
+ end
379
+
368
380
-- call check_single_for_falling for everything within 1.5x blast radius
369
381
for y = - radius * 1.5 , radius * 1.5 do
370
382
for z = - radius * 1.5 , radius * 1.5 do
@@ -432,6 +444,13 @@ minetest.register_node("tnt:boom", {
432
444
groups = {dig_immediate = 3 , not_in_creative_inventory = 1 },
433
445
-- unaffected by explosions
434
446
on_blast = function () end ,
447
+ on_timer = function (pos , elapsed )
448
+ if elapsed > 0 then
449
+ minetest .remove_node (pos )
450
+ else
451
+ return true
452
+ end
453
+ end ,
435
454
})
436
455
437
456
minetest .register_node (" tnt:gunpowder" , {
0 commit comments