From b4168ffda4ca7cf5955ac6daf910606cb5fcadd6 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Sat, 8 Jul 2017 21:17:33 +0100 Subject: [PATCH] TNT: Allow a custom explosion sound to be used --- init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 0326000..18ca304 100644 --- a/init.lua +++ b/init.lua @@ -384,7 +384,9 @@ end function tnt.boom(pos, def) local meta = minetest.get_meta(pos) local owner = meta:get_string("owner") - minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64}) + local sound = def.sound or "tnt_explode" + minetest.sound_play(sound, {pos = pos, gain = 1.5, + max_hear_distance = math.min(def.radius * 20, 128)}) minetest.set_node(pos, {name = "tnt:boom"}) local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection, def.ignore_on_blast, owner)