Advertisement
SirSheepe

Untitled

May 7th, 2023 (edited)
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. -- NjjN5BCh
  2.  
  3. local args = { ... }
  4.  
  5. if #args ~= 1 then
  6. error("Please provide the channel to listen on")
  7. end
  8.  
  9. local monitor = peripheral.find("monitor")
  10. local modem = peripheral.find("modem")
  11.  
  12. if monitor == nil then
  13. error("Please connect a monitor to the computer")
  14. end
  15.  
  16. if modem == nil or not modem.isWireless() then
  17. error("Please connect a wireless modem to the computer")
  18. end
  19.  
  20. local channel = tonumber(args[1])
  21.  
  22. modem.open(channel)
  23.  
  24. monitor.setPaletteColor(colors.orange, 0x48464D) -- discord light
  25. monitor.setPaletteColor(colors.magenta, 0x232427) -- discord darker
  26. monitor.setPaletteColor(colors.lightBlue, 0x5D5A63) -- discord lighter
  27. monitor.setPaletteColor(colors.yellow, 0xA09DA6) -- discord lightest
  28.  
  29. monitor.setPaletteColor(colors.lime, 0xe5e57b) -- discord lightest
  30. monitor.setPaletteColor(colors.pink, 0x85818D)
  31. monitor.setPaletteColor(colors.gray, 0x07C8F9) -- scanning
  32. monitor.setPaletteColor(colors.lightGray, 0x5CB270) -- found ore
  33.  
  34. monitor.setPaletteColor(colors.cyan, 0xf94144) -- bad
  35. monitor.setPaletteColor(colors.purple, 0xc77dff) -- storing
  36. monitor.setPaletteColor(colors.blue, 0x6A6771) --
  37.  
  38. monitor.setPaletteColor(colors.brown, 0x7C7A81) --
  39. monitor.setPaletteColor(colors.green, 0x817F86) --
  40.  
  41. local signaled = false
  42. local mapsx, mapsz
  43. local mnsx, mnsy
  44.  
  45. while true do
  46. local _, _, senderChannel, _, message = os.pullEvent("modem_message")
  47.  
  48. if senderChannel == channel then
  49. local map = message[1]
  50. local pos = message[2]
  51. local dir = message[3]
  52. local aim = { x = pos.x + dir.x, z = pos.z + dir.z }
  53. local status = message[4]
  54.  
  55. local sx = #map[pos.y]
  56. local sz = #map[pos.y][0]
  57.  
  58. local msx, msy = monitor.getSize()
  59.  
  60. if signaled == false or mapsz ~= sz or mapsx ~= sx or mnsx ~= msx or mnsy ~= msy then
  61. signaled = true
  62. monitor.clear()
  63. monitor.setBackgroundColor(colors.magenta)
  64.  
  65. local sc = 1
  66.  
  67. monitor.setTextScale(sc)
  68. while msx < sx or msy < sz and sc > 0.5 do
  69. monitor.setTextScale(sc)
  70. sc = sc - 0.1
  71. msx, msy = monitor.getSize()
  72. end
  73.  
  74. if msx < sx or msy < sz then
  75. monitor.clear()
  76. monitor = term
  77.  
  78. monitor.setPaletteColor(colors.orange, 0x48464D) -- discord light
  79. monitor.setPaletteColor(colors.magenta, 0x232427) -- discord darker
  80. monitor.setPaletteColor(colors.lightBlue, 0x5D5A63) -- discord lighter
  81. monitor.setPaletteColor(colors.yellow, 0xA09DA6) -- discord lightest
  82.  
  83. monitor.setPaletteColor(colors.lime, 0xe5e57b) -- discord lightest
  84. monitor.setPaletteColor(colors.pink, 0x85818D)
  85. monitor.setPaletteColor(colors.gray, 0x07C8F9) -- scanning
  86. monitor.setPaletteColor(colors.lightGray, 0x5CB270) -- found ore
  87.  
  88. monitor.setPaletteColor(colors.cyan, 0xf94144) -- bad
  89. monitor.setPaletteColor(colors.purple, 0xc77dff) -- storing
  90. monitor.setPaletteColor(colors.blue, 0x6A6771) --
  91.  
  92. monitor.setPaletteColor(colors.brown, 0x7C7A81) --
  93. monitor.setPaletteColor(colors.green, 0x817F86) --
  94.  
  95. monitor.clear()
  96. monitor.setBackgroundColor(colors.magenta)
  97.  
  98. msx, msy = monitor.getSize()
  99. end
  100.  
  101. mapsx = sx
  102. mapsz = sz
  103. mnsy = msy
  104. mnsx = msx
  105. end
  106.  
  107. monitor.setCursorPos((msx - sx) * 0.5, (msy - sz) * 0.5)
  108.  
  109. local smap = {}
  110.  
  111. for i = 0, sz do
  112. local str = ""
  113. for j = 0, sx do
  114. if i == pos.z and j == pos.x then
  115. if status == 0 then
  116. str = str .. "5"
  117. elseif status == 1 then
  118. str = str .. "7"
  119. elseif status == 2 then
  120. str = str .. "8"
  121. elseif status == 3 then
  122. str = str .. "9"
  123. elseif status == 4 then
  124. str = str .. "a"
  125. end
  126. elseif i == aim.z and j == aim.x and map[pos.y][j][i] == 0 then
  127. str = str .. "b"
  128. elseif i == aim.z and j == aim.x then
  129. str = str .. "6"
  130. else
  131. -- c is darker mined
  132. -- 4 is lighter mined
  133. -- 1 is darker solid
  134. -- 3 is lighter solid
  135. if map[pos.y - 1] ~= nil then --
  136. if map[pos.y][j][i] == 0 then
  137. if map[pos.y - 1][j][i] == 1 then
  138. str = str .. "3"
  139. else
  140. str = str .. "1"
  141. end
  142. else
  143. if map[pos.y - 1][j][i] == 1 then
  144. str = str .. "c"
  145. else
  146. str = str .. "4"
  147. end
  148. end
  149. else
  150. if map[pos.y][j][i] == 1 then
  151. str = str .. "4"
  152. else
  153. str = str .. "3"
  154. end
  155. end
  156. end
  157. end
  158. smap[i + 1] = str
  159. end
  160.  
  161. for i = 1, #smap do
  162. monitor.setCursorPos((msx - sx) * 0.5 + 1, (msy - sz) * 0.5 + i)
  163. monitor.blit(string.rep(" ", #smap[i]), smap[i], smap[i])
  164. end
  165.  
  166. monitor.setCursorPos(2, #smap + 1)
  167. end
  168. end
  169.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement