Advertisement
TPT_PL

More Epic Exotic Chemistry v2

Sep 12th, 2016
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 27.33 KB | None | 0 0
  1. local nucleartab = elem.allocate("EXOTIC", "BBACK") -- The BACK button, defined before all for a good effect :P
  2. -- Element defines - exotic
  3. local ciso = elem.allocate("EXOTIC", "CISO")
  4. local diso = elem.allocate("EXOTIC", "DISO")
  5. local eiso = elem.allocate("EXOTIC", "EISO")
  6. local emv = elem.allocate("EXOTIC", "EMV")
  7. local pemv = elem.allocate("EXOTIC", "PEMV")
  8. local redspot = elem.allocate("EXOTIC", "JRSR")
  9. local hemp = elem.allocate("EXOTIC", "HEMP")
  10. -- Element defines - crystals
  11. local red = elem.allocate("EXOTIC", "R97A")
  12. local yellow = elem.allocate("EXOTIC", "Y119")
  13. local green = elem.allocate("EXOTIC", "G73C")
  14. local cyan = elem.allocate("EXOTIC", "CN15")
  15. local blue = elem.allocate("EXOTIC", "BL63")
  16. local magenta = elem.allocate("EXOTIC", "M201")
  17. local solution = elem.allocate("EXOTIC", "RWTR")
  18.  
  19. -- Exotic elements' properties:
  20. -- HEMP
  21. elem.element(hemp, elem.element(elem.DEFAULT_PT_MERC))
  22. elem.property(hemp, "Name", "HEMP")
  23. elem.property(hemp, "Description", "Highly Exotic Metallic Plasmoid, highly conductive, isotopic decay of destabilized CISO upon red spot radiation.")
  24. elem.property(hemp, "MenuSection", elem.SC_NUCLEAR)
  25. elem.property(hemp, "Color", 0xBFFBFB)
  26. elem.property(hemp, "Weight", 99)
  27. elem.property(hemp, "Falldown", 2)
  28. elem.property(hemp, "Gravity", 5)
  29. elem.property(hemp, "Diffusion", 2)
  30. elem.property(hemp, "Temperature", 0)
  31. elem.property(hemp, "Advection", 2)
  32. elem.property(hemp, "Explosive", 1)
  33. elem.property(hemp, "HighTemperature", 1600)
  34. elem.property(hemp, "HighTemperatureTransition", elem.DEFAULT_PT_EXOT)
  35. elem.property(hemp, "LowPressure", -20)
  36. elem.property(hemp, "LowPressureTransition", emv)
  37. elem.property(hemp, "MenuVisible", 0)
  38. elem.property(elem.DEFAULT_PT_EXOT, "Description", "Exotic, non-conductive isotopic decay of HEMP, sensitive to energy particles.")
  39. elem.property(elem.DEFAULT_PT_EXOT, "Hardness", -1)
  40. elem.property(elem.DEFAULT_PT_EXOT, "Color", 0xBFFBFB)
  41. elem.property(elem.DEFAULT_PT_EXOT, "Advection", 0.3)
  42. elem.property(elem.DEFAULT_PT_EXOT, "MenuVisible", 0)
  43. elem.property(elem.DEFAULT_PT_EXOT, "HighPressure", 55)
  44. elem.property(elem.DEFAULT_PT_EXOT, "HighPressureTransition", elem.DEFAULT_PT_HYGN)
  45.  
  46. -- CISO
  47. elem.element(ciso, elem.element(elem.DEFAULT_PT_WAX))
  48. elem.property(ciso, "Name", "CISO")
  49. elem.property(ciso, "Description", "Crystaline Isotope, unstable, forms within Isotope Z upon Jupiter's red spot radiation.")
  50. elem.property(ciso, "Flammable", 0)
  51. elem.property(ciso, "MenuSection", elem.SC_NUCLEAR)
  52. elem.property(ciso, "Temperature", 313.15)
  53. elem.property(ciso, "Color", 0xFFAA55)
  54. elem.property(ciso, "Hardness", 2)
  55. elem.property(ciso, "Weight", 101.0)
  56. elem.property(ciso, "HighPressure", 25)
  57. elem.property(ciso, "HighPressureTransition", elem.DEFAULT_PT_ELEC)
  58. elem.property(ciso, "HighTemperatureTransition", diso)
  59. elem.property(ciso, "MenuVisible", 0)
  60.  
  61. -- DISO
  62. elem.element(diso, elem.element(elem.DEFAULT_PT_MWAX))
  63. elem.property(diso, "Name", "DISO")
  64. elem.property(diso, "Description", "Destabilized C Isotope, slightly radioactive and vaporous. Fusionates to NBLE/EXOT at high temperature and pressure.")
  65. elem.property(diso, "Hardness", 2)
  66. elem.property(diso, "Flammable", 0)
  67. elem.property(diso, "Temperature", 273.15-255.00)
  68. elem.property(diso, "MenuSection", elem.SC_NUCLEAR)
  69. elem.property(diso, "Color", 0x1111AA11)
  70. elem.property(diso, "Weight", 85.5)
  71. elem.property(diso, "Gravity", -0.7)
  72. elem.property(diso, "Diffusion", 4.5)
  73. elem.property(diso, "LowTemperatureTransition", ciso)
  74. elem.property(diso, "MenuVisible", 0)
  75.  
  76. -- EISO
  77. elem.element(eiso, elem.element(elem.DEFAULT_PT_GLOW))
  78. elem.property(eiso, "Name", "EISO")
  79. elem.property(eiso, "Description", "E Isotope, radioactive decay of destabilized C Isotope (DISO).")
  80. elem.property(eiso, "Hardness", -1)
  81. elem.property(eiso, "MenuSection", elem.SC_NUCLEAR)
  82. elem.property(eiso, "MenuVisible", 0)
  83. elem.property(eiso, "Properties", elem.TYPE_LIQUID+elem.PROP_HOT_GLOW)
  84. elem.property(eiso, "HighTemperature", 1400.00)
  85. elem.property(eiso, "HighTemperatureTransition", hemp)
  86. elem.property(eiso, "Meltable", 1)
  87.  
  88. -- EMV
  89. elem.element(emv, elem.element(elem.DEFAULT_PT_PSTE))
  90. elem.property(emv, "Name", "EMV")
  91. elem.property(emv, "Description", "Exotic metallic vapour, conductive only once. Formed from HEMP at low pressure (one-way reaction).")
  92. elem.property(emv, "Color", 0xBFFBFF)
  93. elem.property(emv, "MenuSection", elem.SC_NUCLEAR)
  94. elem.property(emv, "Diffusion", 1.5)
  95. elem.property(emv, "Gravity", 0.5)
  96. elem.property(emv, "Weight", 1.0)
  97. elem.property(emv, "Temperature", 10.0)
  98. elem.property(emv, "Hardness", 4)
  99. elem.property(emv, "Properties", elem.TYPE_GAS+elem.PROP_CONDUCTS)
  100. elem.property(emv, "MenuVisible", 0)
  101. elem.property(emv, "HighPressureTransition", pemv)
  102. elem.property(emv, "HighTemperature", 1800.0)
  103. elem.property(emv, "HighTemperatureTransition", eiso)
  104.  
  105. -- PEMV
  106. elem.element(pemv, elem.element(elem.DEFAULT_PT_PSTS))
  107. elem.property(pemv, "Name", "PEMV")
  108. elem.property(pemv, "Description", "Pressurized exotic metallic vapour, unstable, turns into VIBR under high temperature.")
  109. elem.property(pemv, "Color", 0xCCFF66)
  110. elem.property(pemv, "MenuSection", elem.SC_NUCLEAR)
  111. elem.property(pemv, "HighTemperature", 8888.0)
  112. elem.property(pemv, "HighTemperatureTransition", elem.DEFAULT_PT_VIBR)
  113. elem.property(pemv, "LowPressureTransition", emv)
  114. elem.property(pemv, "HighPressure", 200)
  115. elem.property(pemv, "HighPressureTransition", redspot)
  116.  
  117. -- JRSR
  118. elem.element(redspot, elem.element(elem.DEFAULT_PT_ANAR))
  119. elem.property(redspot, "Name", "JRSR")
  120. elem.property(redspot, "Description", "Jupiter's red spot radiation, radioactive emissions affected by the cosmic rays.")
  121. elem.property(redspot, "Flammable", 0)
  122. elem.property(redspot, "Weight", 101.0)
  123. elem.property(redspot, "Temperature", 223.15)
  124. elem.property(redspot, "Hardness", -1)
  125. elem.property(redspot, "Color", 0xFF11FFFF)
  126. elem.property(redspot, "Gravity", 0.0)
  127. elem.property(redspot, "Diffusion", 4.0)
  128. elem.property(redspot, "Falldown", -1)
  129. elem.property(redspot, "MenuSection", elem.SC_NUCLEAR)
  130. elem.property(redspot, "AirLoss", 1)
  131. elem.property(redspot, "AirDrag", 0)
  132. elem.property(redspot, "MenuVisible", 0)
  133.  
  134. -- Crystals' properties:
  135. -- Rauth's water (RWTR)
  136. elem.element(solution, elem.element(elem.DEFAULT_PT_GLOW))
  137. elem.property(solution, "Name", "RWTR")
  138. elem.property(solution, "Description", "Rauth's water, universal crystal solution, used to grow synthetic crystals.")
  139. elem.property(solution, "Color", 0xF2D9E6)
  140. elem.property(solution, "MenuSection", elem.SC_NUCLEAR)
  141. elem.property(solution, "MenuVisible", 0)
  142.  
  143. -- R97A
  144. elem.element(red, elem.element(elem.DEFAULT_PT_DMND))
  145. elem.property(red, "Name", "R97A")
  146. elem.property(red, "Description", "Red-97a crystal, often suddently decays creating a shockwave.")
  147. elem.property(red, "Weight", 101.5)
  148. elem.property(red, "Temperature", 295.15)
  149. elem.property(red, "Hardness", -1)
  150. elem.property(red, "Color", 0xFFC80000)
  151. elem.property(red, "Properties", elem.TYPE_SOLID+elem.PROP_NEUTPENETRATE+elem.PROP_RADIOACTIVE)
  152. elem.property(red, "MenuSection", elem.SC_NUCLEAR)
  153. elem.property(red, "MenuVisible", 0)
  154.  
  155. -- Y119
  156. elem.element(yellow, elem.element(elem.DEFAULT_PT_DMND))
  157. elem.property(yellow, "Name", "Y119")
  158. elem.property(yellow, "Description", "Yellow-119, grows more rapidly than other crystals, decays with NEUT.")
  159. elem.property(yellow, "Weight", 101.5)
  160. elem.property(yellow, "Temperature", 295.15)
  161. elem.property(yellow, "Hardness", -1)
  162. elem.property(yellow, "Color", 0xFFFFFF00)
  163. elem.property(yellow, "Properties", elem.TYPE_SOLID+elem.PROP_NEUTPENETRATE+elem.PROP_RADIOACTIVE)
  164. elem.property(yellow, "MenuSection", elem.SC_NUCLEAR)
  165. elem.property(yellow, "MenuVisible", 0)
  166.  
  167. -- G73C
  168. elem.element(green, elem.element(elem.DEFAULT_PT_DMND))
  169. elem.property(green, "Name", "G73C")
  170. elem.property(green, "Description", "Green-73c, contains major amounts of vibranium. Also emits GRVT.")
  171. elem.property(green, "Weight", 101.5)
  172. elem.property(green, "Temperature", 295.15)
  173. elem.property(green, "Hardness", -1)
  174. elem.property(green, "Color", 0xFF00C800)
  175. elem.property(green, "Properties", elem.TYPE_SOLID+elem.PROP_NEUTPENETRATE+elem.PROP_RADIOACTIVE)
  176. elem.property(green, "MenuSection", elem.SC_NUCLEAR)
  177. elem.property(green, "MenuVisible", 0)
  178.  
  179. -- CN15
  180. elem.element(cyan, elem.element(elem.DEFAULT_PT_DMND))
  181. elem.property(cyan, "Name", "CN15")
  182. elem.property(cyan, "Description", "Cyan-15, most stable crystal, emits scarce gamma radiation (PHOT).")
  183. elem.property(cyan, "Weight", 101.5)
  184. elem.property(cyan, "Temperature", 295.15)
  185. elem.property(cyan, "Hardness", -1)
  186. elem.property(cyan, "Color", 0xFF00C8C8)
  187. elem.property(cyan, "Properties", elem.TYPE_SOLID+elem.PROP_NEUTPASS+elem.PROP_RADIOACTIVE)
  188. elem.property(cyan, "MenuSection", elem.SC_NUCLEAR)
  189. elem.property(cyan, "MenuVisible", 0)
  190.  
  191. -- BL63
  192. elem.element(blue, elem.element(elem.DEFAULT_PT_DMND))
  193. elem.property(blue, "Name", "BL63")
  194. elem.property(blue, "Description", "Blue-63, doesn't grow with RWTR, also found in small quantities on Jupiter.")
  195. elem.property(blue, "Weight", 101.5)
  196. elem.property(blue, "Temperature", 295.15)
  197. elem.property(blue, "Hardness", -1)
  198. elem.property(blue, "Color", 0xFF0000C8)
  199. elem.property(blue, "Properties", elem.TYPE_SOLID+elem.PROP_NEUTPASS+elem.PROP_RADIOACTIVE)
  200. elem.property(blue, "MenuSection", elem.SC_NUCLEAR)
  201. elem.property(blue, "MenuVisible", 0)
  202.  
  203. elem.element(magenta, elem.element(elem.DEFAULT_PT_DMND))
  204. elem.property(magenta, "Name", "M201")
  205. elem.property(magenta, "Description", "Magenta-201, generates ionized NBLE around while decaying.")
  206. elem.property(magenta, "Weight", 101.5)
  207. elem.property(magenta, "Temperature", 295.15)
  208. elem.property(magenta, "Hardness", -1)
  209. elem.property(magenta, "Color", 0xFFC800C8)
  210. elem.property(magenta, "MenuSection", elem.SC_NUCLEAR)
  211. elem.property(magenta, "MenuVisible", 0)
  212.  
  213. -- Minor changes + resistance to JRSR
  214. elem.property(elem.DEFAULT_PT_DMND, "Weight", 200.5)
  215. elem.property(elem.DEFAULT_PT_VOID, "Weight", 200.5)
  216. elem.property(elem.DEFAULT_PT_CLNE, "Weight", 200.5)
  217. elem.property(elem.DEFAULT_PT_PVOD, "Weight", 200.5)
  218. elem.property(elem.DEFAULT_PT_PCLN, "Weight", 200.5)
  219. elem.property(elem.DEFAULT_PT_IRON, "Weight", 101.5)
  220. elem.property(elem.DEFAULT_PT_TTAN, "Weight", 102.5)
  221. elem.property(elem.DEFAULT_PT_CO2, "Hardness", 0)
  222. elem.property(elem.DEFAULT_PT_WTRV, "Hardness", 0)
  223. elem.property(elem.DEFAULT_PT_WATR, "Hardness", 2)
  224. elem.property(elem.DEFAULT_PT_DSTW, "Hardness", 2)
  225. elem.property(elem.DEFAULT_PT_BUBW, "Hardness", 1)
  226. elem.property(elem.DEFAULT_PT_SLTW, "Hardness", 0)
  227. elem.property(elem.DEFAULT_PT_ACID, "Flammable", 0)
  228.  
  229. -- Graphics and updates
  230.  
  231. local function cisotope(i, x, y, s, nt)
  232.     if sim.partProperty(i, "life") == 0 then
  233.         sim.partProperty(i, "life", 8)
  234.     end;
  235.     local ox = math.random(x-1, x+1);
  236.     local oy = math.random(y-1, y+1);
  237.     local r = sim.partID(ox, oy)
  238.     if r ~= nil and sim.partProperty(r, "type") == redspot then
  239.         sim.partProperty(i, "type", hemp)
  240.         sim.partProperty(r, "type", eiso)
  241.         sim.partProperty(r, "temp", sim.partProperty(r, "temp")+100)
  242.         sim.partCreate(-1, math.random(x-1, x+1), math.random(y-1, y+1), elem.DEFAULT_PT_CAUS)
  243.         sim.partProperty(i, "life", sim.partProperty(i, "life")-1)
  244.     end
  245. end
  246.  
  247. local function disotope(i, x, y, s, nt)
  248.     if sim.partProperty(i, "life") == 0 then
  249.         sim.partProperty(i, "life", 8)
  250.     end;
  251.     local ox = math.random(x-1, x+1);
  252.     local oy = math.random(y-1, y+1);
  253.     local r = sim.partID(ox, oy)
  254.     if r ~= nil and sim.partProperty(r, "type") == redspot then
  255.         sim.partProperty(i, "type", hemp)
  256.         sim.partProperty(r, "type", eiso)
  257.         sim.partProperty(r, "temp", sim.partProperty(r, "temp")+100)
  258.         sim.partCreate(-1, math.random(x-1, x+1), math.random(y-1, y+1), elem.DEFAULT_PT_CAUS)
  259.         sim.partProperty(i, "life", sim.partProperty(i, "life")-1)
  260.     end
  261.     local pressure = sim.pressure(x/4, y/4)
  262.     if pressure >= 25 and sim.partProperty(i, "temp") >= 7773.15 then
  263.         sim.partChangeType(i, elem.DEFAULT_PT_NBLE)
  264.         sim.partCreate(-3, x, y, elem.DEFAULT_PT_EXOT)
  265.         sim.partCreate(-3, x, y, elem.DEFAULT_PT_NBLE)
  266.         phot = sim.partCreate(-3, x, y, elem.DEFAULT_PT_PHOT)
  267.         sim.partProperty(phot, "ctype", 126976)
  268.     end
  269. end
  270.  
  271. local function radiate(i, x, y, s, nt)
  272.     local ox = math.random(x-1, x+1);
  273.     local oy = math.random(y-1, y+1);
  274.     local r = sim.partID(ox, oy)
  275.     if r ~= nil then
  276.         if sim.partProperty(r, "type") == elem.DEFAULT_PT_ISOZ or sim.partProperty(r, "type") == elem.DEFAULT_PT_ISZS then
  277.             sim.partChangeType(r, ciso)
  278.         end
  279.     end
  280. end
  281.  
  282. local function solute(i, x, y, s, nt)
  283.     local ox = math.random(x-1, x+1);
  284.     local oy = math.random(y-1, y+1);
  285.     local r = sim.partID(ox, oy)
  286.     if r ~= nil and sim.partProperty(r, "type") == elem.DEFAULT_PT_LAVA and sim.partProperty(r, "ctype") == elem.DEFAULT_PT_QRTZ then
  287.         sim.partChangeType(i, solution)
  288.         sim.partChangeType(r, solution)
  289.     end
  290. end
  291.  
  292. -- Crystals |
  293. --          V
  294.  
  295. local function redcrystal(i, x, y, s, nt)
  296.     if math.random(1,100000) == 1 then
  297.         sim.partChangeType(i, yellow)
  298.         sim.pressure(x/4,y/4,(sim.pressure(x/4,y/4)+50))
  299.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_PROT)
  300.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_PROT)
  301.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_PROT)
  302.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_PROT)
  303.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_PROT)
  304.     end
  305.     local r = sim.partID(math.random(x-1, x+1), math.random(y-1, y+1))
  306.     if r ~= nil then
  307.         if sim.partProperty(r, "type") == solution then
  308.             if math.random(1,2000) == 1 then
  309.                 sim.partChangeType(r, red)
  310.             end
  311.         end
  312.     end
  313.     if sim.partProperty(i, "temp") < 10 then
  314.         sim.partChangeType(i, ciso)
  315.     end
  316. end
  317.  
  318. function yellowcrystal(i, x, y, s, nt)
  319.     if math.random(1,100000) == 1 then
  320.         sim.partChangeType(i, green)
  321.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_NEUT)
  322.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_NEUT)
  323.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_NEUT)
  324.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_NEUT)
  325.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_NEUT)
  326.     end
  327.     local r = sim.partID(math.random(x-1, x+1), math.random(y-1, y+1))
  328.     if r ~= nil then
  329.         if sim.partProperty(r, "type") == solution then
  330.             if math.random(1,1000) == 1 then
  331.                 sim.partChangeType(r, yellow)
  332.            end
  333.        end
  334.    end
  335.    if sim.partProperty(i, "temp") < 10 then
  336.         sim.partChangeType(i, ciso)
  337.     end
  338. end
  339.  
  340. function greencrystal(i, x, y, s, nt)
  341.     if math.random(1,100000) == 1 then
  342.         if math.random(0, 1) == 0 then
  343.             sim.partChangeType(i, cyan)
  344.         else
  345.             sim.partChangeType(i, elem.DEFAULT_PT_VIBR)
  346.         end;
  347.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_GRVT)
  348.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_GRVT)
  349.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_GRVT)
  350.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_GRVT)
  351.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_GRVT)
  352.     end
  353.     local r = sim.partID(math.random(x-1, x+1), math.random(y-1, y+1))
  354.     if r ~= nil then
  355.         if sim.partProperty(r, "type") == solution then
  356.             if math.random(1,2000) == 1 then
  357.                 sim.partChangeType(r, green)
  358.             end
  359.         end
  360.     end
  361.     if sim.partProperty(i, "temp") < 10 then
  362.         sim.partChangeType(i, ciso)
  363.     end
  364. end
  365.  
  366. function cyancrystal(i, x, y, s, nt)
  367.     if math.random(1,500000) == 1 then
  368.         sim.partChangeType(i, blue)
  369.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_PHOT)
  370.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_PHOT)
  371.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_PHOT)
  372.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_PHOT)
  373.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_PHOT)
  374.     end
  375.     local r = sim.partID(math.random(x-1, x+1), math.random(y-1, y+1))
  376.     if r ~= nil then
  377.         if sim.partProperty(r, "type") == solution then
  378.             if math.random(1,2000) == 1 then
  379.                 sim.partChangeType(r, cyan)
  380.             end
  381.         end
  382.     end
  383.     if sim.partProperty(i, "temp") < 10 then
  384.         sim.partChangeType(i, ciso)
  385.     end
  386. end
  387.  
  388. function bluecrystal(i, x, y, s, nt)
  389.     if math.random(1,100000) == 1 then
  390.         sim.partChangeType(i, magenta)
  391.     end
  392.     if math.random(1,2000) == 1 then
  393.         sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), redspot)
  394.     end
  395.     if sim.partProperty(i, "temp") < 10 then
  396.         sim.partChangeType(i, ciso)
  397.     end
  398. end
  399.  
  400. local function magentacrystal(i, x, y, s, nt)
  401.     if math.random(1,100000) == 1 then
  402.         sim.partChangeType(i, red)
  403.     end
  404.     if math.random(1,2000) == 1 then
  405.         local ions = sim.partCreate(-3, x+math.random(-1,1), y+math.random(-1,1), elem.DEFAULT_PT_PLSM)
  406.         sim.partProperty(ions, "temp", 295.15)
  407.         sim.partProperty(ions, "ctype", elem.DEFAULT_PT_NBLE)
  408.     end
  409.     if sim.partProperty(i, "temp") < 10 then
  410.         sim.partChangeType(i, ciso)
  411.     end
  412. end
  413.  
  414. -- Graphics below
  415.  
  416. local function hempGlow(i, colr, colg, colb)
  417.     local temp = sim.partProperty(i, "temp");
  418.     if temp < 5000 and temp > 273.15 then
  419.         return 0, 0x00FF0030, 255, 0, 255, 0, 75, 183, 0, 255
  420.     elseif temp > 5000 then
  421.         return 0, 0x00ff0020, 255, 255, 255, 0, 75, 255, 0, 0
  422.     elseif temp < 273.15 then
  423.         return 0, 0x00ff0020, 255, 0, 255, 255, 75, 0, 0, 255
  424.     end
  425. end
  426.  
  427. local function cisoGlow(i, r, g, b)
  428.     glow = math.random(1,3)
  429.     if glow == 1 then
  430.         return 1, 0x00000001, 255, 253, 222, 202, 0, 0, 0, 0
  431.     end
  432.     if glow == 2 then
  433.         return 1, 0x00000001, 255, 253, 222, 211, 0, 0, 0, 0
  434.     end
  435.     if glow == 3 then
  436.         return 1, 0x00000001, 255, 253, 222, 168, 0, 0, 0, 0
  437.     end
  438. end
  439.  
  440. local function disoGlow(i, r, g, b)
  441.     dr = math.random(0,255)
  442.     dg = math.random(0,255)
  443.     db = math.random(0,255)
  444.     return 1, 0x00000021, 255, dr, dg, db, 0, 0, 0, 0
  445. end
  446.  
  447. local function redspotGlow(i, r, g, b)
  448.     rsr = math.random(0,1)
  449.     rsg = math.random(110,160)
  450.     rsb = math.random(130,135)
  451.     return 1, 0x00000001, 255, rsr, rsg, rsb, 0, 0, 0, 0
  452. end
  453.  
  454. -- Crystals glow
  455.  
  456. local function redGlow(i, r, g, b)
  457.     return 1, 0x00010001, 255, 200, 0, 0, 20, 200, 0, 0
  458. end
  459.  
  460. local function yellowGlow(i, r, g, b)
  461.     return 1, 0x00010001, 255, 255, 255, 0, 20, 255, 255, 0
  462. end
  463.  
  464. local function greenGlow(i, r, g, b)
  465.     return 1, 0x00000021, 255, 0, 200, 0, 20, 0, 200, 0
  466. end
  467.  
  468. local function cyanGlow(i, r, g, b)
  469.     return 1, 0x00020001, 255, 0, 200, 200, 20, 0, 200, 200
  470. end
  471.  
  472. local function blueGlow(i, r, g, b)
  473.     return 1, 0x00040001, 255, 0, 0, 200, 20, 0, 0, 200
  474. end
  475.  
  476. local function magentaGlow(i, r, g, b)
  477.     return 1, 0x00000011, 255, 200, 0, 200, 20, 200, 0, 200
  478. end
  479.  
  480. -- Modified updates down here
  481.  
  482. local function modifyH(i, x, y, s, nt)
  483.     local pressure = sim.pressure(x/4, y/4)
  484.     if pressure >= 50 and sim.partProperty(i, "temp") >= 2273.15 then
  485.         sim.partChangeType(i, elem.DEFAULT_PT_NBLE)
  486.         sim.partCreate(-3, x, y, elem.DEFAULT_PT_NEUT)
  487.         local phot = sim.partCreate(-3, x, y, elem.DEFAULT_PT_PHOT)
  488.         sim.partProperty(phot, "ctype", 4177920)
  489.         local chance = math.random(1, 100)
  490.         if chance <= 10 then
  491.             sim.partCreate(-3, x, y, elem.DEFAULT_PT_ELEC)
  492.         end
  493.     end
  494.     local r = sim.partID(math.random(x-1, x+1), math.random(y-1, y+1))
  495.     if r ~= nil then
  496.         if sim.partProperty(r, "type") == elem.DEFAULT_PT_PHOT then
  497.             sim.partChangeType(i, elem.DEFAULT_PT_OXYG)
  498.         end
  499.     end
  500. end
  501.  
  502. local function modifyO(i, x, y, s, nt)
  503.     local pressure = sim.pressure(x/4, y/4)
  504.     local gravity = sim.gravMap(x/4, y/4)
  505.     if gravity >= 20 and pressure >= 250 and sim.partProperty(i, "temp") >= 9993.15 then
  506.         sim.partChangeType(i, elem.DEFAULT_PT_BRMT)
  507.         sim.partProperty(i, "temp", math.huge)
  508.         sim.pressure(x/4, y/4, 256)
  509.     end
  510.     local r = sim.partID(math.random(x-1, x+1), math.random(y-1, y+1))
  511.     if r ~= nil then
  512.         if sim.partProperty(r, "type") == elem.DEFAULT_PT_PROT then
  513.             sim.partChangeType(i, elem.DEFAULT_PT_NBLE)
  514.         end
  515.     end
  516. end
  517.  
  518. local function modifyHe(i, x, y, s, nt)
  519.     local pressure = sim.pressure(x/4, y/4)
  520.     if pressure >= 100 and sim.partProperty(i, "temp") >= 5273.15 then
  521.         sim.partChangeType(i, elem.DEFAULT_PT_PLSM)
  522.         sim.partProperty(i, "ctype", elem.DEFAULT_PT_NBLE)
  523.         sim.partCreate(-3, x, y, elem.DEFAULT_PT_NEUT)
  524.         local phot = sim.partCreate(-3, x, y, elem.DEFAULT_PT_PHOT)
  525.         sim.partProperty(phot, "ctype", 1040187392)
  526.         sim.partCreate(-3, x, y, elem.DEFAULT_PT_CO2)
  527.     end
  528.     local r = sim.partID(math.random(x-1, x+1), math.random(y-1, y+1))
  529.     if r ~= nil then
  530.         if sim.partProperty(r, "type") == elem.DEFAULT_PT_NEUT then
  531.             sim.partChangeType(i, elem.DEFAULT_PT_ISOZ)
  532.         end
  533.     end
  534. end
  535.  
  536. elem.property(ciso, "Update", cisotope)
  537. elem.property(diso, "Update", disotope)
  538. elem.property(eiso, "Update", solute)
  539. elem.property(elem.DEFAULT_PT_HYGN, "Update", modifyH)
  540. elem.property(elem.DEFAULT_PT_OXYG, "Update", modifyO)
  541. elem.property(elem.DEFAULT_PT_NBLE, "Update", modifyHe)
  542. elem.property(redspot, "Update", radiate)
  543. elem.property(hemp, "Graphics", hempGlow)
  544. elem.property(ciso, "Graphics", cisoGlow)
  545. elem.property(diso, "Graphics", disoGlow)
  546. elem.property(redspot, "Graphics", redspotGlow)
  547. -- And now da dank krustulz!11!!!!!111!
  548. elem.property(red, "Update", redcrystal)
  549. elem.property(red, "Graphics", redGlow)
  550. elem.property(yellow, "Update", yellowcrystal)
  551. elem.property(yellow, "Graphics", yellowGlow)
  552. elem.property(green, "Update", greencrystal)
  553. elem.property(green, "Graphics", greenGlow)
  554. elem.property(cyan, "Update", cyancrystal)
  555. elem.property(cyan, "Graphics", cyanGlow)
  556. elem.property(blue, "Update", bluecrystal)
  557. elem.property(blue, "Graphics", blueGlow)
  558. elem.property(magenta, "Update", magentacrystal)
  559. elem.property(magenta, "Graphics", magentaGlow)
  560.  
  561. -- Buttons code
  562. local exotictab = elem.allocate("EXOTIC", "BEEC")
  563.  
  564. elem.element(exotictab, elem.element(elem.DEFAULT_PT_DUST))
  565. elem.property(exotictab, "Name", "EEC")
  566. elem.property(exotictab, "Description", "Click to open the 'Exotic Chemistry' tab.")
  567. elem.property(exotictab, "MenuSection", elem.SC_NUCLEAR)
  568. elem.property(exotictab, "Properties", elem.PROP_LIFE_DEC+elem.PROP_LIFE_KILL)
  569.  
  570. local crysttab = elem.allocate("EXOTIC", "BPROX")
  571.  
  572. elem.element(crysttab, elem.element(elem.DEFAULT_PT_DUST))
  573. elem.property(crysttab, "Name", "PROX")
  574. elem.property(crysttab, "Description", "Click to open the 'Proximian crystals' tab.")
  575. elem.property(crysttab, "MenuSection", elem.SC_NUCLEAR)
  576. elem.property(crysttab, "Properties", elem.PROP_LIFE_DEC+elem.PROP_LIFE_KILL)
  577.  
  578. elem.element(nucleartab, elem.element(elem.DEFAULT_PT_DUST))
  579. elem.property(nucleartab, "Name", "BACK")
  580. elem.property(nucleartab, "Description", "Click to go back to the normal menu.")
  581. elem.property(nucleartab, "MenuSection", elem.SC_NUCLEAR)
  582. elem.property(nucleartab, "MenuVisible", 0)
  583. elem.property(exotictab, "Properties", elem.PROP_LIFE_DEC+elem.PROP_LIFE_KILL)
  584.  
  585. local nuclear = {}
  586. for i = 1, 255 do
  587.     pcall(function()
  588.         if elem.property(i, "MenuVisible") == 1 and elem.property(i, "MenuSection") == 10 then
  589.             nuclear[i] = true
  590.         end
  591.     end)
  592. end
  593.  
  594. local function switch(n)
  595.     if n == 1 then
  596.         elem.property(ciso, "MenuVisible", 1)
  597.         elem.property(diso, "MenuVisible", 1)
  598.         elem.property(eiso, "MenuVisible", 1)
  599.         elem.property(hemp, "MenuVisible", 1)
  600.         elem.property(emv, "MenuVisible", 1)
  601.         elem.property(pemv, "MenuVisible", 1)
  602.         elem.property(redspot, "MenuVisible", 1)
  603.         elem.property(elem.DEFAULT_PT_EXOT, "MenuVisible", 1)
  604.         elem.property(nucleartab, "MenuVisible", 1)
  605.         elem.property(crysttab, "MenuVisible", 0)
  606.         elem.property(solution, "MenuVisible", 0)
  607.         elem.property(red, "MenuVisible", 0)
  608.         elem.property(yellow, "MenuVisible", 0)
  609.         elem.property(green, "MenuVisible", 0)
  610.         elem.property(cyan, "MenuVisible", 0)
  611.         elem.property(blue, "MenuVisible", 0)
  612.         elem.property(magenta, "MenuVisible", 0)
  613.         for i in pairs(nuclear) do
  614.             elem.property(i, "MenuVisible", 0)
  615.         end
  616.     elseif n == 2 then
  617.         elem.property(ciso, "MenuVisible", 0)
  618.         elem.property(diso, "MenuVisible", 0)
  619.         elem.property(eiso, "MenuVisible", 0)
  620.         elem.property(hemp, "MenuVisible", 0)
  621.         elem.property(emv, "MenuVisible", 0)
  622.         elem.property(pemv, "MenuVisible", 0)
  623.         elem.property(redspot, "MenuVisible", 0)
  624.         elem.property(nucleartab, "MenuVisible", 1)
  625.         elem.property(elem.DEFAULT_PT_EXOT, "MenuVisible", 0)
  626.         elem.property(crysttab, "MenuVisible", 0)
  627.         elem.property(solution, "MenuVisible", 1)
  628.         elem.property(red, "MenuVisible", 1)
  629.         elem.property(yellow, "MenuVisible", 1)
  630.         elem.property(green, "MenuVisible", 1)
  631.         elem.property(cyan, "MenuVisible", 1)
  632.         elem.property(blue, "MenuVisible", 1)
  633.         elem.property(magenta, "MenuVisible", 1)
  634.         for i in pairs(nuclear) do
  635.             elem.property(i, "MenuVisible", 0)
  636.         end
  637.     elseif n == 0 then
  638.         elem.property(ciso, "MenuVisible", 0)
  639.         elem.property(diso, "MenuVisible", 0)
  640.         elem.property(eiso, "MenuVisible", 0)
  641.         elem.property(hemp, "MenuVisible", 0)
  642.         elem.property(emv, "MenuVisible", 0)
  643.         elem.property(pemv, "MenuVisible", 0)
  644.         elem.property(redspot, "MenuVisible", 0)
  645.         elem.property(nucleartab, "MenuVisible", 0)
  646.         elem.property(crysttab, "MenuVisible", 1)
  647.         elem.property(solution, "MenuVisible", 0)
  648.         elem.property(red, "MenuVisible", 0)
  649.         elem.property(yellow, "MenuVisible", 0)
  650.         elem.property(green, "MenuVisible", 0)
  651.         elem.property(cyan, "MenuVisible", 0)
  652.         elem.property(blue, "MenuVisible", 0)
  653.         elem.property(magenta, "MenuVisible", 0)
  654.         elem.property(elem.DEFAULT_PT_EXOT, "MenuVisible", 0)
  655.         for i in pairs(nuclear) do
  656.             elem.property(i, "MenuVisible", 1)
  657.         end
  658.     end
  659. end
  660.  
  661. local function buttons()
  662.     if tpt.selectedl == elem.property(exotictab, "Identifier") then
  663.         switch(1)
  664.         tpt.selectedl = "DEFAULT_PT_EXOT"
  665.     elseif tpt.selectedl == elem.property(crysttab, "Identifier") then
  666.         switch(2)
  667.         tpt.selectedl = "EXOTIC_PT_RWTR"
  668.     elseif tpt.selectedl == elem.property(nucleartab, "Identifier") then
  669.         switch(0)
  670.         tpt.selectedl = "DEFAULT_PT_NEUT"
  671.     end
  672. end
  673. tpt.register_step(buttons)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement