diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua index 1e5d5a50..18bd9263 100644 --- a/mods/tnt/init.lua +++ b/mods/tnt/init.lua @@ -104,6 +104,11 @@ end local function calc_velocity(pos1, pos2, old_vel, power) + -- Avoid errors caused by a vector of zero length + if vector.equals(pos1, pos2) then + return old_vel + end + local vel = vector.direction(pos1, pos2) vel = vector.normalize(vel) vel = vector.multiply(vel, power)