Skip to content

Commit

Permalink
Prevent divide by zero (#2106)
Browse files Browse the repository at this point in the history
This forces all explosions to damage entities within the 1 node
range. If that needs to be disabled, the damage_radius needs to
be set to 0.
  • Loading branch information
sofar authored and paramat committed Apr 8, 2018
1 parent 9c459e7 commit 8c71f3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mods/tnt/init.lua
Expand Up @@ -401,7 +401,7 @@ function tnt.boom(pos, def)
local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection,
def.ignore_on_blast, owner, def.explode_center)
-- append entity drops
local damage_radius = (radius / def.radius) * def.damage_radius
local damage_radius = (radius / math.max(1, def.radius)) * def.damage_radius
entity_physics(pos, damage_radius, drops)
if not def.disable_drops then
eject_drops(drops, pos, radius)
Expand Down

0 comments on commit 8c71f3d

Please sign in to comment.