Urumasi

Powder 0.1

Oct 26th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.05 KB | None | 0 0
  1. --Tables, variables
  2.  
  3. map = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  4.     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  5.     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  6.     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  7.     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  8.     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  36.     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
  37.  
  38. categories = {}
  39. categoriesN = {}
  40. elements = {}
  41. activeCat = 1
  42. activeEle = 1
  43. running = true
  44. shownText = ""
  45.  
  46. --Functions
  47.  
  48. function addCategory(catn, cat, catc) --Max categories are 19
  49.     categoriesN[catn] = {}
  50.     categoriesN[catn]["name"] = cat
  51.     categoriesN[catn]["char"] = catc
  52. end
  53. function addElement(catn, elen, name, nincat, desc, color, gravity, dtemp, mtemp, melt) --Max elements in a category is 6
  54.     if type(categories[catn]) ~= "table" then
  55.         categories[catn] = {}
  56.     end
  57.     categories[catn][nincat] = {}
  58.     categories[catn][nincat]["name"] = name
  59.     categories[catn][nincat]["desc"] = desc
  60.     categories[catn][nincat]["color"] = color
  61.     categories[catn][nincat]["gravity"] = gravity
  62.     categories[catn][nincat]["id"] = elen
  63.     categories[catn][nincat]["temp"] = dtemp
  64.     categories[catn][nincat]["mtemp"] = mtemp
  65.     categories[catn][nincat]["melt"] = melt
  66.     elements[elen] = {}
  67.     elements[elen][1] = catn
  68.     elements[elen][2] = nincat
  69. end
  70. function setElement(x, y, id)
  71.     map[y][x] = id
  72. end
  73. function drawScreen()
  74.     shell.run("clear")
  75.     for y=1, 17 do
  76.         term.setCursorPos(1, y)
  77.         for x=1, 50 do
  78.             if map[y][x] == 0 then
  79.                 term.setBackgroundColor(colors.black)
  80.             else
  81.                 term.setBackgroundColor(2^(categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["color"]))
  82.             end
  83.             write(" ")
  84.         end
  85.     end
  86.     for i=1, #categories do
  87.         term.setCursorPos(51, 19+i-#categories)
  88.         if activeCat == i then
  89.             term.setBackgroundColor(colors.white)
  90.             term.setTextColor(colors.black)
  91.         else
  92.             term.setBackgroundColor(colors.black)
  93.             term.setTextColor(colors.white)
  94.         end
  95.         write(categoriesN[i]["char"])
  96.     end
  97.     for i=1, #categories[activeCat] do
  98.         term.setCursorPos((i-1)*3+1, 19)
  99.         term.setTextColor(colors.black)
  100.         term.setBackgroundColor(2^(categories[activeCat][i]["color"]))
  101.         write(categories[activeCat][i]["name"])
  102.     end
  103.     term.setCursorPos(50-#shownText, 18)
  104.     term.setBackgroundColor(colors.black)
  105.     term.setTextColor(colors.white)
  106.     write(shownText)
  107. end
  108. function checkFallDown(x, y)
  109.     fd = "delete"
  110.     if map[y][x] == 0 or categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["gravity"] == 0 then
  111.         fd = false
  112.     end
  113.     if map[y][x] > 0 and categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["gravity"] > 0 then
  114.         if y == 17 then
  115.             fd = "delete"
  116.         elseif type(map[y+1]) == "table" then
  117.             if map[y+1][x] == 0 or (categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["gravity"] > categories[elements[map[y+1][x]][1]][elements[map[y+1][x]][2]]["gravity"] and categories[elements[map[y+1][x]][1]][elements[map[y+1][x]][2]]["gravity"] ~= 0) then
  118.                 fd = "down"
  119.             end
  120.         elseif type(map[y+1][x+1]) == "table" and type(map[y+1][x-1]) == "table" then
  121.             if (map[y+1][x-1] == 0 or (categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["gravity"] > categories[elements[map[y+1][x-1]][1]][elements[map[y+1][x-1]][2]]["gravity"] and categories[elements[map[y+1][x-1]][1]][elements[map[y+1][x-1]][2]]["gravity"] ~= 0)) and (map[y+1][x+1] == 0 or (categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["gravity"] > categories[elements[map[y+1][x+1]][1]][elements[map[y+1][x+1]][2]]["gravity"] and categories[elements[map[y+1][x+1]][1]][elements[map[y+1][x+1]][2]]["gravity"] ~= 0)) then
  122.                 if math.random(1, 2) == 1 then
  123.                     fd = "leftd"
  124.                 else
  125.                     fd = "rightd"
  126.                 end
  127.             end
  128.         elseif type(map[y+1][x-1]) == "table" then
  129.             if map[y+1][x-1] == 0 or (categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["gravity"] > categories[elements[map[y+1][x-1]][1]][elements[map[y+1][x-1]][2]]["gravity"] and categories[elements[map[y+1][x-1]][1]][elements[map[y+1][x-1]][2]]["gravity"] ~= 0) then
  130.                 fd = "leftd"
  131.             end
  132.         elseif type(map[y+1][x+1]) == "table" then
  133.             if map[y+1][x+1] == 0 or (categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["gravity"] > categories[elements[map[y+1][x+1]][1]][elements[map[y+1][x+1]][2]]["gravity"] and categories[elements[map[y+1][x+1]][1]][elements[map[y+1][x+1]][2]]["gravity"] ~= 0) then
  134.                 fd = "rightd"
  135.             end
  136.         end
  137.     end
  138.     return(fd)
  139. end
  140. function showCategory(catn)
  141.     activeCat = catn
  142.     shownText = categoriesN[catn]["name"]
  143. end
  144. function changeSelected(elen)
  145.     activeEle = elen
  146.     shownText = categories[activeCat][elements[elen][2]]["desc"]
  147. end
  148. function setTemp(x, y, stemp)
  149.     map[y][x] = stemp
  150. end
  151. function changeTemp(x, y, ctemp)
  152.     if ctemp > temps[y][x] then
  153.         temps[y][x] = 0
  154.     else
  155.         temps[y][x] = temps[y][x] + ctemp
  156.     end
  157. end
  158. function equalizeTemp(x1, y1, x2, y2)
  159.     if math.abs(temps[y1][x1] - temps[y2][x2]) > 1 then
  160.         if temps[y1][x1] > temps[y2][x2] then
  161.             etemp = (temps[y1][x1] / temps[y2][x2]) * 2
  162.         else
  163.             etemp = (temps[y2][x2] / temps[y1][x1]) * 2
  164.         end
  165.         if etemp > math.abs(temps[y1][x1] - temps[y2][x2]) then
  166.             etemp2 = (temps[y1][x1] + temps[y2][x2]) * 2
  167.         else
  168.             etemp2 = etemp
  169.         end
  170.         if temps[y1][x1] > temps[y2][x2] then
  171.             etemp3 = 0-etemp2
  172.         else
  173.             etemp3 = etemp2
  174.         end
  175.         changeTemp(x1, y1, etemp3)
  176.         changeTemp(x1, y1, 0-etemp3)
  177.     else
  178.         temps[y2][x2] = temps[y1][x1]
  179.     end
  180. end
  181.  
  182. --Preparation
  183.  
  184. addCategory(1, "Solids", "O")
  185. addElement(1, 1, "DMD", 1, "Indestructible solid", 0, 0, 300)
  186. addCategory(2, "Powders", ":")
  187. addElement(2, 2, "DST", 1, "Light particles.", 4, 2, 300)
  188. addElement(2, 3, "STN", 2, "Heavy particles.", 8, 3, 300)
  189. addElement(2, 4, "BMT", 3, "Very heavy particles.", 7, 4, 300, 1450, 5)
  190. addElement(2, 5, "LVA", 4, "Molten metal. For some reason in powder form.", 14, 1, 1700, 1450, 4)
  191.  
  192. --Main code
  193.  
  194. drawScreen()
  195. while true do
  196.     os.startTimer(0.2)
  197.     event = "temp"
  198.     while event ~= "timer" do
  199.         event, param1, param2, param3 = os.pullEvent()
  200.         if event == "key" then
  201.             if param1 == 16 then
  202.                 os.reboot()
  203.             elseif param1 == 57 then
  204.                 running = not running
  205.             elseif param1 == 41 then
  206.                 term.setCursorPos(1, 1)
  207.                 term.setTextColor(colors.white)
  208.                 term.setBackgroundColor(colors.black)
  209.                 print("|                                                 |")
  210.                 print("|                                                 |")
  211.                 print("+-------------------------------------------------+")
  212.                 term.setCursorPos(2, 1)
  213.                 command = read()
  214.                 if string.sub(command, 1, 3) == "set" then
  215.                     if string.sub(command, 5, 8) == "temp" then --set temp: [x];[y], [temp]
  216.                         tx = tonumber(string.sub(command, string.find(command, ":")+2, string.find(command, ";")-1))
  217.                         ty = tonumber(string.sub(command, string.find(command, ";")+1, string.find(command, ",")-1))
  218.                         ttemp = tonumber(string.sub(command, string.find(command, ",")+1, #command))
  219.                     end
  220.                     if type(tx) == "number" and type(ty) == "number" and type(ttemp) == "number" then
  221.                         setTemp(tx, ty, ttemp)
  222.                         term.setCursorPos(2, 2)
  223.                         write("Temperature of x: "..tx..", y: "..ty.." set to "..ttemp)
  224.                     else
  225.                         term.setCursorPos(2, 2)
  226.                         write("Error!")
  227.                     end
  228.                 end
  229.             end
  230.         elseif event == "mouse_click" then
  231.             if param2 > 50 and param3 > (19-#categories) then
  232.                 showCategory(param3-19+#categories)
  233.             elseif param2 < (1+3*#categories[activeCat]) and param3 == 19 then
  234.                 changeSelected(categories[activeCat][math.ceil(param2/3)]["id"])
  235.             elseif param2 < 51 and param3 < 18 then
  236.                 if param1 == 1 then
  237.                     setElement(param2, param3, activeEle)
  238.                     setTemp(param2, param3, categories[elements[activeEle][1]][elements[activeEle][2]]["temp"])
  239.                 elseif param1 == 2 then
  240.                     setElement(param2, param3, 0)
  241.                 end
  242.             end
  243.         end
  244.         drawScreen()
  245.     end
  246.     if running then
  247.         for y=1, 17 do
  248.             for x=1, 50 do
  249.                 y2 = 18-y
  250.                 temp = checkFallDown(x, y2)
  251.                 if temp == "delete" then
  252.                     setElement(x, y2, 0)
  253.                 elseif temp == "down" then
  254.                     temp2 = map[y2][x]
  255.                     temp3 = temps[y2][x]
  256.                     setElement(x, y2, map[y2+1][x])
  257.                     setElement(x, y2+1, temp2)
  258.                     setTemp(x, y2, temps[y2+1][x])
  259.                     setTemp(x, y2+1, temp3)
  260.                 elseif temp == "rightd" then
  261.                     temp2 = map[y2][x]
  262.                     temp3 = temps[y2][x]
  263.                     setElement(x, y2, map[y2+1][x+1])
  264.                     setElement(x+1, y2+1, temp2)
  265.                     setTemp(x, y2, temps[y2+1][x+1])
  266.                     setTemp(x+1, y2+1, temp3)
  267.                 elseif temp == "leftd" then
  268.                     temp2 = map[y2][x]
  269.                     temp3 = temps[y2][x]
  270.                     setElement(x, y2, map[y2+1][x-1])
  271.                     setElement(x-1, y2+1, temp2)
  272.                     setTemp(x, y2, temps[y2+1][x-1])
  273.                     setTemp(x-1, y2+1, temp3)
  274.                 end
  275.                 if map[y][x] > 0 then
  276.                     if categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["mtemp"] ~= nil then
  277.                         if categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["temp"] > categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["mtemp"] then
  278.                             if temps[y][x] < categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["mtemp"] then
  279.                                 map[y][x] = categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["melt"]
  280.                             end
  281.                         else
  282.                             if temps[y][x] > categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["mtemp"] then
  283.                                 map[y][x] = categories[elements[map[y][x]][1]][elements[map[y][x]][2]]["melt"]
  284.                             end
  285.                         end
  286.                     end
  287.                 end
  288.             end
  289.         end
  290.     end
  291.     drawScreen()
  292. end
Advertisement
Add Comment
Please, Sign In to add comment