function init()
	gun.name = "Torpedo"
	gun.fireDelay = 2000
	gun.shotrange = 6000--acts as fuse ms timer
	gun.shotspeed = 50
	gun.shotdamage = 3.1
	gun.shotknockback = 8000
	
	gun.reloadDelay = 3000
	gun.clipNum = 8
	
	gun.fixed = 4--forward
	
	return 0
end


function update()

	return 0
end


function fire()
	--store gun properties (after we create the torpedo, "gun" changes)
	original = gun
	
	if gun.fixed == 4 then
		fireangle = gun.owner.rot
	else
		fireangle = gun.firetheta
	end
	targetx = gun.firetarx
	targety = gun.firetary
	shotrange = math.sqrt((gun.firex-targetx)^2 + (gun.firey-targety)^2)*4
	--shotrange = gun.shotrange
	shotspeed =  gun.shotspeed
	owner = gun.owner
	shotdamage = gun.shotdamage
	shotknockback = gun.shotknockback
	
	--fire a missile
	stage.createShip("Torpedo", "null", gun.firex, gun.firey, 5)--, gun.owner.faction)
	ship.setWeaponDamage(shotdamage)
	ship.setWeaponKnockback(shotknockback)
	--aquire target
	ship.controller.goalx = targetx
	ship.controller.goaly = targety
	--set the fuse
	ship.controller.resetTimer("fuse", shotrange)
	--ignore owner (can't collide)
	ship.ignore(owner)
	--move at speed
	ship.movrot = fireangle
	ship.rot = fireangle
	ship.speed = shotspeed
	
	gun.sfx("gun_missilethoom.wav", ship.x, ship.y)

	return 0
end

function shot_update()

	return 0
end