Advertisement
Guest User

Caesium_Element

a guest
Aug 1st, 2014
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.14 KB | None | 0 0
  1. -- Caesium
  2. caes = elements.allocate("RAD", "CAES") --properties
  3. elements.element(caes, elements.element(elements.DEFAULT_PT_COAL))
  4. elements.property(caes, "Name", "CAES")
  5. elements.property(caes, "Description", "Caesium. Highly reactive and will violently explode in water.")
  6. elements.property(caes, "Colour", 0xD8D8D8)
  7. elements.property(caes, "MenuSection", 10)
  8. elements.property(caes, "Gravity", 0)
  9. elements.property(caes, "Properties", elements.ST_SOLID + elements.TYPE_SOLID + elements.PROP_DEADLY)
  10. elements.property(caes, "Flammable", 0)
  11. elements.property(caes, "Explosive", 0)
  12. function propc(i,x,y,s,n)
  13. local ctemp = tpt.get_property("temp", i) -- melt into Liquid Caesium
  14.     if ctemp > 301.59 then
  15.     tpt.set_property("type", "lcas", i)
  16.     end
  17.     if math.random(1, 7500) == 1 then -- decay
  18.     local ran = math.random(-20,20)
  19.     local ran2 = math.random(-20,0)
  20.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nble")
  21.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
  22.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
  23.     tpt.set_property("vx", math.random(-25,25), i)
  24.     tpt.set_property("vy", math.random(-25,25), i)
  25.     tpt.set_property("life", 10000, i)
  26.         if math.abs(ran) + math.abs(ran2) > 10 then
  27.         local ran3 = math.random(1,4)
  28.             if ran3 == 1 then
  29.             tpt.set_property("type", "elec", i)
  30.             end
  31.             if ran3 == 2 then
  32.             tpt.set_property("type", "phot", i)
  33.             end
  34.             if ran3 == 3 then
  35.             tpt.set_property("type", "prot", i)
  36.             end
  37.             if ran3 == 4 then
  38.             tpt.set_property("type", "neut", i)
  39.             end
  40.         end
  41.     end
  42.    
  43. local colx = math.random(-1,1)
  44. local coly = math.random(-1,1)
  45. local coltype = tpt.get_property("type", x+colx, y+coly)
  46. local temp = tpt.get_property("temp", i)
  47.     if coltype == elements.DEFAULT_PT_WATR then
  48.     tpt.set_property("life", 10000, i)
  49.     tpt.set_property("vx", math.random(-25,25), i)
  50.     tpt.set_property("vy", math.random(-25,25), i)
  51.     tpt.set_property("temp", temp + 1000 ,i)
  52.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nble")
  53.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
  54.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
  55.     tpt.set_property("type", "hygn", coltype)
  56.     local rand = math.random(1,4)
  57.         if rand == 1 then
  58.         tpt.set_property("type", "elec", i)
  59.         end
  60.         if rand == 2 then
  61.         tpt.set_property("type", "phot", i)
  62.         end
  63.         if rand == 3 then
  64.         tpt.set_property("type", "prot", i)
  65.         end
  66.         if rand == 4 then
  67.         tpt.set_property("type", "neut", i)
  68.         end
  69.     end
  70.     if coltype == elements.DEFAULT_PT_DSTW then
  71.     tpt.set_property("life", 10000, i)
  72.     tpt.set_property("vx", math.random(-25,25), i)
  73.     tpt.set_property("vy", math.random(-25,25), i)
  74.     local rand = math.random(1,4)
  75.         if rand == 1 then
  76.                 tpt.set_property("type", "elec", i)
  77.         end
  78.         if rand == 2 then
  79.         tpt.set_property("type", "phot", i)
  80.         end
  81.         if rand == 3 then
  82.         tpt.set_property("type", "prot", i)
  83.         end
  84.                 if rand == 4 then
  85.         tpt.set_property("type", "neut", i)
  86.         end
  87.     tpt.set_property("temp", temp + 1000 ,i)
  88.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nble")
  89.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
  90.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
  91.     tpt.set_property("type", "hygn", coltype)
  92.     end
  93.     if coltype == elements.DEFAULT_PT_SLTW then
  94.     tpt.set_property("life", 10000, i)
  95.     tpt.set_property("vx", math.random(-25,25), i)
  96.     tpt.set_property("vy", math.random(-25,25), i)
  97.     local rand = math.random(1,4)
  98.         if rand == 1 then
  99.         tpt.set_property("type", "elec", i)
  100.         end
  101.         if rand == 2 then
  102.         tpt.set_property("type", "phot", i)
  103.         end
  104.         if rand == 3 then
  105.         tpt.set_property("type", "prot", i)
  106.         end
  107.         if rand == 4 then
  108.         tpt.set_property("type", "neut", i)
  109.         end
  110.     tpt.set_property("temp", temp + 1000 ,i)
  111.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nble")
  112.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
  113.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
  114.     tpt.set_property("type", "hygn", coltype)
  115.     end
  116. end
  117. tpt.element_func(propc, tpt.element("caes"))
  118. elements.property(caes, "HighTemperature", 1938)
  119. -- Liquid Caesium
  120. Lcas = elements.allocate("RAD", "LCAS") -- properties
  121. elements.element(Lcas, elements.element(elements.DEFAULT_PT_EXOT))
  122. elements.property(Lcas, "Name", "LCAS")
  123. elements.property(Lcas, "Description", "Liquid Caesium. Highly reactive and will violently explode in water.")
  124. elements.property(Lcas, "Colour", 0xD9D9D9)
  125. elements.property(Lcas, "MenuSection", 10)
  126. elements.property(Lcas, "Gravity", 1)
  127. elements.property(Lcas, "Weight", 10)
  128. elements.property(Lcas, "Flammable", 0)
  129. elements.property(Lcas, "Explosive", 0)
  130. elements.property(caes, "Properties", elements.ST_LIQUID + elements.TYPE_LIQUID + elements.PROP_DEADLY)
  131. function proplcas(i,x,y,s,n)
  132. local ctemp = tpt.get_property("temp", i) -- decay
  133.     if math.random(1, 7500) == 1 then
  134.     local ran = math.random(-20,20)
  135.     local ran2 = math.random(-20,0)
  136.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nble")
  137.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
  138.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
  139.     tpt.set_property("life", 10000, i)
  140.     tpt.set_property("vx", math.random(-25,25), i)
  141.     tpt.set_property("vy", math.random(-25,25), i)
  142.         if math.abs(ran) + math.abs(ran2) > 10 then
  143.         local ran3 = math.random(1,4)
  144.             if ran3 == 1 then
  145.             tpt.set_property("type", "elec", i)
  146.             end
  147.             if ran3 == 2 then
  148.             tpt.set_property("type", "phot", i)
  149.             end
  150.             if ran3 == 3 then
  151.             tpt.set_property("type", "prot", i)
  152.             end
  153.             if ran3 == 4 then
  154.             tpt.set_property("type", "neut", i)
  155.             end
  156.         end
  157.     end
  158. local colx = math.random(-1,1) -- react w/ water
  159. local coly = math.random(-1,1)
  160. local coltype = tpt.get_property("type", x+colx, y+coly)
  161. local temp = tpt.get_property("temp", i)
  162.     if coltype == elements.DEFAULT_PT_WATR then
  163.     tpt.set_property("life", 10000, i)
  164.     tpt.set_property("vx", math.random(-25,25), i)
  165.     tpt.set_property("vy", math.random(-25,25), i)
  166.     local rand = math.random(1,4)
  167.         if rand == 1 then
  168.         tpt.set_property("type", "elec", i)
  169.         end
  170.         if rand == 2 then
  171.         tpt.set_property("type", "phot", i)
  172.         end
  173.         if rand == 3 then
  174.         tpt.set_property("type", "prot", i)
  175.         end
  176.         if rand == 4 then
  177.         tpt.set_property("type", "neut", i)
  178.         end
  179.     tpt.set_property("temp", temp + 1000 ,i)
  180.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nble")
  181.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
  182.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
  183.     tpt.set_property("type", "hygn", coltype)
  184.     end
  185.     if coltype == elements.DEFAULT_PT_DSTW then
  186.     tpt.set_property("life", 10000, i)
  187.     tpt.set_property("vx", math.random(-25,25), i)
  188.     tpt.set_property("vy", math.random(-25,25), i)
  189.     local rand = math.random(1,4)
  190.         if rand == 1 then
  191.         tpt.set_property("type", "elec", i)
  192.         end
  193.         if rand == 2 then
  194.         tpt.set_property("type", "phot", i)
  195.         end
  196.         if rand == 3 then
  197.         tpt.set_property("type", "prot", i)
  198.         end
  199.         if rand == 4 then
  200.         tpt.set_property("type", "neut", i)
  201.         end
  202.     tpt.set_property("temp", temp + 1000 ,i)
  203.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nble")
  204.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
  205.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
  206.     tpt.set_property("type", "hygn", coltype)
  207.     end
  208.     if coltype == elements.DEFAULT_PT_SLTW then
  209.     tpt.set_property("life", 10000, i)
  210.     tpt.set_property("vx", math.random(-25,25), i)
  211.     tpt.set_property("vy", math.random(-25,25), i)
  212.     local rand = math.random(1,4)
  213.         if rand == 1 then
  214.         tpt.set_property("type", "elec", i)
  215.         end
  216.         if rand == 2 then
  217.         tpt.set_property("type", "phot", i)
  218.         end
  219.         if rand == 3 then
  220.         tpt.set_property("type", "prot", i)
  221.         end
  222.         if rand == 4 then
  223.         tpt.set_property("type", "neut", i)
  224.         end
  225.     tpt.set_property("temp", temp + 1000 ,i)
  226.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nble")
  227.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
  228.     tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
  229.     tpt.set_property("type", "hygn", coltype)
  230.     end
  231. end
  232. elements.property(Lcas, "LowTemperature", 200) -- turn into Solid Caesium
  233. tpt.element_func(proplcas, tpt.element("lcas"))
  234. elements.property(Lcas, "LowTemperatureTransition", caes)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement