Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local com = require("component")
- local side = require("sides")
- local ic = com.transposer
- local rs = com.redstone
- local screen = com.screen
- local inSlot = ic.getStackInSlot
- local heatedCells = {}
- local nullCells = {}
- local quantityCells = {}
- local cellArray = {1,5,8,12,17,19,24,31,36,38,43,47,50,54}
- -- io.write( 'Хотите изменить схему? y|n \n' )
- -- local a = io.read()
- -- if a == 'y' then io.write( 'Введите через пробел номера слотов новой схемы, где будут элементы охлаждения\n' ) local s = io.read() cellArray = {} for number in string.gmatch(s, '[^%s]+') do table.insert(cellArray, number) end for k,v in pairs(cellArray) do print('['..k..']',v) end end
- local range = #cellArray
- function checkCells()
- for i = 1, range do
- inSlotCache = inSlot(side.up,cellArray[i])
- if inSlotCache ~= nil and (string.match(inSlotCache.label, "NaK Coolantcell") == "NaK Coolantcell" or string.match(inSlotCache.label, "He Coolantcell") == "He Coolantcell")
- then
- quantityCells[i] = cellArray[i]
- if inSlotCache.damage == 99
- then
- heatedCells[i] = cellArray[i]
- else
- if heatedCells[i] == cellArray[i] then heatedCells[i] = nil end
- end
- else
- if inSlotCache == nil and quantityCells[i] == cellArray[i] then quantityCells[i] = nil nullCells[i] = cellArray[i] end
- end
- end
- print(#quantityCells)
- if #heatedCells == 0 and #quantityCells == range then return true else return false end
- end
- function transferCells(heated, null)
- if #heated > 0 then
- for i = 1, #heated do
- print( 'Transfer cell outside from ' .. heated[i] .. 'slot' )
- ic.transferItem(side.up, side.south, 1, heated[i], 1)
- end
- end
- checkCells()
- for k, v in pairs( null ) do
- print( k, v )
- end
- print(#null)
- if #null > 0 then
- for k in pairs(null) do
- print( 'Transfer cell inside into ' .. null[k] .. ' slot' )
- ic.transferItem(side.north, side.up, 1, 2, null[k])
- print('ok')
- end
- nullCells = {}
- end
- greatLoop()
- end
- function greatLoop()
- while checkCells() == true do
- print('true')
- os.sleep(1)
- end
- if checkCells() == false then print('false') transferCells(heatedCells, nullCells) end
- end
- greatLoop()
Add Comment
Please, Sign In to add comment