Advertisement
tima_gt

tde-redstone 1.2 [OpenComputers]

Aug 15th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.43 KB | None | 0 0
  1. local event = require("event")
  2. local component = require("component")
  3. local sides = require("sides")
  4. local term = require("term")
  5. local gpu = component.gpu
  6. local redstone = component.redstone
  7. local colors = require("colors")
  8. local w, h = gpu.getResolution()
  9. dofile("tde-apis")
  10. rlogo = loadImage("tde-red")
  11. gpu.setBackground(0xFFFFFF)
  12. gpu.setForeground(0xFF0000)
  13. gpu.fill(1, 1, w, h, " ")
  14. term.setCursor(1, 1)
  15. io.write("[X]                     TDE-REDSTONE 1.2 OC Edition")
  16. redstone_on = false
  17. drawImage(rlogo)
  18. while true do
  19.   if redstone_on then
  20.     gpu.setBackground(0xFFFF00)
  21.     gpu.setForeground(0xFFFFFF)
  22.     gpu.fill((w / 2 / 2) - 10, h / 2 - 10, (w / 2 / 2) + 10, h / 2 + 10, " ")
  23.     gpu.setBackground(0xFF0000)
  24.     gpu.setForeground(0xFFFFFF)
  25.     fakel1 = ((w/ 2 /2 )) / 2 + 10
  26.     fakel2 =  h /2 - 9
  27.     fakel3 = ((w / 2 / 2) - 10) / 2 + 4
  28.     fakel4 =  h / 2 - 5
  29.     gpu.fill(fakel1, fakel2, fakel3, fakel4, " ")
  30.     gpu.setBackground(0xFFCC00)
  31.     fakel1 = ((w / 2 / 2) / 2 + 10)
  32.     fakel2 = h / 2 - 5 + 1
  33.     fakel3 = ((w / 4) - 10) / 2 + 4
  34.     fakel4 = h / 2 + 3
  35.     gpu.fill(fakel1, fakel2, fakel3, fakel4, " ")
  36.   else
  37.     gpu.setBackground(0xFF0000)
  38.     gpu.setForeground(0xFFFFFF)
  39.     gpu.fill((w / 2 / 2) - 10, h / 2 - 10, (w / 2 / 2) + 10, h / 2 + 10, " ")
  40.     gpu.setBackground(0xFFFF00)
  41.     gpu.setForeground(0xFFFFFF)
  42.     fakel1 = ((w/ 2 /2 )) / 2 + 10
  43.     fakel2 =  h /2 - 9
  44.     fakel3 = ((w / 2 / 2) - 10) / 2 + 4
  45.     fakel4 =  h / 2 - 5
  46.     gpu.fill(fakel1, fakel2, fakel3, fakel4, " ")
  47.     gpu.setBackground(0xFFCC00)
  48.     fakel1 = ((w / 2 / 2) / 2 + 10)
  49.     fakel2 = h / 2 - 5 + 1
  50.     fakel3 = ((w / 4) - 10) / 2 + 4
  51.     fakel4 = h / 2 + 3
  52.     gpu.fill(fakel1, fakel2, fakel3, fakel4, " ")
  53.   end
  54.   local event, adress, arg1, arg2, arg3 = event.pull()
  55.   if event == "touch" then
  56.     X = arg1
  57.     Y = arg2
  58.     if X >= (w / 2 / 2) - 10 and X <= (w / 2 / 2) + 10 and Y >= h / 2 - 10 and Y <= h / 2 + 10 and redstone_on then
  59.       redstone_on = false
  60.       redstone.setOutput(sides.back, 0)
  61.     elseif X >= (w / 2 / 2) - 10 and X <= (w / 2 / 2) + 10 and Y >= h / 2 - 10 and Y <= h / 2 + 10 and not redstone_on then
  62.       redstone_on = true
  63.       redstone.setOutput(sides.back, 100)
  64.     elseif X >= 1 and X <= 3 and Y == 1 then
  65.       break
  66.     end
  67.   end
  68. end
  69. redstone.setOutput(sides.back, 0)
  70. gpu.setBackground(0x000000)
  71. gpu.setForeground(0xFFFFFF)
  72. gpu.fill(1, 1, w, h, " ")
  73. term.setCursor(1, 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement