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

function gameinput (sender,obj_id,attachedID)    
Buttons_T(sender,obj_id)   
CursorTreatment(obj_id,sender,attachedID);
  if sender == 30 then
      DeleteResource("krysy_2");
      DeleteResource("krysy_3");
      DeleteResource("krysy_4");        
      DeleteResource("krysy_6");     
      DeleteResource("krysy_7");     
      DeleteResource("krysy_8");     
      DeleteResource("krysy_9");    
      DeleteResource("zagig");  
    setcurentleaf("koridor",15,0);    
    DarkScreen(false);
    Block_Show_Cur(false);
    if flags.stop_fire then
      StopEffect("fire",true);
      StopEmiter("fire_krysy_loc");
      Set_Anim_Cur(12,3)
       ActivateObject(9,false);
       set_visible_object(12,false)
        if not flags.krisi_out then
        --speciale_action(2,12);
        speciale_action(2,5)    
        flags.krisi_out=true;
        end;
      speciale_action(2,13)
      Set_Anim_Cur(13,2);
      StopEmiter("krysaki");
      set_visible_object(9,false)

     -- speciale_action(2,9);
      AddParticleToObject(obj.lomaot.id,"nog",769,292);
      MoveEmiter("nog",769,292);
      StartEmiter("nog");
      Set_Anim_Cur(obj.lomaot.id,4)
      AddParticleToObject(13,"zavareno",547,322);
      MoveEmiter("zavareno",547,322);
      StartEmiter("zavareno");
    return; end;
    if flags.solar_complete and not flags.solar_completeM then
    flags.solar_completeM=true;
        speciale_action(2,9);
        Set_Anim_Cur(12,2)      
    end;
    if flags.fire_complete then
      if not flags.fire_complete_first then
        flags.fire_complete_first = true;
    --    Set_Anim_Cur(12,3)

        if not flags.krisi_out then        
    --    speciale_action(2,12)
        speciale_action(2,5)    
        flags.krisi_out=true;
        end;
        if not flags.solar_completeM then
        speciale_action(2,9);
    --    Set_Anim_Cur(9,2)
        end; 
      AddParticleToObject(12,"fire_krysy_loc",526,640);
      MoveEmiter("fire_krysy_loc",526,640);
      StartEmiter("fire_krysy_loc")
        playeffect("fire",true);      
      return;end;      
      AddParticleToObject(12,"fire_krysy_loc",526,640);
      MoveEmiter("fire_krysy_loc",526,640);
      StartEmiter("fire_krysy_loc");
      playeffect("fire",true);
    return; end;
  return;end;
  

  
  if sender == 1 then
    
    if obj_id == 10 then
      if obj.solar ~= nil and attachedID == obj.solar.id then
        RemObjFromMouse()
        UnStoreObj(attachedID);
        flags.solar_complete = true;
        Set_Anim_Cur(10,3)
        Block_Show_Cur(true);
        speciale_action(2,7,true,2.5);
        playeffect("benzin")
        ActivateObject(8,false);
        ActivateObject(10,false);
        Set_Anim_Cur(9,4);
      return; end;
      if attachedID~=-1 and ((obj.solar~=nil and attachedID ~= obj.solar.id) or (obj.solar==nil ))  then
        RemObjFromMouse()
        CreatePlashechka(900000,"1000")
      return;end;     
      CreatePlashechka(900000,"428") 
    return; end;
    if obj_id == 9 and not flags.fire_complete then
      if obj.gaga ~= nil and attachedID == obj.gaga.id then
        RemObjFromMouse()
        UnStoreObj(attachedID);
        Block_Show_Cur(true);
        flags.fire_complete = true;        
        speciale_action(2,20,true,2)        
        
      return; end;
      if attachedID~=-1 and ((obj.gaga~=nil and attachedID ~= obj.gaga.id) or (obj.gaga==nil ))  then
        RemObjFromMouse()
        CreatePlashechka(900000,"1000")
      return;end;    
        CreatePlashechka(900000,"428")      
    return; end;
    if obj_id == 9 and flags.fire_complete then
      if obj.krugwa ~= nil and attachedID == obj.krugwa.id then
        RemObjFromMouse()
        UnStoreObj(attachedID);
        Block_Show_Cur(true);
        speciale_action(2,4,true);
        playeffect("stopfire")
      return; end;
      if attachedID~=-1 and ((obj.krugwa~=nil and attachedID ~= obj.krugwa.id) or (obj.krugwa==nil ))  then
        RemObjFromMouse() 
        CreatePlashechka(900000,"1000")
      return;end;          
      CreatePlashechka(900000,"447")
    return; end;
  return ;end;
  
  if sender==15 then
  if obj_id == 7 then
         Block_Show_Cur(false);
      CreatePlashechka(900000,"428")
      end;
  return;end;
  if sender == 16 then
    if obj_id == 7 then
              speciale_action(2,9,true,2.5);
    return; end;
    if obj_id==9 then
          speciale_action(2,7,true,2);
    return;end;
    if obj_id == 4 then
          StartTimer(9982,1);

      flags.stop_fire = true;
    return; end;
     if obj_id==23 then
        speciale_action(2,22,true,1)
        speciale_action(2,23,true,1)
        StartTimer(543,1.2)
    end; 
    if obj_id==20 then
    playeffect("zagig")
        speciale_action(2,20,true,1.9)
        speciale_action(2,21,true,2)
        speciale_action(2,22,true,1.9)
    return;end;
    if obj_id==21 then
        if startf<3 then
            startf=startf+1
            speciale_action(2,22,true,0.9)
            speciale_action(2,23,true,1)
            AddParticleToObject(21,"iskri1",646,470);
            MoveEmiter("iskri1",646,470);
            StartEmiter("iskri1");    
        else        
            speciale_action(2,22,true,1)
            speciale_action(2,25,true,1)
            AddParticleToObject(25,"svecha",644,475);
            MoveEmiter("svecha",644,475);
            StartEmiter("svecha");                
        end;
    return;end;    

    if obj_id==25 then
        StopEmiter("svecha");    
        speciale_action(2,25,true,2)
        speciale_action(2,21,true,2)    
        AddParticleToObject(9,"fire_krysy",422,514);
        MoveEmiter("fire_krysy",422,514);
        StartEmiter("fire_krysy");        
        AddParticleToObject(3,"fire_krysy2",598,360);
        MoveEmiter("fire_krysy2",598,360);
        StartEmiter("fire_krysy2");
        neighbors.reshetka.lock=false;
        speciale_action(2,8,true,1.5);        
        StartTimer(8982,3);
    return;end;    
  return; end;
  
  if sender == 100 then
  return; end;
  
  if sender == 36 then
     if obj_id==8982 then
        Block_Show_Cur(false);
    return;end; 
    if obj_id==9982 then
        StartTimer(9983,1);
        StopEmiter("fire_krysy");
    return;end;
    if obj_id==9983 then
        StartTimer(8882,2);
        StopEmiter("fire_krysy2");
    return;end;    
    if obj_id == 8882 then      
      clear_satelite_leaf("koridor");
    return; end;
    if obj_id==543 then
        if startf<3 then
            startf=startf+1
            speciale_action(2,22,true,0.9)
            speciale_action(2,23,true,1)
        else
            StopEmiter("iskri1");    
            speciale_action(2,22,true,1)
            speciale_action(2,25,true,3)
            AddParticleToObject(25,"svecha",644,475);
            MoveEmiter("svecha",644,475);
            StartEmiter("svecha");                
        end;    
    end;
  return; end;
  

end
function SheetSwitched(nCount)
end;