Skip to content

Commit

Permalink
TNT: Add tnt.boom defaults
Browse files Browse the repository at this point in the history
This adds def, def.radius and def.damage_radius defaults to the
tnt.boom() function if they aren't specified on call.
  • Loading branch information
tenplus1 authored and paramat committed Oct 10, 2017
1 parent 12a9716 commit 3ff2969
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion game_api.txt
Expand Up @@ -358,7 +358,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.

Expand Down
3 changes: 3 additions & 0 deletions mods/tnt/init.lua
Expand Up @@ -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
Expand Down

0 comments on commit 3ff2969

Please sign in to comment.