function mini_create()
  init_mini(true)
  create_mini(8128);

end

if flags.postavilSovu then
  -- ActivateObject(1,false)
  setCursor(1,3)
  setcolor(1,1,1,1,1)
end

if flags.postavilMolot then
  -- ActivateObject(2,false)
  setCursor(2,3)
  setcolor(2,1,1,1,1)
end

if flags.postavilVesy then
  -- ActivateObject(3,false)
  setCursor(3,3)
  setcolor(3,1,1,1,1)
end

if flags.postavilSovu and flags.postavilMolot and flags.postavilVesy and neighbors.ZalMuzeyaKandelabr.lock then
  setCursor(1,4)
  setCursor(2,4)
  setCursor(3,4)
  if flags.tumbaVKabinete then
    speciale_action(2,10)
    speciale_action(2,101)
    set_visible_object(4,true)
  else
    miniCreate()
  end
end

local coords =
{
  {{x=438,y=143},{x=601,y=179},{x=767,y=212}};--sova
  {{x=463,y=138},{x=623,y=176},{x=790,y=207}};--molot
  {{x=398,y=175},{x=561,y=210},{x=729,y=244}};--vesy
}

local state = {2,3,1}

for i = 1,3 do
  SetObjectPosition(i, coords[i][state[i]].x, coords[i][state[i]].y)
end

local sel = nil

function gameinput (sender,obj_id,attachedID)
  MiniInterfaceHandler(sender, obj_id);
  sendersProcessing(sender, obj_id, attachedID);
  if wrongItemWarning(sender, obj_id, attachedID, "sova_10_1", "molotok_9_1", "vesy_10_1") then
    return
  end
  if NOW_MINI then
    if sender == 1 then
      if obj_id >= 1 and obj_id <= 3 then
        if sel then
          if sel == obj_id then
            setcolor(sel,1,1,1,1)
            sel = nil
          else
            state[sel],state[obj_id] = state[obj_id],state[sel]
            SetObjectPosition(sel, coords[sel][state[sel]].x, coords[sel][state[sel]].y)
            SetObjectPosition(obj_id, coords[obj_id][state[obj_id]].x, coords[obj_id][state[obj_id]].y)
            playeffect("st_kom")
            setcolor(sel,1,1,1,1)
            sel = nil
            for i=1,3 do
              if i~=state[i] then
                return
              end
            end
            finish_mini_game(true)
          end
        else
          sel = obj_id
          setcolor(sel,0.7,0.7,0.7,1)
        end
      end
    end
  else
    if sender==1 then
      if obj_id >= 1 and obj_id <= 3 then
        if ((obj.sova_10_1 and attachedID == obj.sova_10_1.id) or
        (obj.molotok_9_1 and attachedID == obj.molotok_9_1.id) or
        (obj.vesy_10_1 and attachedID == obj.vesy_10_1.id)) then
          -- if flags.kandelyabr then
            removeFromMouse()
            UnStoreObj(attachedID)
            Block_Show_Cur(true)
            playeffect("st_kom")
            if obj.sova_10_1 and attachedID == obj.sova_10_1.id then
              flags.postavilSovu = true
              -- ActivateObject(1,false)
              setCursor(1,3)
              SetAlfa(1,0.01,1,1,"unBlock_Show_Cur")
            elseif obj.molotok_9_1 and attachedID == obj.molotok_9_1.id then
              flags.postavilMolot = true
              -- ActivateObject(2,false)
              setCursor(2,3)
              SetAlfa(2,0.01,1,1,"unBlock_Show_Cur")
            elseif obj.vesy_10_1 and attachedID == obj.vesy_10_1.id then
              flags.postavilVesy = true
              -- ActivateObject(3,false)
              setCursor(3,3)
              SetAlfa(3,0.01,1,1,"unBlock_Show_Cur")
            end
          -- else
            -- CreatePlashechka("616")
          -- end
        else
          CreatePlashechka("480")
        end
        if flags.postavilSovu and flags.postavilMolot and flags.postavilVesy then
          setCursor(1,4)
  setCursor(2,4)
  setCursor(3,4)
          if neighbors.ZalMuzeyaKandelabr.lock then
          miniCreate()
          else
          CreatePlashechka("556")
          end;
        end
      end
      if obj_id == 4 then
        neighbors.Statuetki.lock = true
        CreateSatelite("MidBumagi")
        playeffect("sat")
      end
    end  
  end
  if sender == 10 then
    Block_Show_Cur(true)
    setCursor(1,3)
    setCursor(2,3)
    setCursor(3,3)
    -- SetObjectPosition(1,623,176)
    -- SetObjectPosition(2,729,244)
    -- SetObjectPosition(3,438,143)
    -- neighbors.Statuetki.lock = true
    flags.tumbaVKabinete = true
    
    StartTimer(timerID,1.1,"frame1")
  end
end

function frame1()
  speciale_action(2,101,true,1)
  StartTimer(timerID,1.5,"frame2")
end

function frame2()
playeffect("komod")
  speciale_action(2,10,true,1)
  StartTimer(timerID,2,"unBlock_Show_Cur")
  set_visible_object(4,true)
end

function frame3()
  Block_Show_Cur(false)
  -- CreateSatelite("MidBumagi")
end