jamawie

Mobfarm 3.0

Jul 25th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.25 KB | None | 0 0
  1. --mobfarm system
  2. bundledout = {}
  3. bundledout[1] = "white"
  4. bundledout[2] = "orange"
  5. bundledout[3] = "magenta"
  6. bundledout[4] = "lightBlue"
  7. bundledout[5] = "yellow"
  8. bundledout[6] = "lime"
  9. bundledout[7] = "pink"
  10. bundledout[8] = "gray"
  11. bundledout[9] = "lightGray"
  12. bundledout[10] = "cyan"
  13. bundledout[11] = "purple"
  14. bundledout[12] = "blue"
  15. bundledout[13] = "brown"
  16. bundledout[14] = "green"
  17. bundledout[15] = "red"
  18. bundledout[16] = "black"
  19.  
  20. playerinside = "top"
  21.  
  22. bundledin = {}
  23. bundledin[1] = 15
  24. bundledin[2] = 20
  25. bundledin[3] = 30
  26. bundledin[4] = 60
  27.  
  28. --do not edit anything
  29.  
  30. mon = peripheral.wrap("back")
  31.  
  32. kontostand = 0
  33. mobout = 0
  34.  
  35. function logo()
  36.     mon.setTextColor(colors.cyan)
  37.     mon.setBackgroundColor(colors.gray)
  38.     mon.setCursorPos((x-16)/2,1)
  39.     mon.write("Jo")
  40.     mon.setTextColor(colors.orange)
  41.     mon.write("Ja")
  42.     mon.setTextColor(colors.lightGray)
  43.     mon.write(" Productions")
  44. end
  45.  
  46. function midwrite(str, yP)
  47.     mon.setCursorPos((x-#str)/2,yP)
  48.     mon.write(str)
  49. end
  50.  
  51. function bdraw(num, str, ison)
  52.     if num > 0 and num < 5 then
  53.         yP = 4
  54.         xp = 12*(num-0)-10
  55.     elseif num > 4 and num < 9 then
  56.         yP = 8
  57.         xp = 12*(num-4)-10
  58.     elseif num > 8 and num < 13 then
  59.         yP = 12
  60.         xp = 12*(num-8)-10
  61.     elseif num > 12 and num < 17 then
  62.         yP = 16
  63.         xp = 12*(num-12)-10
  64.     else
  65.         return
  66.     end
  67.  
  68.     mon.setCursorPos(xp, yP)
  69.     if ison then
  70.         mon.setBackgroundColor(colors.lime)
  71.     else
  72.         mon.setBackgroundColor(colors.red)
  73.     end
  74.  
  75.     for i=1,10 do
  76.         mon.write(" ")
  77.     end
  78.  
  79.     mon.setCursorPos(xp+((10-#str)/2),yP)
  80.     mon.write(str)
  81. end
  82.  
  83. function start()
  84.     mon.clear()
  85.     x,y = mon.getSize()
  86.     mon.setBackgroundColor(colors.lightGray)
  87.     for i=1,y do
  88.         mon.setCursorPos(1,i)
  89.         for _=1,x do
  90.             mon.write(" ")
  91.         end
  92.     end
  93.     mon.setBackgroundColor(colors.gray)
  94.     for i=4,y-3 do
  95.         mon.setCursorPos(1,i)
  96.         for _=4,x-3 do
  97.             mon.write(" ")
  98.         end
  99.     end
  100.     midwrite("Klicke um fortzufahren...",y)
  101.     event, xPos, yPos = os.pullEvent("monitor_touch")
  102.     einwurf()
  103. end
  104.  
  105. function einwurf()
  106.         mon.clear()
  107.     x,y = mon.getSize()
  108.     mon.setBackgroundColor(colors.lightGray)
  109.     for i=1,y do
  110.         mon.setCursorPos(1,i)
  111.         for _=1,x do
  112.             mon.write(" ")
  113.         end
  114.     end
  115.     mon.setBackgroundColor(colors.gray)
  116.     for i=4,y-3 do
  117.         mon.setCursorPos(1,i)
  118.         for _=4,x-3 do
  119.             mon.write(" ")
  120.         end
  121.     end
  122.     midwrite("Klicke um fortzufahren...",y)
  123.     event, xPos, yPos = os.pullEvent()
  124.     if event == "redstone" then
  125.         number = 1
  126.         for k,v in pairs(bundledin) do
  127.             if rs.testBundledInput("right", number) then
  128.                 kontostand = kontostand + number
  129.             end
  130.             number = number * 2
  131.         end
  132.     elseif event == "monitor_touch" then
  133.         mobwahl()
  134.     else
  135.         einwurf()
  136.     end
  137. end
  138.  
  139. function mobwahl()
  140.     mon.clear()
  141.     x,y = mon.getSize()
  142.     mon.setBackgroundColor(colors.lightGray)
  143.     for i=1,y do
  144.         mon.setCursorPos(1,i)
  145.         for _=1,x do
  146.             mon.write(" ")
  147.         end
  148.     end
  149.     mon.setBackgroundColor(colors.gray)
  150.     for i=4,y-3 do
  151.         mon.setCursorPos(1,i)
  152.         for _=4,x-3 do
  153.             mon.write(" ")
  154.         end
  155.     end
  156.     midwrite("Waehle nun die Mobs aus...",y)
  157.     event, xPos, yPos = os.pullEvent()
  158.     for k,v in pairs(bundledout) do
  159.         num = 1
  160.         for i=1,k do
  161.             num = num * 2
  162.         end
  163.         bdraw(k,v,colors.test(mobout,num))
  164.     end
  165.     midwrite("Klicke um fortzufahren...",y)
  166.     event, xPos, yPos = os.pullEvent()
  167. end
  168.  
  169. start()
Add Comment
Please, Sign In to add comment