Log in

Hazza #2 [429.7]

140 rounds, 127 wins, 13 losses, 0 draws

Ships

RocketScanner2

{"name": "RocketScanner2", "parts": [{"name": "H","type": "brain","pos": [0,0],"rot": 0,"welds": [2,27,26,3]},{"type": "reinforced_hull","pos": [0,-2],"rot": 0,"welds": [26]},{"type": "reinforced_hull","pos": [0,1],"rot": 0,"welds": [4,5,9]},{"type": "reinforced_hull","pos": [1,0],"rot": 0},{"type": "reinforced_hull","pos": [-1,1],"rot": 0,"welds": [8,27]},{"type": "reinforced_hull","pos": [1,1],"rot": 0,"welds": [10,3]},{"type": "reinforced_hull","pos": [1,-1],"rot": 0,"welds": [26,3]},{"type": "reinforced_hull","pos": [-1,-1],"rot": 0,"welds": [27,26]},{"name": "R2","type": "rocket_launcher","pos": [-1,2],"rot": 0},{"name": "R3","type": "rocket_launcher","pos": [0,2],"rot": 0},{"name": "R4","type": "rocket_launcher","pos": [1,2],"rot": 0},{"type": "reinforced_hull","pos": [-2,0],"rot": 0,"welds": [19,21,27]},{"type": "reinforced_hull","pos": [2,0],"rot": 0,"welds": [20,22,3]},{"name": "R1","type": "rocket_launcher","pos": [-3,1],"rot": 0},{"name": "R5","type": "rocket_launcher","pos": [3,1],"rot": 0},{"name": "TL","type": "thruster","pos": [-1,-2],"rot": 3,"welds": [1]},{"name": "TR","type": "thruster","pos": [1,-2],"rot": 1,"welds": [1]},{"name": "TBL","type": "thruster","pos": [-3,-1],"rot": 0},{"name": "TBR","type": "thruster","pos": [3,-1],"rot": 0},{"type": "reinforced_hull","pos": [-3,0],"rot": 0,"welds": [23,13,17]},{"type": "reinforced_hull","pos": [3,0],"rot": 0,"welds": [25,14,18]},{"name": "SFL","type": "ranger","pos": [-2,1],"rot": 0},{"name": "SFR","type": "ranger","pos": [2,1],"rot": 0},{"name": "SL","type": "ranger","pos": [-4,0],"rot": 1},{"name": "SB","type": "ranger","pos": [0,-3],"rot": 2,"welds": [1]},{"name": "SR","type": "ranger","pos": [4,0],"rot": 3},{"name": "GY","type": "gyroscope","pos": [0,-1],"rot": 0},{"type": "reinforced_hull","pos": [-1,0],"rot": 0}]}
lsl = true

function Start()
	if GY:Ang() > 90 and GY:Ang() < 180 then
		lsl = true
	elseif GY:Ang() > 270 and GY:Ang() < 360 then
		lsl = true
	else
		lsl = false
	end
	print(GY:Ang())
	print(lsl)
end

function Update()

	local av = GY:AngVel()
	local mav = 25

	S()

	if lsl then
		if av < mav then
			L()
		else
			R()
		end
	else
		if av > -mav then
			R()
		else
			L()
		end
	end
	
	if SL:Range() > 0 and not SL:IsAlly() then
		mav = 25
		lsl = true
	end
	if SR:Range() > 0 and not SR:IsAlly() then
		mav = 25
		lsl = false
	end
	if SB:Range() > 0 and not SB:IsAlly() then
		mav = 40
	end

	if SFL:Range() > 0 and not SFL:IsAlly() then
		--print("Seen on FL")
		mav = 10
		if SFR:Range() > 0 and not SFR:IsAlly() then
			print("Seen both")
			TA(av)
		elseif not SFR.alive then
			TA(av)
		else
			lsl = true
		end
	elseif not SFL.alive then
		if SFR:Range() > 0 and not SFR:IsAlly() then
			--print("Seen on FR")
			TA(av)
		end
	else
		if SFR:Range() > 0 and not SFR:IsAlly() then
			--print("Seen on FR")
			mav = 10
			lsl = false
		else
			--print("Not seen")
		end
	end

end

function TA(av)
	FA()
	if av < -7 then
		L()
	elseif av > 7 then
		R()
	end
end

function S()
	TBL:SetThrust(0)
	TBR:SetThrust(0)
	TL:SetThrust(0)
	TR:SetThrust(0)
end

function R()
	S()
	TBL:SetThrust(1)
	TR:SetThrust(1)
end

function L()
	S()
	TBR:SetThrust(1)
	TL:SetThrust(1)
end

function FA()
	S()
	R1:Fire()
	R2:Fire()
	R3:Fire()
	R4:Fire()
	R5:Fire()
end