canskip=false
local object= 0
AddParticleToObject(1350,"MiniEnd");
MoveEmiter("MiniEnd", 512, 334);
clic=false;
function mini_create()
	init_mini(1);
	create_mini(8128);
end;

-- mini_start=false
mini2lvl5=true
MoveObjectX(20008, 511, 850, 3)
playeffect("055")
BlockCursor(true)

function gameinput(sender, obj_id, attachedID)
if not  flags.kartina then
MiniInterfaceHandler( sender, obj_id );
end
if sender == 10 then
	mini2lvl5=false
	finish_mini_game(true);	
		mini_start=false;
		leafobj={2235}
		GetRenderTarget(2235,"rendertar1");	
		function rendertar1(tex_name,tex_id)
			FlipVertical(2235);
			SetAlfa(2235,0,1,0,"vasea3353523")
			SetObjectPosition(2235,0,-256);
			LeaveObjectsOnReder("leafobj");
			ClosePlushes();	
			mini_start=false;
		return end
		
		
	-- ClosePlushes();
	plushes_were_closed=true
return; end;	
	
	
	if sender==26 then
		RemoveWindow(8,2.8,"DestroyMyWindow")
	
	end
	
	
	if sender == 30 then	
		c1(mini_start)
		if mini_start then
			StopAllEffects()
			setstatemenu()
			StopMusic()
			mini_start=false;
			c("gm")
		return;end
		SetCurrentLeaf("lab",5,0);
		ReturnHiddenObjects()      
		DeleteRenderTarget(2234)  
		DeleteRenderTarget(2235) 
		leafobj={}	
		OpenPlushes()
		Set_Cursor(obj.scan.id,3)		
	return; end;
	
	if sender==777 then		
			clear_satelite_leaf("lab");			
			flags.start_draw = true;			
			flags.finish_mini2=true;
			flags.start_mini3 =false;
			flags.mini_scan_complete= true;			
	end
	
	
	if sender == 35 then
	
		if obj_id== 19999 and not clic then
			set_visible_object(19999,false)
			set_visible_object(555,true)	
			speciale_action(4,555)
		end
		
		
	if flags.apparat and not flags.vibrali then
		if obj_id>= 20001 and obj_id<= 20006 then
			object=obj_id
			speciale_action(2,object+10000)
		return; end;
		return; end;
		
	return; end;
	if sender == 39 then
	
		if obj_id==555 and not clic then
		set_visible_object(19999,true)
		set_visible_object(555,false)
		speciale_action(4,19999)
		end
		
		
		if flags.apparat and not flags.vibrali then
		if obj_id>= 20001 and obj_id<= 20006 then
			object=obj_id	
			speciale_action(2,object+10000)
		return; end;
		return; end;
	return; end;

	if sender == 28 then	
			
		if obj_id == 20008 then
			speciale_action(2,20009,true,2)
				playeffect("056")
		end;
	return; end;
	if sender == 16 then
		if obj_id == 20009 then
			speciale_action(2,20010,true,2)
			playeffect("056")
		end;	
		if obj_id == 20010 then
			speciale_action(2,20001,true,2)
			playeffect("056")
		end;	
		if obj_id == 20001 then
			speciale_action(2,20002,true,0.5)
			playeffect("056")
		end;
		if obj_id == 20002 then
			speciale_action(2,20004,true,0.5)
			playeffect("056")
		end;
		if obj_id == 20004 then
			speciale_action(2,20003,true,0.5)
			playeffect("056")
		end;
		if obj_id == 20003 then
			speciale_action(2,20005,true,0.5)
			playeffect("056")
		end;
		if obj_id == 20005 then
			speciale_action(2,20006,true,0.5)
			playeffect("056")
		end;
		if obj_id == 20006 then
			CreateWindow(CWX,CWY,"668",3442,nil,100,230);
			BlockCursor(false)
			flags.apparat= true;
		end;
	return; end;
	if sender == 15 then
		if obj_id == 20006 then
			speciale_action(2,20003,true,0.5)
			playeffect("056")
		end;	
		if obj_id == 20003 then
			speciale_action(2,20004,true,0.5)
			playeffect("056")
		end;	
		if obj_id == 20004 then
			speciale_action(2,20002,true,0.5)
			playeffect("056")
		end;
		if obj_id == 20002 then
			speciale_action(2,20001,true,0.5)
			playeffect("056")
		end;
		if obj_id == 20001 then
			ColorCallaps(20005,100,5);
			StartTimer(200005,3)
		end;

	return; end;
	
	

	if sender == 36 then
		if obj_id == 200005 then
			speciale_action(2,20000,true,1.5)	
			speciale_action(2,19999,true,1.5)	
			speciale_action(4,19999)	
			BlockCursor(false)	
			flags.kartina=true
			set_visible_object( obj.mini_skip2.id, false );
			set_visible_object( obj.mini_help2.id, false );
			set_visible_object( obj.mini_skip_loading.id, false );
			set_visible_object( obj.mini_menu2.id, false );
			set_visible_object( obj.mini_skip1.id, false );
			set_visible_object( obj.mini_help1.id, false );
			set_visible_object( obj.mini_menu1.id, false );
			set_visible_object( obj.mini_skip.id, false );
			set_visible_object( obj.mini_help.id, false );
			set_visible_object( obj.mini_menu.id, false );		
		end;
	return; end;			
		
	if sender==6 then
		if thisId== 20001 or thisId== 20002 or thisId== 20003 or thisId== 20004 or thisId== 20006 then
			CreateWindow(CWX,CWY,"669",3442,nil,100,230)
			thisId=-1
		end
	end
	
	if sender == 1 then
		
		-- MiniInterfaceHandler( 1, obj_id );
		-- if obj_id == obj.mini_help1.id then
			-- CreateWindow(CWX,CWY,"668",3442,nil,100,230);
		-- end;
		if obj_id== 20001 or obj_id== 20002 or obj_id== 20003 or obj_id== 20004 or obj_id== 20006 then
			--CreateWindow(CWX,CWY,"669",3442,nil,100,230);
			thisId=obj_id
		return end;
		if obj_id== 20005  then
		playeffect("057")
			if flags.apparat then
				speciale_action(2,20006,true,0.7)
				speciale_action(2,30005,true,0.7)
				flags.vibrali= true
				BlockCursor(true)
			return; end;
		return; end;
		if obj_id== 555  then
				leafobj={2235}
		GetRenderTarget(2235,"rendertar1");	
		function rendertar1(tex_name,tex_id)
			FlipVertical(2235);
			SetAlfa(2235,0,1,0,"vasea3353523")
			SetObjectPosition(2235,0,-256);
			LeaveObjectsOnReder("leafobj");
			-- ClosePlushes();		
			finish_mini_game(true);
		return end
		--	set_visible_object(555,false)
			set_visible_object(19999,false)
			clic=true
		return; end;
		-- WaitRender();
	return; end;
	
	
	
return; end;
