local complete = false;

function Buttons_T(sender,obj_id)
ButtonTreatment(obj_id,10001,10002,10003,CloseBtnX,CloseBtnY,34,34,sender,"vhod_turmy",false)     
end;

function gameinput (sender,obj_id,attachedID)   
CursorTreatment(obj_id,sender,attachedID);
Buttons_T(sender,obj_id)
  if sender == 30 then
      DeleteResource("generator02");
      DeleteResource("generator");    
      DeleteResource("generator11");      
    setcurentleaf("vhod_turmy",13,0);
    playeffect("generator");    
    DarkScreen(false);
    Block_Show_Cur(false);
    if flags.generator then
      Set_Anim_Cur(7,3);
      StopEmiter("generator");
      playeffect("generator_on",true);
      AddParticleToObject(42,"electro",50,178);
      MoveEmiter("electro",80,178);
      StartEmiter("electro");
      AddParticleToObject(4,"smoke",603,375);
      MoveEmiter("smoke",603,375);
      StartEmiter("smoke"); 
      StartTimer(87654321,3.2)
      StartTimer(87654322,9)
      CreatePlashechka(900000,"603")
    end;
  return;end;
  
  if sender == 1 then

    if obj_id == 9 then
          if not flags.zapravleno then
      RemObjFromMouse()
          -- flags.generator = true;
      -- StartTimer(8882,1);
      speciale_action(2,9,true);
      speciale_action(2,8,true);
     speciale_action(2,13,true);
      Set_Anim_Cur(13,4);
      flags.generat_open_bak = true;
      CreatePlashechka(900000,"382")
      return;end;
    return; end;
    if obj_id == 13 then
      if not flags.zapravleno then
      if (obj.solar~=nil) and (attachedID==obj.solar.id) then
        Set_Anim_Cur(13,3);
        RemObjFromMouse()
        playeffect("benzin");
        speciale_action(2,4,true);
        speciale_action(2,6,true);
        speciale_action(2,7,true);
        Block_Show_Cur(true);
      return; end;
      if attachedID~=-1 and ((obj.solar~=nil and attachedID ~= obj.solar.id) or (obj.solar==nil ))  then
        RemObjFromMouse()
        CreatePlashechka(900000,"382")
      return;end;          
      CreatePlashechka(900000,"382")
      return;end;
    return; end;
    if obj_id == 11 then
      if flags.zapravleno then
        RemObjFromMouse()
        playeffect("generator_on")
        Block_Show_Cur(true);
        speciale_action(2,10,true);
        speciale_action(2,11,true);
      return; end;
      CreatePlashechka(900000,"601")
    return; end;
  return ;end;

  if sender == 16 then
    if obj_id == 6 then
      speciale_action(2,5,true);
      speciale_action(2,6,true);
    return; end;
    if obj_id == 5 then
      speciale_action(2,4,true);
          return; end;
    if obj_id == 10 then
      Block_Show_Cur(true)
      flags.generator = true;
      StartTimer(8882,1);
    return; end;
  return; end;
  
  if sender == 15 then
    if obj_id == 4 then
      speciale_action(2,13);
      speciale_action(2,9,true);
      speciale_action(2,8,true);
      flags.zapravleno=true;
      Set_Anim_Cur(13,3);
      Block_Show_Cur(false);
      CreatePlashechka(900000,"383")
    return; end;
  return; end;
  
  
  if sender == 36 then
    if obj_id == 8882 then
      
      Block_Show_Cur(false)
      clear_satelite_leaf("vhod_turmy");
    return; end;
  return; end;
  


end
function SheetSwitched(nCount)
end;