Skip to content

Commit 8c71f3d

Browse files
sofarparamat
authored andcommittedApr 8, 2018
Prevent divide by zero (#2106)
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.
1 parent 9c459e7 commit 8c71f3d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

Diff for: ‎mods/tnt/init.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ function tnt.boom(pos, def)
401401
local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection,
402402
def.ignore_on_blast, owner, def.explode_center)
403403
-- append entity drops
404-
local damage_radius = (radius / def.radius) * def.damage_radius
404+
local damage_radius = (radius / math.max(1, def.radius)) * def.damage_radius
405405
entity_physics(pos, damage_radius, drops)
406406
if not def.disable_drops then
407407
eject_drops(drops, pos, radius)

0 commit comments

Comments
 (0)
Please sign in to comment.