function init()
	gun.name = "Tractor Beam"
	gun.fireDelay = 0
	gun.shotrange = 550
	gun.shotdamage = 0
	gun.shotknockback = 0
	gun.shotspeed = 8000
	--gun.initBeam(0)
	
	gun.vars.init("firedist", 0)
	
	--stage.GFP("starting tractor damage " .. gun.shotdamage)
	
	return 0
end


function update()
	return 0
end


function fire()
	--stage.GFP("precycle tractor damage " .. gun.shotdamage)

	gun.cycleBeam(5 + gun.vars.get("firedist"), 1)
	
	--stage.GFP("tractor damage " .. gun.shotdamage)
	
	gun.shotdamage = 0--never tracked down the bug that was setting it to 3.099999...
	
	--if our beam hits something, pull us towards it
	if stage.makeBeam(gun.beam, gun.owner, gun.firex, gun.firey, gun.firetarx, gun.firetary) == 1 then
		distmod = (gun.firedist / gun.shotrange)
		if distmod < 0 then distmod = 0 end
		if distmod >= .9 then distmod = .9 end

		force = (distmod * 8) ^ 2
		gun.vars.set("firedist", distmod)
		
		gun.owner.add_force(gun.firetheta, force)--pretty fancy/convoluted tech here, just FYI.
		
		--make some hint text
		--if gun.hasTimerTicked("hinttext", 8000) == 1 then
		--	stage.createText("Pull through gate to rescue!", gun.owner.x, gun.owner.y - 100, 1800)
		--end
	end

	return 0
end

function shot_update()
	return 0
end