mirror of
				https://github.com/luanti-org/minetest_game.git
				synced 2025-11-04 09:15:29 +01:00 
			
		
		
		
	Tnt: Avoid divide-by-zero errors in calc_velocity()
This commit is contained in:
		@@ -110,6 +110,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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user