dofile("script\\gamemenu.lua");
dofile("script\\lib.lua");
set_inpun_fun("gameinput");

function LevelComplete()
	
	flags = {};
	
	flags.glove_taken = true;	
	flags.rentgen_taken = true;
	flags.nvg_taken = true;
	flags.scaner_taken = true;
	flags.pointer_taken = true;
	flags.restore_sheet = false;
	
	SaveGame1();
	delete_tree_leaf("Root","door");
	NextLevel(25);
end;
flags.glove_taken = true;	
flags.rentgen_taken = true;
flags.nvg_taken = true;
flags.scaner_taken = true;
rentgen_is_usable=false;
flags.first_time_load = true;
flags.parts_plased = 0;
flags.all_items = false;
flags.comics1 = true;
flags.comics2 = true;
flags.comics3 = true;
flags.door_open_24 = false;
flags.finish = false;
flags.anim  = false;
flags.n = 0;
flags.storedobj=0
flags.light1=true;
flags.light=false;
flags.nv_done=true;
flags.nvg_block=false;

if flags.restore_sheet then
	LoadGame();
	AddTool();
end;
flags.restore_sheet = true;
--if flags.bag then
	--AddTool();
	-- addstaticobjecttogame(777777777,"buttons",128,524,"",0,0,61,61);
	-- SetCurrentRM("menu");
		-- AddSheet(1001,sheet,"green_b",137,706,61,61,"green",182,655,681,91,50,30,15,20,1,56,777777777,8);
		-- AddLeftScroller(sheet,101,"scroll_l",nil,nil,nil,813,164,14,26);  -- draw over scene
		-- AddRightScroller(sheet,102,"scroll_r",nil,nil,nil,828,164,14,26); -- draw over scene
	-- SetCurrentRM("main");
--end;

AddTreeLeaf( "Root", "door", 24, 0 );

AddTxt();

LoadLeafRes( 24, 0 );

for name,o in pairs(obj) do--------------------------при загрузке уровня объекты с инвентаря не висят в углу
	if o.is_stored then
	SetObjectPosition(o.id,-1000,-1000)
  
	set_visible_object( o.id, true );
	end;
end

-- scene logic
flags.start_draw = true;
flags.parts_plased = 0;
if flags.gear1_24 then detail(5,obj.gear1_24.id); set_visible_object(55,true) set_visible_object(5,false) end; 
if flags.gear2_24 then detail(4,obj.gear2_24.id);  set_visible_object(44,true) set_visible_object(4,false)end; 
if flags.gear3_24 then detail(7,obj.gear3_24.id);  set_visible_object(77,true) set_visible_object(7,false)end; 
if flags.gear4_24 then detail(8,obj.gear4_24.id);  set_visible_object(88,true) set_visible_object(8,false)end; 
if flags.gear5_24 then detail(6,obj.gear5_24.id);  set_visible_object(66,true) set_visible_object(6,false)end; 
if flags.porshen_24 then detail(15,obj.porshen_24.id);  set_visible_object(155,true) set_visible_object(15,false)end; 
if flags.mayatnik_24 then detail(11,obj.mayatnik_24.id); set_visible_object(111,true) set_visible_object(11,false) end; 
if flags.pila_24 then detail(3,obj.pila_24.id);  set_visible_object(33,true) set_visible_object(3,false)end;
-- end scene logic
StartAnimation( 5555555555,5,5 );
SetCurrentLeaf("door",24,0);
-- playfile(".\\sound\\117.ogg",true,true);
playeffect("117",true)