Advertisement
Guest User

0.4

a guest
Feb 9th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.85 KB | None | 0 0
  1. local function velocity(i,v,n) --*1
  2.  local angle = math.random(1,n)*(2*math.pi/n)
  3.  tpt.set_property("vx", v*math.cos(angle), i)
  4.  tpt.set_property("vy", v*math.sin(angle), i)
  5.  tpt.set_property("tmp", -1, i)
  6.  end --*1
  7.  
  8. local function attract(i,x,y,a) --*1
  9.  sim.gravMap(x/4,y/4,a)
  10. end --*1
  11.  
  12. local nept = elements.allocate("TPT" , "NEPT")
  13.  elements.element(nept, elements.element(elements.DEFAULT_PT_PLUT))
  14.  elements.property(nept, "Name" , "NEPT")
  15.  elements.property(nept, "Description" , "Neptunium, radioactive. Heats up when bombarded with neutrons.")
  16.  elements.property(nept, "Color", 0x557020)
  17.  elements.property(nept, "MenuSection", 10)
  18.  function neptunium(i,x,y,s,n)
  19.   if tpt.get_property("type", x + math.random(-2,2), y + math.random(-2,2)) == tpt.el.neut.id then --1
  20.    if math.random(1,2) == 1 then --2
  21.     tpt.parts[i].type = elements.DEFAULT_PT_URAN
  22.     end --2
  23.    end --1
  24.   if sim.pressure(x/4,y/4) > 1 then --3
  25.    if math.random(1,250) == 10 then --4
  26.     tpt.create(x + math.random(-2,2), y + math.random(-2,2), 'neut')
  27.     tpt.set_property("temp", math.huge, x ,y)
  28.     end --4
  29.    end --3
  30.   if math.random(1,10000) == 10 then --5
  31.    sim.pressure(x/4,y/4,0.1)
  32.    end --5
  33.   end --*1
  34.  tpt.element_func(neptunium,nept)
  35.   function neutron(i,x,y,s,n) --*2
  36.    if tpt.get_property("type", x + math.random(-2,2), y + math.random(-2,2)) == nept then --1
  37.     if math.random(1,35) == 10 then --2
  38.      tpt.create(x, y, 'neut')
  39.      tpt.set_property("temp", math.huge, x ,y)
  40.      end --2
  41.     end --1
  42.    end --*2
  43.  tpt.element_func(neutron,tpt.el.neut.id)
  44.  
  45. local vsns = elements.allocate("TPT" , "VSNS")
  46.  elements.element(vsns, elements.element(elements.DEFAULT_PT_DMND))
  47.  elements.property(vsns, "Name" , "VSNS")
  48.  elements.property(vsns, "Description" , "Velocity sensor, creates a spark when something's velocity is higher than its temperature.")
  49.  elements.property(vsns, "Color", 0x3D3125)
  50.  elements.property(vsns, "MenuSection", 3)
  51.  elements.property(vsns, "HeatConduct", 0)
  52.  elements.property(elem.TPT_PT_VSNS, "Update",
  53.  function(i,x,y,s,nt) --1
  54.   for r in sim.neighbors(x,y,1,1) do --2
  55.    if math.sqrt(math.pow(sim.partProperty(r, "vx"),2)+math.pow(sim.partProperty(r, "vy"),2)) > sim.partProperty(i, "temp")-273.15 then --3
  56.     sim.partCreate(-1, x, y+1, elements.DEFAULT_PT_SPRK)
  57.     sim.partCreate(-1, x+1, y+1, elements.DEFAULT_PT_SPRK)
  58.     sim.partCreate(-1, x-1, y+1, elements.DEFAULT_PT_SPRK)
  59.     sim.partCreate(-1, x, y-1, elements.DEFAULT_PT_SPRK)
  60.     sim.partCreate(-1, x+1, y-1, elements.DEFAULT_PT_SPRK)
  61.     sim.partCreate(-1, x-1, y-1, elements.DEFAULT_PT_SPRK)
  62.     sim.partCreate(-1, x+1, y, elements.DEFAULT_PT_SPRK)
  63.     sim.partCreate(-1, x-1, y, elements.DEFAULT_PT_SPRK)
  64.     end --3
  65.    end --2
  66.   end --1
  67. ) --*1
  68.  
  69. local mrcv = elements.allocate("TPT", "MRCV")
  70.  elements.element(mrcv,elem.element(elem.DEFAULT_PT_WTRV))
  71.  elements.property(mrcv, "Name" , "MRCV")
  72.  elements.property(mrcv, "Description" , "Mercury Vapor.")
  73.  elements.property(mrcv, "Color", 0x6D6567)
  74.  elements.property(mrcv, "Temperature", 637.85)
  75.  elements.property(mrcv, "LowTemperature", 618.32)
  76.  elements.property(mrcv, "LowTemperatureTransition", elements.DEFAULT_PT_MERC)
  77.  
  78.  elements.property(elements.DEFAULT_PT_MERC, "Update", --*1
  79.  function(i,x,y) --1
  80.   if sim.partProperty(i, "temp") > 628.91 then --2
  81.    if math.random(1,450) == 1 then --3
  82.     sim.partChangeType(i, elements.TPT_PT_MRCV)
  83.     end --3
  84.    end --2
  85.   end --1
  86.  ) --*1
  87.  
  88. local anti = elements.allocate("TPT" , "ANTI")
  89.  elements.element(anti, elements.element(elements.DEFAULT_PT_SING))
  90.  elements.property(anti, "Name" , "ANTI")
  91.  elements.property(anti, "Description" , "Anti Singularity, emits antigravity. Slowly increases in size")
  92.  elements.property(anti, "Color", 0xDBDBDB)
  93.  elements.property(anti, "HotAir", 0.015)
  94.  elements.property(anti, "MenuSection", 16)
  95.  elements.property(elements.TPT_PT_ANTI, "Update", --*1
  96.  function(i,x,y) --1
  97.   attract(i,x,y,-0.75)
  98.   if math.random(1,4) == 1 then --2
  99.    sim.partCreate(-1, x+math.random(-1,1),y+math.random(-1,1),elements.RADM_PT_ANTI)
  100.    sim.partProperty(i, "temp", sim.partProperty(i, "temp")-20)
  101.    end --2
  102.   end --1
  103.  ) --*1
  104.  
  105.  elements.property(elements.DEFAULT_PT_SING, "Update", --*1
  106.  function(i,x,y) --1
  107.   attract(i,x,y,0.75)
  108.   end --1
  109.  ) --*1
  110.  
  111. local ash = elements.allocate("TPT", "ASH")
  112.  elements.element(ash, elements.element(elements.DEFAULT_PT_DUST))
  113.  elements.property(ash, "Name" , "ASH")
  114.  elements.property(ash, "Description" , "Ash, very light powder. Turns into oil under pressure.")
  115.  elements.property(ash, "Color", 0x393224)
  116.  elements.property(ash, "Gravity", 0.056)
  117.  elements.property(ash, "Advection", 0.2)
  118.  elements.property(ash, "Weight", 2)
  119.  elements.property(ash, "AirDrag", 0.05)
  120.  elements.property(ash, "Flammable", 25.56)
  121.  elements.property(elements.TPT_PT_ASH, "Update", --*1
  122. function(i,x,y,s) --1
  123.   if sim.pressure(x/4,y/4) > 3.9 then --2
  124.    if math.random(1,950) == 1 then --3
  125.     sim.partProperty(i, "type", elements.DEFAULT_PT_OIL)
  126.     else if math.random (1,300000) == 1 then --4
  127.      sim.partProperty(i, "type", elements.DEFAULT_PT_SAWD)
  128.      end --4
  129.     end --3
  130.    end --2
  131.   end --1
  132.   ) --*1
  133.  
  134. local lhyg = elements.allocate("TPT", "LHYG")
  135.  elements.element(lhyg, elements.element(elements.DEFAULT_PT_LOXY))
  136.  elements.property(lhyg, "Name" , "LHYG")
  137.  elements.property(lhyg, "Description" , "Liquid Hydrogen, very cold. Incredibly flammable")
  138.  elements.property(lhyg, "Flammable", 5000.65)
  139.  elements.property(lhyg, "Explosive", 1)
  140.  elements.property(lhyg, "Color", 0x3D68CD)
  141.  elements.property(lhyg, "Temperature", 14.15)
  142.  elements.property(lhyg, "MenuSection", 7)
  143.  elements.property(lhyg, "Diffusion", 0.1)
  144.  elements.property(lhyg, "HighTemperature", 18.15)
  145.  elements.property(lhyg, "HighTemperatureTransition", elements.DEFAULT_PT_HYGN)
  146.  
  147.  elements.property(elements.DEFAULT_PT_HYGN, "LowTemperature", 15.24)
  148.  elements.property(elements.DEFAULT_PT_HYGN, "LowTemperatureTransition", elements.TPT_PT_LHYG)
  149.  
  150. local pb = elements.allocate("TPT" , "LEAD")
  151.  elements.element(pb, elements.element(elements.DEFAULT_PT_IRON))
  152.  elements.property(pb, "Name" , "LEAD")
  153.  elements.property(pb, "Description" , "Lead, absorbs neutrons. Conducts electricity.")
  154.  elements.property(pb, "Color", 0x686868)
  155.  elements.property(pb, "HighTemperature", 601.25)
  156.  elements.property(pb, "Properties", elements.PROP_NEUTABSORB+elements.PROP_CONDUCTS+elements.PROP_LIFE_DEC+elements.TYPE_SOLID+elements.PROP_DEADLY)
  157.  
  158. local mnpr = elements.allocate("TPT", "MNPR")
  159.  elements.element(mnpr, elements.element(elements.DEFAULT_PT_BOYL))
  160.  elements.property(mnpr, "Name" , "MONO")
  161.  elements.property(mnpr, "Description" , "Monopropellant. Disperses quickly.")
  162.  elements.property(mnpr, "Color", 0xB0B0B0)
  163.  elements.property(mnpr, "Advection", 0.2)
  164.  elements.property(mnpr, "AirDrag", 0.05)
  165.  elements.property(mnpr, "HotAir", 0.01)
  166.  elements.property(mnpr, "MenuSection", 16)
  167.  elements.property(elements.TPT_PT_MNPR, "Update", --*1
  168. function(i,x,y) --1
  169.  if math.random(1,30) == 1 then --2
  170.   sim.partKill(i)
  171.   end --2
  172.  end --1
  173.  ) --*1
  174.  
  175. local mnpl = elements.allocate("TPT", "MNPL")
  176.  elements.element(mnpl, elements.element(elements.DEFAULT_PT_LOXY))
  177.  elements.property(mnpl, "Name" , "MNPL")
  178.  elements.property(mnpl, "Description" , "Liquid Monopropellant. Releases lots of pressure and heat when boiled")
  179.  elements.property(mnpl, "Flammable", 0)
  180.  elements.property(mnpl, "Color", 0xA0A0A0)
  181.  elements.property(mnpl, "Temperature", 180.15)
  182.  elements.property(mnpl, "MenuSection", 5)
  183.  elements.property(mnpl, "Diffusion", 0.1)
  184.  elements.property(mnpl, "HighTemperature", 200.15)
  185.  elements.property(mnpl, "HighTemperatureTransition", elements.TPT_PT_MNPR)
  186.  elements.property(elements.TPT_PT_MNPL, "Update", --*1
  187.  function(i,x,y,s,nt) --1
  188.   for r in sim.neighbors(x,y,1,1) do --2
  189.    if sim.partProperty(r, "type") == elements.TPT_PT_MNPR then --3
  190.     if math.random(1,45) == 1 then --4
  191.      sim.partProperty(i, "temp", sim.partProperty(i, "temp")+50)
  192.      sim.pressure(x/4,y/4,8)
  193.      end --4
  194.     end --3
  195.    end --2
  196.   end --1
  197.  ) --*1
  198.  
  199.  elements.property(mnpr, "LowTemperature", 190.15)
  200.  elements.property(mnpr, "LowTemperatureTransition", elements.TPT_PT_MNPL)
  201.  
  202. local tchn = elements.allocate("TPT" , "TCHN")
  203.  elements.element(tchn, elements.element(elements.DEFAULT_PT_URAN))
  204.  elements.property(tchn, "Name" , "TCHN")
  205.  elements.property(tchn, "Description" , "Technetium, decays over time and leaves heat.")
  206.  elements.property(tchn, "Color", 0x205570)
  207.  elements.property(tchn, "MenuSection", 11)
  208. elements.property(elements.TPT_PT_TCHN, "Update", --*1
  209.  function(i,x,y) --1
  210.   if math.random(1,11520) == 1 then --2
  211.    sim.partProperty(i, "temp", sim.partProperty(i, "temp")+400)
  212.    sim.pressure(x/4,y/4,8)
  213.    sim.partProperty(i, "type", elements.DEFAULT_PT_STNE)
  214.    end --2
  215.   end --1
  216.  ) --*1
  217.  elements.property(tchn, "HighTemperatureTransition", elements.TPT_PT_TCHN)
  218.  
  219. local psac = elements.allocate("TPT", "PSAC")
  220.  elements.element(psac, elements.element(elements.DEFAULT_PT_SOAP))
  221.  elements.property(psac, "Name" , "PSAC")
  222.  elements.property(psac, "Description" , "Positronic acid, reacts violently with matter, weak acid.")
  223.  elements.property(psac, "Color", 0xFF20BB)
  224.  elements.property(psac, "Properties", elements.TYPE_LIQUID+elements.PROP_NEUTPENETRATE+elements.PROP_RADIOACTIVE)
  225.  elements.property(elem.TPT_PT_PSAC, "Update", --*1
  226.  function(i,x,y,s,nt) --1
  227.   if s ~=8 and nt ~=0 and nt - s > 0 then --2
  228.    if math.random(1,100) == 10 then --3
  229.     for r in sim.neighbors(x,y,1,1) do --4
  230.      if sim.partProperty(r, "type") ~= elements.DEFAULT_PT_DMND then --5
  231.       if sim.partProperty(r, "type") ~= elements.DEFAULT_PT_VACU then --6
  232.        if sim.partProperty(r, "type") ~= elements.DEFAULT_PT_VOID then --7
  233.         if sim.partProperty(r, "type") ~= elements.DEFAULT_PT_CLNE then --8
  234.          if sim.partProperty(r, "type") ~= elements.DEFAULT_PT_PCLN then --9
  235.           if math.random(1,6) == 3 then --10
  236.            sim.partKill(r)
  237.            sim.partProperty(i, "temp", sim.partProperty(i, "temp")+1600)
  238.            if math.random(1,25) == 20 then --11
  239.             sim.pressure(x/4,y/4,8)
  240.             sim.partKill(i)
  241.             return
  242.             end --11
  243.            end --10
  244.           end --9
  245.          end --8
  246.         end --7
  247.        end --6
  248.       end --5
  249.      end --4
  250.     end --3
  251.    end --2
  252.   end --1
  253.   ) --*1
  254.  
  255. local si = elements.allocate("TPT" , "SILC")
  256.  elements.element(si, elements.element(elements.DEFAULT_PT_IRON))
  257.  elements.property(si, "Name" , "SILC")
  258.  elements.property(si, "Description" , "Silicon, strong, conducts electricity. Lets air pass through")
  259.  elements.property(si, "Color", 0x686E76)
  260.  elements.property(si, "AirLoss", 1)
  261.  elements.property(si, "HighTemperature", 1687.01)
  262.  elements.property(si, "Properties", elements.PROP_CONDUCTS+elements.PROP_LIFE_DEC+elements.TYPE_SOLID+elements.PROP_HOT_GLOW)
  263.  
  264. local torn = elements.allocate("TPT" , "TORN")
  265.  elements.element(torn, elements.element(elements.DEFAULT_PT_BOYL))
  266.  elements.property(torn, "Name" , "TORN")
  267.  elements.property(torn, "Description" , "Tornado, self explanatory")
  268.  elements.property(torn, "Color", 0x8A9098)
  269.  elements.property(torn, "AirDrag", 0.05)
  270.  elements.property(torn, "AirDrag", 0.05)
  271.  elements.property(torn, "HotAir", -0.001)
  272.  elements.property(torn, "MenuSection", 16)
  273.  
  274. local lhlm = elements.allocate("TPT", "LHE")
  275.  elements.element(lhlm, elements.element(elements.DEFAULT_PT_SOAP))
  276.  elements.property(lhlm, "Name" , "LHE")
  277.  elements.property(lhlm, "Description" , "Liquid helium, incredibly cold.")
  278.  elements.property(lhlm, "Temperature", 4.01)
  279.  elements.property(lhlm, "Color", 0x5000FF)
  280.  elements.property(lhlm, "MenuSection", 11)
  281.  elements.property(elem.TPT_PT_LHE, "Update", --*1
  282. function(i,x,y,s) --1
  283.   if sim.partProperty(i, "temp") > 4.21 then --2
  284.    if math.random(1,400) > 1 then --3
  285.     sim.partKill(i)
  286.     else
  287.     sim.partProperty(i, "type", elements.TPT_PT_HE)
  288.     end --3
  289.    end --2
  290.   end --1
  291.   ) --*1
  292.  
  293. local he = elements.allocate("TPT", "HE")
  294.  elements.element(he, elements.element(elements.DEFAULT_PT_HYGN))
  295.  elements.property(he, "Name" , "HE")
  296.  elements.property(he, "Description", "Helium, floats.")
  297.  elements.property(he, "Color", 0x6111FF)
  298.  elements.property(he, "Diffusion", 1.5)
  299.  elements.property(he, "Gravity", -0.25)
  300.  elements.property(he, "Flammable", 0)
  301.  elements.property(he, "LowTemperature", -1)
  302.  elements.property(he, "LowTemperatureTransition", -1)
  303.  elements.property(he, "MenuSection", 16)
  304.  elements.property(elem.TPT_PT_HE, "Update", --*1
  305. function(i,x,y,s) --1
  306.   if sim.partProperty(i, "temp") < 4.15 then --2
  307.    if math.random(1,800) == 1 then --3
  308.     sim.partProperty(i, "type", elements.TPT_PT_LHE)
  309.     end --3
  310.    end --2
  311.   end --1
  312.   ) --*1
  313.  
  314.  
  315. local shake = elements.allocate("TPT", "SHAKE")
  316.  elements.element(shake, elements.element(elements.DEFAULT_PT_DMND))
  317.  elements.property(shake, "Name" , "SHAK")
  318.  elements.property(shake, "Description", "Shakes particles.")
  319.  elements.property(shake, "Color", 0xFFCCCC)
  320.  elements.property(shake, "Weight", 0)
  321.  elements.property(shake, "MenuSection", 13)
  322.  elements.property(elem.TPT_PT_SHAKE, "Update", --*1
  323. function(i,x,y,s) --1
  324.   for r in sim.neighbors(x,y,1,1) do --2
  325.    velocity(r,6,360)
  326.    end --2
  327.   sim.partKill(i)
  328.   end --1
  329.  ) --*1
  330.  
  331. local normal = elements.allocate("TPT", "NORMAL")
  332.  elements.element(normal, elements.element(elements.DEFAULT_PT_DMND))
  333.  elements.property(normal, "Name" , "NORM")
  334.  elements.property(normal, "Description", "Normalizes temperature and pressure in the selected area.")
  335.  elements.property(normal, "Color", 0xCCFFCC)
  336.  elements.property(normal, "Weight", 0)
  337.  elements.property(normal, "MenuSection", 13)
  338.  elements.property(elem.TPT_PT_NORMAL, "Update", --*1
  339. function(i,x,y,s) --1
  340.   sim.pressure(x/4,y/4,0)
  341.   for r in sim.neighbors(x,y,1,1) do --2
  342.    if sim.partProperty(r, "temp") > 295.15 then --3
  343.     sim.partProperty(r, "temp", sim.partProperty(r, "temp")-5)
  344.     end --3
  345.    if sim.partProperty(r, "temp") < 295.15 then --4
  346.     sim.partProperty(r, "temp", sim.partProperty(r, "temp")+5)
  347.     end --4
  348.    end --2
  349.   sim.partKill(i)
  350.   end --1
  351.  ) --*1
  352.  
  353. --[[ Not yet fixed.
  354. local cvl = elements.allocate("TPT" , "CAVE")
  355.  elements.element(cvl, elements.element(elements.DEFAULT_PT_BCOL))
  356.  elements.property(cvl, "Name" , "CAVE")
  357.  elements.property(cvl, "Description" , "Alright, Ive been thinking, when life gives you lemons... DONT MAKE LEMONADE! MAKE LIFE TAKE THE LEMONS BACK! GET MAD!!!")
  358.  elements.property(cvl, "Color", 0xFFFF00)
  359.  elements.property(cvl, "MenuSection", 16)
  360.  elements.property(elem.TPT_PT_CAVE, "Update", --*1
  361. function(i,x,y,s) --1
  362.   if s ~=0 then --2
  363.    if math.random(1,3) == 10 then --3
  364.     velocity(i,5,6)
  365.     if math.random(1,5) == 5 then --4
  366.      sim.partProperty(i, "temp", math.huge)
  367.      sim.pressure(x/4,y/4,8)
  368.      sim.partKill(i)
  369.      return
  370.      end --4
  371.     end --3
  372.    end --2
  373.   end --1
  374.   ) --*1
  375. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement