From: tenplus1 Date: Thu, 28 Sep 2017 14:18:52 +0000 (+0100) Subject: TNT: Add tnt.boom defaults X-Git-Tag: 0.4.17.1~15 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a52622669feca1ae098936eb97d8485cb70cbbc1;p=oweals%2Fminetest_game.git TNT: Add tnt.boom defaults This adds def, def.radius and def.damage_radius defaults to the tnt.boom() function if they aren't specified on call. --- diff --git a/game_api.txt b/game_api.txt index 00bbf455..d33c7c96 100644 --- a/game_api.txt +++ b/game_api.txt @@ -304,7 +304,7 @@ TNT API * `bottom` Bottom tile. By default the name of the tnt with a suffix of `_bottom.png`. * `burning` Top tile when lit. By default the name of the tnt with a suffix of `_top_burning_animated.png". -`tnt.boom(position, definition)` +`tnt.boom(position[, definition])` ^ Create an explosion. diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua index 9a76b927..7df9e270 100644 --- a/mods/tnt/init.lua +++ b/mods/tnt/init.lua @@ -387,6 +387,9 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne end function tnt.boom(pos, def) + def = def or {} + def.radius = def.radius or 1 + def.damage_radius = def.damage_radius or def.radius * 2 local meta = minetest.get_meta(pos) local owner = meta:get_string("owner") if not def.explode_center then