
function length(vec)
	return math.sqrt(vec.x^2 + vec.y^2)
end

-- How bullets are produced make sure to generate bullet data, then pass it through createBullet
function onShoot() 
	rot = weapon.wielder.rotation
	data = weapon:genBulletData()
	for i=-20, 20, 10 do
		spread = i
		data.direction.x = math.cos(math.rad(rot + spread))
		data.direction.y = math.sin(math.rad(rot + spread))
		weapon:createBullet(data)
	end
end

-- How the bullet, target or wielder respond when the bullet hits a target.
function onHit(target, bullet, normal)
	target.physics.rigidBody:applyForce(normal, 5000.0);
end
