Advertisement
jamawie

DeepStorageUnit Inhaltsanzeiger

May 14th, 2016
1,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2.  
  3. mon = peripheral.wrap("back")
  4. sen = sensor.wrap("top")
  5.  
  6. mon.setTextScale(0.75)
  7. x,y = mon.getSize()
  8.  
  9. while true do
  10.   mon.clear()
  11.   mon.setCursorPos(1,1)
  12.   mon.setTextColor(colors.cyan)
  13.   for i=1,x do
  14.     mon.write("-")
  15.   end
  16.   mon.setCursorPos(math.floor((x-20)/2),2)
  17.   mon.setTextColor(colors.orange)
  18.   mon.write("DSU - Inhaltsanzeige")
  19.   mon.setCursorPos(math.floor((x-15)/2),3)
  20.   mon.write("made by jamawie")
  21.   mon.setTextColor(colors.cyan)
  22.   mon.setCursorPos(1,4)
  23.   for i=1,x do
  24.     mon.write("-")
  25.   end
  26.  
  27.  
  28.   mon.setTextColor(colors.lightGray)
  29.   targets = sen.getTargets()
  30.   xPos = 5
  31.   yPos = 8
  32.   mon.setCursorPos(xPos,yPos-1)
  33.   mon.write("X ,Y ,Z ")
  34.   for k,v in pairs(targets) do
  35.     if v.RawName == "powercrystals.factorydeepstorageunit" then
  36.       details = sen.getTargetDetails(k)
  37.       item = details.Slots[3].Name
  38.      
  39.       if yPos==y-1 then
  40.         xPos = xPos + 25
  41.         yPos = 8
  42.         mon.setCursorPos(xPos,yPos-1)
  43.         mon.write("X ,Y ,Z ")
  44.       end
  45.       mon.setCursorPos(xPos,yPos)
  46.       if item == "" then
  47.         mon.write(k .. ": " .. details.Slots[3].RawName)
  48.       else
  49.         mon.write(k .. ": " .. item)
  50.       end
  51.       yPos = yPos+1
  52.     end
  53.    
  54.   end
  55.   sleep(10)
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement