Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- shell.run("clear")
- sides = {"top","left","right","bottom","front","back"}
- for side = 1, #sides, 1 do
- if peripheral.isPresent(sides[side]) then
- na = peripheral.getType(sides[side])
- if na == "monitor" then
- print("Monitor wrapped")
- mon = peripheral.wrap(sides[side])
- elseif na == "sensor" then
- print("Sensor wrapped")
- sen = sensor.wrap(sides[side])
- end
- end
- end
- Wireless = 0
- globX, globY = mon.getSize()
- targs = sen.getTargets()
- if targs == nil or targs == "" then
- error("Kein ME WIRELESS ACCES POINT IN RANGE")
- end
- for v, k in pairs(targs) do
- if k.Name == "ME Wireless Access Point" then
- locale = v
- Wireless = Wireless + 1
- end
- end
- if Wireless < 1 then
- error("Kein ME WIRELESS ACCES POINT IN RANGE")
- end
- function tableSortSize(a,b)
- return(a.ItemSize > b.ItemSize)
- end
- function cbut(cx,cy,tcol,itemName, itemSize)
- if tcol == nil or tcol == "" then
- tcol = colors.white
- end
- mon.setTextColor(tcol)
- mon.setCursorPos(cx,cy)
- mon.clearLine(cy)
- mon.write(itemName .. ": " .. itemSize)
- mon.setTextColor(colors.white)
- end
- function itemClaim(itemName1, itemSize1,posX,posY,color)
- table.insert(items,{ItemName = itemName1,ItemSize = itemSize1,locationX = posX, locationY = posY, colorID = color})
- end
- mon.clear()
- while true do
- items = {}
- mon.setCursorPos(globX/2-9,1)
- mon.clearLine(1)
- mon.write("ME Inventar")
- s = sen.getTargetDetails(locale)
- for v, k in pairs(s.Items) do
- if k.Name == "UU-Matter" then
- itemClaim(k.Name,k.Size,2,0,colors.pink)
- elseif k.Name == "Iron Ingot" then
- itemClaim(k.Name,k.Size,2,0,colors.gray)
- end
- end
- table.sort(items,tableSortSize)
- for itemK=1, #items do
- cbut(items[itemK].locationX, itemK + 1, items[itemK].colorID, items[itemK].ItemName,items[itemK].ItemSize)
- end
- items = nil
- sleep(10)
- end
Add Comment
Please, Sign In to add comment