Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = require("robot")
- local computer = require("computer")
- local sides = require("sides")
- local component = require("component")
- local ser = require("serialization")
- local c = component.crafting
- local inventory = component.inventory_controller
- local left = robot.turnLeft
- local right = robot.turnRight
- local TURN = robot.turnAround
- local d = robot.detect
- local dUp = robot.detectUp
- local dDown = robot.detectDown
- local side = sides.front
- local size = ic.getInventorySize(side)
- if not size then return nil end
- print("inventory size: ", size)
- local nRail_names = {}
- nRail__names[1] = "minecraft:rail"
- nRail__names[2] = "TConstruct:rail.wood"
- local function isRail(stack_info)
- if stack_info == nil then
- return false
- end
- for index, known_rail_name in ipairs(nRail_names) do
- if stack_info.name == known_rail_name then
- return true
- end
- end
- return false
- end
- for slot=1,size do
- local stack_info = ic.getStackInSlot(side, slot)
- --- inspect the stack_info when it is not nil
- if isRail(stack_info) then
- print(stack_info.name, "found in slot", slot)
- ic.suckFromSlot(sides.front, slot)
- end
- end
- isRail(stack_info)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement