
AddParticleToObject(1,"Highlight");
MoveEmiter("Highlight",460,465);
AddParticleToObject(99,"cod");
MoveEmiter("cod",866,396);
-- CreateConsole()
StartEmiter("cod")
Set_Cursor(99,2);
				
WaitRender();

function gameinput(sender,obj_id,attachedID)
	if SLevel==1.0 then return; end;
--обработка плашки
	 if (sender == 1  or sender==5) and not isTimes  and imagetex~=-1 then
			set_visible_object(obj.plashechka.id,false)
			set_visible_object(obj[imagetex].id,false)
			del_object_from_game(5654547)		
			gameinput(26,imageid)		
del_object_from_game(5654547)	
				del_object_from_game(5654547)
				del_object_from_game(5654547)
				del_object_from_game(5654547)
				del_object_from_game(5654547)
				del_object_from_game(5654547)
				del_object_from_game(5654547)	
	end
	
	if sender == 2 then
		RemoveFromMouse(object);
		MessageProc(sender,obj_id);
	return;end;	
	
	if sender==28 then
		if flags.comics then		
			ClosePlushes()	
			flags.comics=false
			
			c("comics")
			StartTimer(2324214,0.4,"start_gu")
			function start_gu()
					flags.start_gutters=true
			end
			
		return; end;
		
	return;end

	
if sender ==41 then	
	RotateHandler(obj_id);	
if obj_id ==obj.dragonfly.id then	
	StartAnimation( 5555555555,1,5 );
	return;end;	
	return;end;
	
	if sender==26 then	
		if obj_id ==68 then		
		LevelComplete();
		return;end
	return;end
	
	if sender==777 then
--мини игра запуск	
		if flags.start_gutters then
			takeobjecttohand=true
			ShowMenu(false)
			c("start_mini")
			add_free_leaf("comics2",7,51);			
			dofile("./data/7/51/res.lua");
			set_satelite_leaf("cockpit");
			dofile("data\\7\\51\\level.lua");
			flags.start_gutters=false;
		return;end
	
	if flags.start_mini1 and not flags.mini1_complete then		
		leafobj={2234}
		GetRenderTarget(2234,"rendertar");	
		mininame="mini";
		mininum1=7;
		mininum2=10;
		mininame2="cockpit";
		return; end;
	if top_plush_id  then		
		ShowMenu(true)
		SwitchToSheet("re")
	end	
	end


	
	if sender == 12 then
--коллапс мусора	
	if not flags.items_collected then
		if obj_id == obj.rope2.id or obj_id == obj.gvozd.id or obj_id == obj.magnit.id or obj_id == obj.lopata.id or obj_id == obj.protivo.id or
			obj_id == obj.prujina.id or obj_id == obj.koleso.id or obj_id == obj.kirpi4.id or obj_id == obj.klubok.id or obj_id == obj.fonar.id or
			obj_id == obj.lom.id or obj_id == obj.ognetush.id or obj_id == obj.ranec.id or obj_id == obj.ranec2.id or obj_id == obj.shlem.id then
			
			if flags.items == 15 then
				flags.items_collected = true;				
				flags.wait_mini = true;				
				AlternateTimer("SwitchSheet1",1000)	
				StartTimer(6777,2);		
				flags.mini_go = true;
			end;
		 end;
		 end
	end
	if sender == 33 then		
		
		if not flags.finish then
		flags.finish = false;
			ShowMenu(true);
			SwitchToSheet("re");
		return end
	return;end;
	
	if sender == 100 then
		
		
		if flags.first_time_load then
				flags.first_time_load=false
			set_visible_object(obj.intro.id,true);
			speciale_action(4,obj.intro.id);
			flags.start_draw = false;
		return; end;
		
		
	return; end;
	if sender == 8 then
		HideGlove();
		 
		HideScaner();
		HideRentgen()
		HideNvg();
	return end;
	
if sender == 1 then		
--тыкаем на циферблат чтоб начать мини		
		if obj_id == 99  and attachedID ==-1 then
			if scaner_on then
				CreatePlashechka(9999,"70","goodgirl")
			return;end;
			if flags.mini_go then
				flags.mini_go = false;
				Set_Cursor( 99, 3 );
				ShowMenu( false );
				HideGlove()
				ClosePlushes();
				flags.start_mini1 = true;		
				else
				CreatePlashechka(688,"50","goodgirl")
			end
		return; end;		
--тыкаем на мусор	
	if obj_id == obj.rope2.id or obj_id == obj.gvozd.id or obj_id == obj.magnit.id or obj_id == obj.lopata.id or obj_id == obj.protivo.id or
			obj_id == obj.prujina.id or obj_id == obj.koleso.id or obj_id == obj.kirpi4.id or obj_id == obj.klubok.id or obj_id == obj.fonar.id or
			obj_id == obj.lom.id or obj_id == obj.ognetush.id or obj_id == obj.ranec.id or obj_id == obj.ranec2.id or obj_id == obj.shlem.id then
			if scaner_on then
				CreatePlashechka(9999,"70","goodgirl")
			return;end;	
				flags.items = flags.items + 1;
				CollapseObj(obj_id);
		
		 if obj_id == obj.ranec2.id then
			set_visible_object(101,false);
			flags.ten = true;
		 end;	
		 if obj_id == obj.shlem.id then
			set_visible_object(102,false);
			flags.ten2 = true;
		 end;
		return; end;

return; end;
	
	
return; end; 



function SelectRandom()
local dist=-1;local a=-1;local b=-1;local v=100;local t=-1;local diag=-1;
local width = -1;local height = -1;local radius=1.2;

--летит на циферблат				
	if flags.items >= 15 then
		if flags.mini_com and not flags.mini then
		computation(99)		
		end;
		return end
	ok = false
	while not ok do
		help_id = GetRandomObject();
		for i,v in pairs(obj) do
			if v.id == help_id and not v.is_collapsed then
				ok = true
				x,y=GetObjectPosition(v.id);
				x1,y1=GetObjectPosition(obj.dragonfly.id);
				width,height = GetObjectSize(v.id)
				a= (x-x1); b= (y-y1);  dist= math.sqrt (a^2+b^2);				
		        t=dist/400;		
                r = (math.sqrt(width^2+height^2)*0.5);		
				
				if r<50 then	r=75;	radius=4;	end  -- при радиусе меньше 50 определяем время кружения и радиус стрекозы
				
				if r>50 and r <100 then	r=87 radius=2.5;  end  --при радиусе больше 50 и меньше 100
				
				if r>100 then 	r=100 	radius=0.75;  end  -- при радиусе больше 100
				
				StartBigTravel(obj.dragonfly.id, v.id, 0, t, r/90, t, 2 ,radius);
			return end
		end
	end
end;
