Skip to content

Commit 3ff2969

Browse files
tenplus1paramat
authored andcommittedOct 10, 2017
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.
1 parent 12a9716 commit 3ff2969

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
 

‎game_api.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ TNT API
358358
* `bottom` Bottom tile. By default the name of the tnt with a suffix of `_bottom.png`.
359359
* `burning` Top tile when lit. By default the name of the tnt with a suffix of `_top_burning_animated.png".
360360

361-
`tnt.boom(position, definition)`
361+
`tnt.boom(position[, definition])`
362362

363363
^ Create an explosion.
364364

‎mods/tnt/init.lua

+3
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,9 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne
387387
end
388388

389389
function tnt.boom(pos, def)
390+
def = def or {}
391+
def.radius = def.radius or 1
392+
def.damage_radius = def.damage_radius or def.radius * 2
390393
local meta = minetest.get_meta(pos)
391394
local owner = meta:get_string("owner")
392395
if not def.explode_center then

0 commit comments

Comments
 (0)
Please sign in to comment.