mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-03-15 04:11:24 +00:00
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.
This commit is contained in:
parent
6d850f23a5
commit
d6a66860af
1 changed files with 1 additions and 1 deletions
|
@ -399,7 +399,7 @@ function tnt.boom(pos, def)
|
||||||
local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection,
|
local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection,
|
||||||
def.ignore_on_blast, owner, def.explode_center)
|
def.ignore_on_blast, owner, def.explode_center)
|
||||||
-- append entity drops
|
-- 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)
|
entity_physics(pos, damage_radius, drops)
|
||||||
if not def.disable_drops then
|
if not def.disable_drops then
|
||||||
eject_drops(drops, pos, radius)
|
eject_drops(drops, pos, radius)
|
||||||
|
|
Loading…
Add table
Reference in a new issue