Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pcall(function() computer,component = require("computer"),require("component") end)
- function chekDatabase() for _ in component.list("database") do return false end return true end
- function printT(a) pcall(function() print(a) end) end
- while chekDatabase() do printT("Отсутствует база данных") computer.beep(800,0.3) computer.pullSignal() end
- for _, mod in component.list() do if mod ~= 'computer' then pcall(load(mod..' = component.proxy(component.list(\"'..mod..'\")())')) end end -- Подключаем все компоненты
- inv = inventory_controller
- db = database
- while not inv.getInventorySize(3) do printT("Отсутствует реактор перед роботом") computer.beep(800,0.3) end
- size = inv.getInventorySize(3)-4 -- Размер реактора. ( -4 , потому что есть скрытые слоты по углам, видимо реактор переделан от жидкостного реактора)
- local maxSlot = inv.getInventorySize(1)
- if not maxSlot then
- printT("Сундук сверху не найден")
- computer.beep(800,0.3)
- end
- for i = 1, size do
- if not inv.getStackInSlot(3,i) then -- Если этот слот в реаакторе свободен
- local item = db.get( i + ( math.ceil( i / (size/6) ) - 1 ) * ( 9 - (size/6) ) ) -- Функция для случая если слоты реактора не совпадают со слотами бд
- if item then -- если слот в базе данных НЕ пуст
- repeat
- local flag -- делаем флаг, для проверки. "Взят ли предмет из сундука"
- for j = 1, maxSlot do
- slot = inv.getStackInSlot(1,j)
- if slot and slot.name == item.name then -- Если предмет предмет похож на предмет из бд
- inv.suckFromSlot(1,j) -- забираем его из сундука
- flag = true
- break
- end
- end
- if not flag then printT(item.label.." не найден") computer.pullSignal(1) end
- until flag
- end
- inv.dropIntoSlot(3,i)
- end
- end
- printT("Mission Complete")
Add Comment
Please, Sign In to add comment