Advertisement
Guest User

0.3

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