DanielGalrito

Not Enough Particles

May 1st, 2015
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 34.87 KB | None | 0 0
  1. local Muon = elements.allocate("Muon", "MUON")
  2. local Ptrn = elements.allocate("Ptrn", "PTRN")
  3. local Dqrk = elements.allocate("Dqrk", "DQRK")
  4. local Uqrk = elements.allocate("Uqrk", "UQRK")
  5.  elements.element(Uqrk, elements.element(elements.DEFAULT_PT_ELEC))
  6.  elements.property(Uqrk, "Name", "UQRK")
  7.  elements.property(Uqrk, "Colour", 0xFFE02F1B)
  8.  elements.property(Uqrk, "Description", "Up quark, an elementary particle.") -- 2/3
  9.  elements.property(Uqrk, "Weight", -1)
  10.  elements.property(Uqrk, "HeatConduct", 251)
  11.  elements.property(Uqrk, "Temperature", 295.15)
  12.  elements.property(Uqrk, "Properties" , 0x14010)
  13.  elements.property(Uqrk, "AirLoss", 1)
  14.  elements.property(Uqrk, "Loss", 1)
  15.  elements.property(Uqrk, "Collision", -0.99)
  16.  
  17. function Uqrk(i, x, y, surround, nt)
  18.       if tpt.get_property("tmp2", i) == 0 then
  19.       local a = (math.random(360)-1) * 0.01745329;
  20.       tpt.set_property("life",680,i)
  21.       tpt.set_property("vx",2*math.cos(a),i)
  22.       tpt.set_property("vy",2*math.sin(a),i)
  23.       tpt.set_property("tmp2",1,i)
  24.    end
  25.  
  26. local collx = math.random(-1,1)
  27. local colly = math.random(-1,1)
  28. if tpt.get_property("tmp", i) == 0 then
  29. if tpt.get_property("type", x+collx, y+colly) == tpt.element('uqrk') then
  30. if tpt.get_property("tmp", x+collx, y+colly) == -1 then
  31. tpt.delete(x+collx, y+colly)
  32. sim.pressure(x/4,y/4,50)
  33. tpt.set_property("tmp2",0,i)
  34. tpt.set_property("tmp",0,i)
  35. tpt.set_property("type","mson",i)
  36. end
  37. end
  38. end
  39. end
  40. tpt.element_func(Uqrk, tpt.element('uqrk'))
  41.  
  42. local function UqrkG(i, r, g, b)
  43.     return 1, 0x00010001, 255, 224, 47, 27, 70, 224, 47, 27
  44. end
  45. tpt.graphics_func(UqrkG, tpt.element('uqrk'))
  46.  
  47.  
  48.  
  49.  elements.element(Dqrk, elements.element(elements.DEFAULT_PT_ELEC))
  50.  elements.property(Dqrk, "Name", "DQRK")
  51.  elements.property(Dqrk, "Colour", 0xFFE04C1B)
  52.  elements.property(Dqrk, "Description", "Down quark, an elementary particle.") -- -1/3
  53.  elements.property(Dqrk, "Weight", -1)
  54.  elements.property(Dqrk, "HeatConduct", 251)
  55.  elements.property(Dqrk, "Temperature", 295.15)
  56.  elements.property(Dqrk, "Properties" , 0x14010)
  57.  elements.property(Dqrk, "AirLoss", 1)
  58.  elements.property(Dqrk, "Loss", 1)
  59.  elements.property(Dqrk, "Collision", -0.99)
  60.  
  61. function Dqrk(i, x, y, surround, nt)
  62.       if tpt.get_property("tmp2", i) == 0 then
  63.       local a = (math.random(360)-1) * 0.01745329;
  64.       tpt.set_property("life",680,i)
  65.       tpt.set_property("vx",2*math.cos(a),i)
  66.       tpt.set_property("vy",2*math.sin(a),i)
  67.       tpt.set_property("tmp2",1,i)
  68.    end
  69.  
  70. local collx = math.random(-1,1)
  71. local colly = math.random(-1,1)
  72. if tpt.get_property("tmp", i) == 0 then
  73. if tpt.get_property("type", x+collx, y+colly) == tpt.element('uqrk') then
  74. if tpt.get_property("tmp", x+collx, y+colly) == 0 then
  75. tpt.delete(x+collx, y+colly)
  76. tpt.set_property("tmp2",0,i)
  77. tpt.set_property("type","hdrn",i)
  78. end
  79. end
  80. end
  81. if tpt.get_property("tmp", i) == 0 then
  82. if tpt.get_property("type", x+collx, y+colly) == tpt.element('dqrk') then
  83. if tpt.get_property("tmp", x+collx, y+colly) == -1 then
  84. tpt.delete(x+collx, y+colly)sim.pressure(x/4,y/4,50)
  85. tpt.set_property("tmp2",0,i)
  86. tpt.set_property("tmp",0,i)
  87. tpt.set_property("type","mson",i)
  88. end
  89. end
  90. end
  91. if tpt.get_property("tmp", i) == 0 then
  92. if tpt.get_property("type", x+collx, y+colly) == tpt.element('uqrk') then
  93. if tpt.get_property("tmp", x+collx, y+colly) == -1 then
  94. tpt.delete(x+collx, y+colly)
  95. sim.pressure(x/4,y/4,50)
  96. tpt.set_property("tmp2",0,i)
  97. tpt.set_property("tmp",-1,i)
  98. tpt.set_property("type","mson",i)
  99. end
  100. end
  101. end
  102. if tpt.get_property("tmp", i) == -1 then
  103. if tpt.get_property("type", x+collx, y+colly) == tpt.element('uqrk') then
  104. if tpt.get_property("tmp", x+collx, y+colly) == 0 then
  105. tpt.delete(x+collx, y+colly)
  106. sim.pressure(x/4,y/4,50)
  107. tpt.set_property("tmp2",0,i)
  108. tpt.set_property("tmp",1,i)
  109. tpt.set_property("type","mson",i)
  110. end
  111. end
  112. end
  113. if tpt.get_property("tmp", i) == -1 then
  114. if tpt.get_property("type", x+collx, y+colly) == tpt.element('uqrk') then
  115. if tpt.get_property("tmp", x+collx, y+colly) == -1 then
  116. tpt.delete(x+collx, y+colly)
  117. tpt.set_property("tmp2",0,i)
  118. tpt.set_property("tmp",-1,i)
  119. tpt.set_property("type","hdrn",i)
  120. end
  121. end
  122. end
  123. end
  124. tpt.element_func(Dqrk, tpt.element('dqrk'))
  125.  
  126. local function DqrkG(i, r, g, b)
  127.     return 1, 0x00010001, 255, 224, 76, 27, 70, 224, 76, 27
  128. end
  129. tpt.graphics_func(DqrkG, tpt.element('dqrk'))
  130.  
  131.  
  132.  
  133. local Cqrk = elements.allocate("Cqrk", "CQRK")
  134.  elements.element(Cqrk, elements.element(elements.DEFAULT_PT_ELEC))
  135.  elements.property(Cqrk, "Name", "CQRK")
  136.  elements.property(Cqrk, "Colour", 0xFFE02F1B)
  137.  elements.property(Cqrk, "Description", "Charm quark, an elementary particle.") -- 2/3
  138.  elements.property(Cqrk, "MenuVisible", 0)
  139.  elements.property(Cqrk, "Weight", -1)
  140.  elements.property(Cqrk, "HeatConduct", 251)
  141.  elements.property(Cqrk, "Temperature", 295.15)
  142.  elements.property(Cqrk, "Properties" , 0x14010)
  143.  elements.property(Cqrk, "AirLoss", 1)
  144.  elements.property(Cqrk, "Loss", 1)
  145.  elements.property(Cqrk, "Collision", -0.99)
  146.  
  147. function Cqrk(i, x, y, surround, nt)
  148.       if tpt.get_property("tmp2", i) == 0 then
  149.       local a = (math.random(360)-1) * 0.01745329;
  150.       tpt.set_property("life",680,i)
  151.       tpt.set_property("vx",2*math.cos(a),i)
  152.       tpt.set_property("vy",2*math.sin(a),i)
  153.       tpt.set_property("tmp2",1,i)
  154.    end
  155.  
  156. local collx = math.random(-1,1)
  157. local colly = math.random(-1,1)
  158. if tpt.get_property("tmp", i) == 0 then
  159. if tpt.get_property("type", x+collx, y+colly) == tpt.element('cqrk') then
  160. if tpt.get_property("tmp", x+collx, y+colly) == -1 then
  161. tpt.delete(x+collx, y+colly)
  162. sim.pressure(x/4,y/4,50)
  163. tpt.set_property("tmp2",0,i)
  164. tpt.set_property("tmp",0,i)
  165. tpt.set_property("type","mson",i)
  166. end
  167. end
  168. end
  169. end
  170. tpt.element_func(Cqrk, tpt.element('cqrk'))
  171.  
  172.  
  173.  
  174. local Sqrk = elements.allocate("Sqrk", "SQRK")
  175.  elements.element(Sqrk, elements.element(elements.DEFAULT_PT_ELEC))
  176.  elements.property(Sqrk, "Name", "SQRK")
  177.  elements.property(Sqrk, "Colour", 0xFFE02F1B)
  178.  elements.property(Sqrk, "Description", "Strange quark, hadrons with it decay slower.") -- -1/3
  179.  elements.property(Sqrk, "MenuVisible", 0)
  180.  elements.property(Sqrk, "Weight", -1)
  181.  elements.property(Sqrk, "HeatConduct", 251)
  182.  elements.property(Sqrk, "Temperature", 295.15)
  183.  elements.property(Sqrk, "Properties" , 0x14010)
  184.  elements.property(Sqrk, "AirLoss", 1)
  185.  elements.property(Sqrk, "Loss", 1)
  186.  elements.property(Sqrk, "Collision", -0.99)
  187.  
  188. function Sqrk(i, x, y, surround, nt)
  189.       if tpt.get_property("tmp2", i) == 0 then
  190.       local a = (math.random(360)-1) * 0.01745329;
  191.       tpt.set_property("life",680,i)
  192.       tpt.set_property("vx",2*math.cos(a),i)
  193.       tpt.set_property("vy",2*math.sin(a),i)
  194.       tpt.set_property("tmp2",1,i)
  195.    end
  196.  
  197. local collx = math.random(-1,1)
  198. local colly = math.random(-1,1)
  199. if tpt.get_property("tmp", i) == 0 then
  200. if tpt.get_property("type", x+collx, y+colly) == tpt.element('sqrk') then
  201. if tpt.get_property("tmp", x+collx, y+colly) == -1 then
  202. tpt.delete(x+collx, y+colly)
  203. sim.pressure(x/4,y/4,50)
  204. tpt.set_property("tmp2",0,i)
  205. tpt.set_property("tmp",0,i)
  206. tpt.set_property("type","mson",i)
  207. end
  208. end
  209. end
  210. end
  211. tpt.element_func(Sqrk, tpt.element('sqrk'))
  212.  
  213.  
  214.  
  215. local Tqrk = elements.allocate("Tqrk", "TQRK")
  216.  elements.element(Tqrk, elements.element(elements.DEFAULT_PT_ELEC))
  217.  elements.property(Tqrk, "Name", "TQRK")
  218.  elements.property(Tqrk, "Colour", 0xFFE02F1B)
  219.  elements.property(Tqrk, "Description", "Top quark, the most unstable quark, can't make hadrons.") -- 2/3
  220.  elements.property(Tqrk, "MenuVisible", 0)
  221.  elements.property(Tqrk, "Weight", -1)
  222.  elements.property(Tqrk, "HeatConduct", 251)
  223.  elements.property(Tqrk, "Temperature", 295.15)
  224.  elements.property(Tqrk, "Properties" , 0x14010)
  225.  elements.property(Tqrk, "AirLoss", 1)
  226.  elements.property(Tqrk, "Loss", 1)
  227.  elements.property(Tqrk, "Collision", -0.99)
  228.  
  229. function Tqrk(i, x, y, surround, nt)
  230.       if tpt.get_property("tmp2", i) == 0 then
  231.       local a = (math.random(360)-1) * 0.01745329;
  232.       tpt.set_property("life",680,i)
  233.       tpt.set_property("vx",2*math.cos(a),i)
  234.       tpt.set_property("vy",2*math.sin(a),i)
  235.       tpt.set_property("tmp2",1,i)
  236.    end
  237.  
  238. local collx = math.random(-1,1)
  239. local colly = math.random(-1,1)
  240. if tpt.get_property("tmp", i) == 0 then
  241. if tpt.get_property("type", x+collx, y+colly) == tpt.element('tqrk') then
  242. if tpt.get_property("tmp", x+collx, y+colly) == -1 then
  243. tpt.delete(x+collx, y+colly)
  244. sim.pressure(x/4,y/4,50)
  245. tpt.set_property("tmp2",0,i)
  246. tpt.set_property("tmp",0,i)
  247. tpt.set_property("type","mson",i)
  248. end
  249. end
  250. end
  251.  
  252. if math.random(1, 600) == 1 then
  253. tpt.set_property("tmp2",0,i)
  254. tpt.set_property("type","bqrk",i)
  255. tpt.create(x+collx, y+colly, "wbsn")
  256. tpt.set_property("tmp", -1, x+collx,y+colly)
  257. end
  258. end
  259. tpt.element_func(Tqrk, tpt.element('tqrk'))
  260.  
  261.  
  262.  
  263. local Bqrk = elements.allocate("Bqrk", "BQRK")
  264.  elements.element(Bqrk, elements.element(elements.DEFAULT_PT_ELEC))
  265.  elements.property(Bqrk, "Name", "BQRK")
  266.  elements.property(Bqrk, "Colour", 0xFFE02F1B)
  267.  elements.property(Bqrk, "Description", "Bottom quark, the second heaviest elementary particle.") -- -1/3
  268.  elements.property(Bqrk, "MenuVisible", 0)
  269.  elements.property(Bqrk, "Weight", -1)
  270.  elements.property(Bqrk, "HeatConduct", 251)
  271.  elements.property(Bqrk, "Temperature", 295.15)
  272.  elements.property(Bqrk, "Properties" , 0x14010)
  273.  elements.property(Bqrk, "AirLoss", 1)
  274.  elements.property(Bqrk, "Loss", 1)
  275.  elements.property(Bqrk, "Collision", -0.99)
  276.  
  277. function Bqrk(i, x, y, surround, nt)
  278.       if tpt.get_property("tmp2", i) == 0 then
  279.       local a = (math.random(360)-1) * 0.01745329;
  280.       tpt.set_property("life",680,i)
  281.       tpt.set_property("vx",2*math.cos(a),i)
  282.       tpt.set_property("vy",2*math.sin(a),i)
  283.       tpt.set_property("tmp2",1,i)
  284.    end
  285.  
  286. local collx = math.random(-1,1)
  287. local colly = math.random(-1,1)
  288. if tpt.get_property("tmp", i) == 0 then
  289. if tpt.get_property("type", x+collx, y+colly) == tpt.element('bqrk') then
  290. if tpt.get_property("tmp", x+collx, y+colly) == -1 then
  291. tpt.delete(x+collx, y+colly)
  292. sim.pressure(x/4,y/4,50)
  293. tpt.set_property("tmp2",0,i)
  294. tpt.set_property("tmp",0,i)
  295. tpt.set_property("type","mson",i)
  296. end
  297. end
  298. end
  299.  
  300. if math.random(1, 1000) == 1 then
  301. tpt.set_property("tmp2",0,i)
  302. tpt.set_property("type","cqrk",i)
  303. tpt.create(x+collx, y+colly, "wbsn")
  304. end
  305. end
  306. tpt.element_func(Bqrk, tpt.element('bqrk'))
  307.  
  308.  
  309.  
  310. local Hdrn = elements.allocate("Hdrn", "HDRN")
  311.  elements.element(Hdrn, elements.element(elements.DEFAULT_PT_ELEC))
  312.  elements.property(Hdrn, "Name", "HDRN")
  313.  elements.property(Hdrn, "Colour", 0xFF1BCCE0)
  314.  elements.property(Hdrn, "Description", "Hadron, a particle composed by quarks.")
  315.  elements.property(Hdrn, "MenuVisible", 0)
  316.  elements.property(Hdrn, "Weight", -1)
  317.  elements.property(Hdrn, "HeatConduct", 251)
  318.  elements.property(Hdrn, "Temperature", 295.15)
  319.  elements.property(Hdrn, "Properties" , 0x14010)
  320.  elements.property(Hdrn, "AirLoss", 1)
  321.  elements.property(Hdrn, "Loss", 1)
  322.  elements.property(Hdrn, "Collision", -0.99)
  323.  
  324. function Hdrn(i, x, y, surround, nt)
  325.       if tpt.get_property("tmp2", i) == 0 then
  326.       local a = (math.random(360)-1) * 0.01745329;
  327.       tpt.set_property("life",680,i)
  328.       tpt.set_property("vx",2*math.cos(a),i)
  329.       tpt.set_property("vy",2*math.sin(a),i)
  330.       tpt.set_property("tmp2",1,i)
  331.    end
  332.  
  333. local collx = math.random(-1,1)
  334. local colly = math.random(-1,1)
  335. if tpt.get_property("tmp", i) == 0 then
  336. if tpt.get_property("type", x+collx, y+colly) == tpt.element('uqrk') then
  337. if tpt.get_property("tmp", x+collx, y+colly) == 0 then
  338. tpt.delete(x+collx, y+colly)
  339. tpt.set_property("tmp2",0,i)
  340. tpt.set_property("type","prot",i)
  341. end
  342. end
  343. end
  344. if tpt.get_property("tmp", i) == 0 then
  345. if tpt.get_property("type", x+collx, y+colly) == tpt.element('dqrk') then
  346. if tpt.get_property("tmp", x+collx, y+colly) == 0 then
  347. tpt.delete(x+collx, y+colly)
  348. tpt.set_property("tmp2",0,i)
  349. tpt.set_property("type","neut",i)
  350. end
  351. end
  352. end
  353. if tpt.get_property("tmp", i) == -1 then
  354. if tpt.get_property("type", x+collx, y+colly) == tpt.element('uqrk') then
  355. if tpt.get_property("tmp", x+collx, y+colly) == -1 then
  356. tpt.delete(x+collx, y+colly)
  357. tpt.set_property("tmp2",0,i)
  358. tpt.set_property("type","aptn",i)
  359. end
  360. end
  361. end
  362. if tpt.get_property("tmp", i) == 0 then
  363. if tpt.get_property("type", x+collx, y+colly) == tpt.element('hdrn') then
  364. if tpt.get_property("tmp", x+collx, y+colly) == -1 then
  365. tpt.delete(x+collx, y+colly)
  366. if math.random(1,2) == 1 then
  367. tpt.set_property("tmp2",0,i)
  368. tpt.set_property("tmp",0,i)
  369. tpt.set_property("type","mson",i)
  370. tpt.create(x+collx, y+colly, "mson")
  371. end
  372. if math.random(1,2) == 2 then
  373. tpt.set_property("tmp2",0,i)
  374. tpt.set_property("tmp",1,i)
  375. tpt.set_property("type","mson",i)
  376. tpt.create(x+collx, y+colly, "mson")
  377. tpt.set_property("tmp", -1,x+collx,y+colly)
  378. end
  379. end
  380. end
  381. end
  382. end
  383. tpt.element_func(Hdrn, tpt.element('hdrn'))
  384.  
  385. local function HdrnG(i, r, g, b)
  386.     return 1, 0x00010001, 255, 27, 204, 224, 70, 27, 204, 224
  387. end
  388. tpt.graphics_func(HdrnG, tpt.element('hdrn'))
  389.  
  390.  
  391.  
  392.  elements.element(Ptrn, elements.element(elements.DEFAULT_PT_ELEC))
  393.  elements.property(Ptrn, "Name", "PTRN")
  394.  elements.property(Ptrn, "Colour", 0xFFDFEFFF)
  395.  elements.property(Ptrn, "Description", "Positron, anti-electron.")
  396.  elements.property(Ptrn, "Weight", -1)
  397.  elements.property(Ptrn, "HeatConduct", 251)
  398.  elements.property(Ptrn, "Temperature", 495.15)
  399.  elements.property(Ptrn, "Properties" , 0x14010)
  400.  elements.property(Ptrn, "AirLoss", 1)
  401.  elements.property(Ptrn, "Loss", 1)
  402.  elements.property(Ptrn, "Collision", -0.99)
  403.  
  404. function Ptrn(i, x, y, surround, nt)
  405.       if tpt.get_property("tmp2", i) == 0 then
  406.       local a = (math.random(360)-1) * 0.01745329;
  407.       tpt.set_property("life",680,i)
  408.       tpt.set_property("vx",2*math.cos(a),i)
  409.       tpt.set_property("vy",2*math.sin(a),i)
  410.       tpt.set_property("tmp2",1,i)
  411.    end
  412.  
  413. local collx = math.random(-1,1)
  414. local colly = math.random(-1,1)
  415. if tpt.get_property("type", x+collx, y+colly) == tpt.element('elec') then
  416. tpt.delete(x+collx, y+colly)
  417. sim.pressure(x/4,y/4,10)
  418. tpt.set_property("tmp2",0,i)
  419. tpt.set_property("type","ntno",i)
  420. tpt.create(x+collx, y+colly, "ntno")
  421. tpt.create(x+collx, y+colly, "phot")
  422. tpt.set_property("ctype", "4177920",x+collx,y+colly)
  423. tpt.set_property("tmp", 1,x+collx,y+colly)
  424. tpt.set_property("temp", 5273.15, x+collx, y+colly)
  425. tpt.create(x+collx, y+colly, "phot")
  426. tpt.set_property("ctype", "4177920",x+collx,y+colly)
  427. tpt.set_property("tmp", 1,x+collx,y+colly)
  428. tpt.set_property("temp", 5273.15, x+collx, y+colly)
  429. end
  430. end
  431. tpt.element_func(Ptrn, tpt.element('ptrn'))
  432.  
  433. local function PtrnG(i, r, g, b)
  434.     return 1, 0x00010001, 255, 223, 239, 255, 70, 223, 239, 255
  435. end
  436. tpt.graphics_func(PtrnG, tpt.element('ptrn'))
  437.  
  438.  
  439.  
  440. local Ntno = elements.allocate("Ntno", "NTNO")
  441.  elements.element(Ntno, elements.element(elements.DEFAULT_PT_ELEC))
  442.  elements.property(Ntno, "Name", "NTNO")
  443.  elements.property(Ntno, "Colour", 0xFFDFEFFF)
  444.  elements.property(Ntno, "Description", "Neutrino, created by beta decays and matter-antimatter reactions.")
  445.  elements.property(Ntno, "MenuVisible", 0)
  446.  elements.property(Ntno, "Weight", -1)
  447.  elements.property(Ntno, "HeatConduct", 0)
  448.  elements.property(Ntno, "Temperature", 295.15)
  449.  elements.property(Ntno, "Properties" , 0x14010)
  450.  elements.property(Ntno, "AirLoss", 1)
  451.  elements.property(Ntno, "Loss", 1)
  452.  elements.property(Ntno, "Collision", -0.99)
  453.  
  454. function Ntno(i, x, y, surround, nt)
  455.       if tpt.get_property("tmp2", i) == 0 then
  456.       local a = (math.random(360)-1) * 0.01745329;
  457.       tpt.set_property("life",680,i)
  458.       tpt.set_property("vx",10*math.cos(a),i)
  459.       tpt.set_property("vy",10*math.sin(a),i)
  460.       tpt.set_property("tmp2",1,i)
  461.    end
  462. local collx = math.random(-1,1)
  463. local colly = math.random(-1,1)
  464. if tpt.get_property("tmp", i) == 0 then
  465. if tpt.get_property("type", x+collx, y+colly) == tpt.element('ntno') then
  466. if tpt.get_property("tmp", x+collx, y+colly) == -1 then
  467. tpt.delete(x+collx, y+colly)
  468. tpt.set_property("life",1,i)
  469. tpt.create(x+collx, y+colly, "phot")
  470. tpt.set_property("ctype", "4177920",x+collx,y+colly)
  471. tpt.set_property("tmp", 1,x+collx,y+colly)
  472. tpt.create(x+collx, y+colly, "phot")
  473. tpt.set_property("ctype", "4177920",x+collx,y+colly)
  474. tpt.set_property("tmp", 1,x+collx,y+colly)
  475. end
  476. end
  477. end
  478. if tpt.get_property("tmp", i) == -1 then
  479. if tpt.get_property("type", x+collx, y+colly) == tpt.element('hygn') then
  480. if math.random(1,10000) == 1 then
  481. tpt.set_property("tmp2",0,i)
  482. tpt.set_property("type","ptrn",i)
  483. tpt.set_property("type", neut,x+collx,y+colly)
  484. tpt.create(x+collx, y+colly, "elec")
  485. end
  486. end
  487. end
  488. if tpt.get_property("tmp", i) == 0 then
  489. if tpt.get_property("type", x+collx, y+colly) == tpt.element('deut') then
  490. if math.random(1,10000) == 1 then
  491. tpt.set_property("tmp2",0,i)
  492. tpt.set_property("type","elec",i)
  493. tpt.set_property("type","watr",x+collx,y+colly)
  494. tpt.create(x+collx, y+colly, "prot")
  495. end
  496. end
  497. end
  498. end
  499. tpt.element_func(Ntno, tpt.element('ntno'))
  500.  
  501. local function NtnoG(i, r, g, b)
  502. if tpt.get_property("tmp", i) == 0 then
  503.     return 1, 0x00010001, 255, 223, 239, 255, 70, 255, 50, 255
  504. end
  505. if tpt.get_property("tmp", i) == -1 then
  506.     return 1, 0x00010001, 255, 223, 239, 255, 70, 50, 150, 50
  507. end
  508. end
  509. tpt.graphics_func(NtnoG, tpt.element('ntno'))
  510.  
  511. function test(event)
  512.     for i = 1,27 do
  513.         sim.can_move(tpt.element('ntno'), i, 2)
  514.     end
  515.     for i2 = 29,255 do
  516.         sim.can_move(tpt.element('ntno'),i2, 2)
  517.     end
  518. end
  519. tpt.register_step(test)
  520.  
  521.  
  522.  
  523. local Wbsn = elements.allocate("Wbsn", "WBSN")
  524.  elements.element(Wbsn, elements.element(elements.DEFAULT_PT_ELEC))
  525.  elements.property(Wbsn, "Name", "WBSN")
  526.  elements.property(Wbsn, "Colour", 0xFFDFEFFF)
  527.  elements.property(Wbsn, "Description", "W boson, determines beta decay.")
  528.  elements.property(Wbsn, "MenuVisible", 0)
  529.  elements.property(Wbsn, "Weight", -1)
  530.  elements.property(Wbsn, "HeatConduct", 251)
  531.  elements.property(Wbsn, "Temperature", 295.15)
  532.  elements.property(Wbsn, "Properties" , 0x14010)
  533.  elements.property(Wbsn, "AirLoss", 1)
  534.  elements.property(Wbsn, "Loss", 1)
  535.  elements.property(Wbsn, "Collision", -0.99)
  536.  
  537. function Wbsn(i, x, y, surround, nt)
  538.       if tpt.get_property("tmp2", i) == 0 then
  539.       local a = (math.random(360)-1) * 0.01745329;
  540.       tpt.set_property("life",680,i)
  541.       tpt.set_property("vx",2*math.cos(a),i)
  542.       tpt.set_property("vy",2*math.sin(a),i)
  543.       tpt.set_property("tmp2",1,i)
  544.    end
  545.  
  546. local collx = math.random(-1,1)
  547. local colly = math.random(-1,1)
  548. local alife = tpt.get_property("life", i)
  549. if tpt.get_property("tmp", i) == 0 then
  550. if math.random(1,alife) == 1 then
  551. tpt.set_property("tmp2",0,i)
  552. tpt.set_property("type","elec",i)
  553. tpt.create(x+collx, y+colly, "ntno")
  554. tpt.set_property("tmp", -1,x+collx,y+colly)
  555. end
  556. end
  557. if tpt.get_property("tmp", i) == -1 then
  558. if math.random(1,alife) == 2 then
  559. tpt.set_property("tmp2",0,i)
  560. tpt.set_property("type","ptrn",i)
  561. tpt.create(x+collx, y+colly, "ntno")
  562. end
  563. end
  564. end
  565. tpt.element_func(Wbsn, tpt.element('wbsn'))
  566.  
  567. local function WbsnG(i, r, g, b)
  568.     return 1, 0x00010001, 255, 223, 239, 255, 70, 70, 70, 150
  569. end
  570. tpt.graphics_func(WbsnG, tpt.element('wbsn'))
  571.  
  572.  
  573.  
  574. local Zbsn = elements.allocate("Zbsn", "ZBSN")
  575.  elements.element(Zbsn, elements.element(elements.DEFAULT_PT_ELEC))
  576.  elements.property(Zbsn, "Name", "ZBSN")
  577.  elements.property(Zbsn, "Colour", 0xFFDFEFFF)
  578.  elements.property(Zbsn, "Description", "Z boson, i have no damn idea of what it does, so it just decays.")
  579.  elements.property(Zbsn, "MenuVisible", 0)
  580.  elements.property(Zbsn, "Weight", -1)
  581.  elements.property(Zbsn, "HeatConduct", 251)
  582.  elements.property(Zbsn, "Temperature", 295.15)
  583.  elements.property(Zbsn, "Properties" , 0x14010)
  584.  elements.property(Zbsn, "AirLoss", 1)
  585.  elements.property(Zbsn, "Loss", 1)
  586.  elements.property(Zbsn, "Collision", -0.99)
  587.  
  588. function Zbsn(i, x, y, surround, nt)
  589.       if tpt.get_property("tmp2", i) == 0 then
  590.       local a = (math.random(360)-1) * 0.01745329;
  591.       tpt.set_property("life",680,i)
  592.       tpt.set_property("vx",2*math.cos(a),i)
  593.       tpt.set_property("vy",2*math.sin(a),i)
  594.       tpt.set_property("tmp2",1,i)
  595.    end
  596.  
  597.  
  598. local collx = math.random(-1,1)
  599. local colly = math.random(-1,1)
  600. local chance = math.random(1, 100)
  601. local chance2 = math.random(1, 30)
  602. if math.random(1, 100) == 1 then
  603. if chance < 11 then
  604. if chance2 < 11 then
  605. tpt.set_property("tmp2",0,i)
  606. tpt.set_property("type","elec",i)
  607. tpt.create(x+collx, y+colly, "ptrn")
  608. end
  609. if chance2 > 10 and chance2 < 21 then
  610. tpt.set_property("tmp2",0,i)
  611. tpt.set_property("tmp",1,i)
  612. tpt.set_property("type","muon",i)
  613. tpt.create(x+collx, y+colly, "muon")
  614. end
  615. if chance2 > 20 then -- tau
  616. tpt.set_property("tmp2",0,i)
  617. tpt.set_property("type","none",i)
  618. tpt.create(x+collx, y+colly, "none")
  619. --tpt.set_property("tmp", 1,x+collx,y+colly)
  620. end
  621. end
  622. if chance > 10 and chance < 31 then -- neutrino decay
  623. tpt.set_property("tmp2",0,i)
  624. tpt.set_property("type","none",i)
  625. --tpt.create(x+collx, y+colly, "none")
  626. end
  627. if chance > 30 then
  628. if chance2 < 6 then
  629. tpt.set_property("tmp2",0,i)
  630. tpt.set_property("type","uqrk",i)
  631. tpt.create(x+collx, y+colly, "uqrk")
  632. tpt.set_property("tmp", -1,x+collx,y+colly)
  633. end
  634. if chance2 > 5 and chance2 < 11 then
  635. tpt.set_property("tmp2",0,i)
  636. tpt.set_property("type","dqrk",i)
  637. tpt.create(x+collx, y+colly, "dqrk")
  638. tpt.set_property("tmp", -1,x+collx,y+colly)
  639. end
  640. if chance2 > 10 and chance2 < 16 then
  641. tpt.set_property("tmp2",0,i)
  642. tpt.set_property("type","sqrk",i)
  643. tpt.create(x+collx, y+colly, "sqrk")
  644. tpt.set_property("tmp", -1,x+collx,y+colly)
  645. end
  646. if chance2 > 15 and chance2 < 21 then
  647. tpt.set_property("tmp2",0,i)
  648. tpt.set_property("type","cqrk",i)
  649. tpt.create(x+collx, y+colly, "cqrk")
  650. tpt.set_property("tmp", -1,x+collx,y+colly)
  651. end
  652. if chance2 > 20 and chance2 < 26 then
  653. tpt.set_property("tmp2",0,i)
  654. tpt.set_property("type","bqrk",i)
  655. tpt.create(x+collx, y+colly, "bqrk")
  656. tpt.set_property("tmp", -1,x+collx,y+colly)
  657. end
  658. if chance2 > 25 and chance2 < 31 then
  659. tpt.set_property("tmp2",0,i)
  660. tpt.set_property("type","tqrk",i)
  661. tpt.create(x+collx, y+colly, "tqrk")
  662. tpt.set_property("tmp", -1,x+collx,y+colly)
  663. end
  664. end
  665. end
  666. end
  667. tpt.element_func(Zbsn, tpt.element('zbsn'))
  668.  
  669.  
  670.  
  671. local Mson = elements.allocate("Mson", "MSON")
  672.  elements.element(Mson, elements.element(elements.DEFAULT_PT_ELEC))
  673.  elements.property(Mson, "Name", "MSON")
  674.  elements.property(Mson, "Colour", 0xFF6F87A5)
  675.  elements.property(Mson, "Description", "Meson, quark and anti-quark.")
  676.  elements.property(Mson, "MenuVisible", 0)
  677.  elements.property(Mson, "Weight", -1)
  678.  elements.property(Mson, "HeatConduct", 251)
  679.  elements.property(Mson, "Temperature", 295.15)
  680.  elements.property(Mson, "Properties" , 0x14010)
  681.  elements.property(Mson, "AirLoss", 1)
  682.  elements.property(Mson, "Loss", 1)
  683.  elements.property(Mson, "Collision", -0.99)
  684.  
  685. function Mson(i, x, y, surround, nt)
  686.       if tpt.get_property("tmp2", i) == 0 then
  687.       local a = (math.random(360)-1) * 0.01745329;
  688.       tpt.set_property("life",680,i)
  689.       tpt.set_property("vx",2*math.cos(a),i)
  690.       tpt.set_property("vy",2*math.sin(a),i)
  691.       tpt.set_property("tmp2",1,i)
  692.    end
  693.  
  694. local collx = math.random(-1,1)
  695. local colly = math.random(-1,1)
  696. if tpt.get_property("tmp", i) == 0 then
  697. if math.random(1,20) == 1 then
  698. tpt.create(x+collx, y+colly, "phot")
  699. tpt.set_property("ctype", "4177920",x+collx,y+colly)
  700. tpt.set_property("tmp", 1,x+collx,y+colly)
  701. tpt.set_property("temp", 5273.15, x+collx, y+colly)
  702. tpt.create(x+collx, y+colly, "phot")
  703. tpt.set_property("ctype", "4177920",x+collx,y+colly)
  704. tpt.set_property("tmp", 1,x+collx,y+colly)
  705. tpt.set_property("temp", 5273.15, x+collx, y+colly)
  706. tpt.set_property("life",1,i)
  707. end
  708. end
  709. if tpt.get_property("tmp", i) == 1 then
  710. if math.random(1,20) == 1 then
  711. tpt.create(x+collx, y+colly, "muon")
  712. tpt.set_property("tmp", 1,x+collx,y+colly)
  713. tpt.set_property("temp", 5273.15, x+collx, y+colly)
  714. tpt.set_property("life",1,i)
  715. end
  716. end
  717. if tpt.get_property("tmp", i) == -1 then
  718. if math.random(1,20) == 1 then
  719. tpt.create(x+collx, y+colly, "muon")
  720. tpt.set_property("temp", 5273.15, x+collx, y+colly)
  721. tpt.set_property("life",1,i)
  722. end
  723. end
  724. end
  725. tpt.element_func(Mson, tpt.element('mson'))
  726.  
  727.  
  728.  
  729.  elements.element(Muon, elements.element(elements.DEFAULT_PT_ELEC))
  730.  elements.property(Muon, "Name", "MUON")
  731.  elements.property(Muon, "Colour", 0xFF21FF33)
  732.  elements.property(Muon, "Description", "Muon, secondary generation lepton.")
  733.  elements.property(Muon, "Weight", -1)
  734.  elements.property(Muon, "HeatConduct", 251)
  735.  elements.property(Muon, "Temperature", 295.15)
  736.  elements.property(Muon, "Properties" , 0x14010)
  737.  elements.property(Muon, "AirLoss", 1)
  738.  elements.property(Muon, "Loss", 1)
  739.  elements.property(Muon, "Collision", -0.99)
  740.  
  741. function Muon(i, x, y, surround, nt)
  742.       if tpt.get_property("tmp2", i) == 0 then
  743.       local a = (math.random(360)-1) * 0.01745329;
  744.       tpt.set_property("life",680,i)
  745.       tpt.set_property("vx",2*math.cos(a),i)
  746.       tpt.set_property("vy",2*math.sin(a),i)
  747.       tpt.set_property("tmp2",1,i)
  748.    end
  749. local collx = math.random(-1,1)
  750. local colly = math.random(-1,1)
  751. if tpt.get_property("type", x+collx, y+colly) == tpt.element('hygn') then
  752. tpt.set_property("temp",math.huge,i)
  753. tpt.set_property("temp", math.huge, x+collx, y+colly)
  754. sim.pressure(x/4,y/4,math.huge)                    
  755. tpt.set_property("type","none",i)
  756. end
  757.  
  758. if math.random(1,200) == 1 then
  759. if tpt.get_property("tmp", i) == 0 then
  760. tpt.set_property("type","elec",i)
  761. end
  762. if tpt.get_property("tmp", i) == 1 then
  763. tpt.set_property("type","ptrn",i)
  764. end
  765. end
  766. end
  767. tpt.element_func(Muon, tpt.element('muon'))
  768.  
  769.  
  770.  
  771. local Aptn = elements.allocate("Aptn", "APTN")
  772.  elements.element(Aptn, elements.element(elements.DEFAULT_PT_PROT))
  773.  elements.property(Aptn, "Name", "APTN")
  774.  elements.property(Aptn, "Colour", 0xFFE02F1B)
  775.  elements.property(Aptn, "Description", "Anti-proton.")
  776.  elements.property(Aptn, "MenuVisible", 0)
  777.  elements.property(Aptn, "Weight", -1)
  778.  elements.property(Aptn, "HeatConduct", 251)
  779.  elements.property(Aptn, "Temperature", 295.15)
  780.  elements.property(Aptn, "Properties" , 0x14010)
  781.  elements.property(Aptn, "AirLoss", 1)
  782.  elements.property(Aptn, "Loss", 1)
  783.  elements.property(Aptn, "Collision", -0.99)
  784.  
  785. function Aptn(i, x, y, surround, nt)
  786.       if tpt.get_property("tmp2", i) == 0 then
  787.       local a = (math.random(360)-1) * 0.01745329;
  788.       tpt.set_property("life",680,i)
  789.       tpt.set_property("vx",2*math.cos(a),i)
  790.       tpt.set_property("vy",2*math.sin(a),i)
  791.       tpt.set_property("tmp2",1,i)
  792.    end
  793. local collx = math.random(-1,1)
  794. local colly = math.random(-1,1)
  795. local chance = math.random(1,100)
  796. if tpt.get_property("type", x+collx, y+colly) == tpt.element('prot') then
  797. tpt.delete(x+collx, y+colly)
  798. sim.pressure(x/4,y/4,150)  
  799. if chance < 51 then
  800. tpt.create(x+collx, y+colly, "mson")
  801. tpt.create(x+collx, y+colly, "mson")
  802. tpt.create(x+collx, y+colly, "mson")
  803. tpt.set_property("life",1,i)
  804. end
  805. if chance > 50 then
  806. tpt.create(x+collx, y+colly, "mson")
  807. tpt.create(x+collx, y+colly, "mson")
  808. tpt.set_property("tmp", 1,x+collx,y+colly)
  809. tpt.create(x+collx, y+colly, "mson")
  810. tpt.set_property("tmp", -1,x+collx,y+colly)
  811. tpt.set_property("life",1,i)
  812. end
  813. end
  814. if tpt.get_property("type", x+collx, y+colly) == tpt.element('neut') then
  815. tpt.delete(x+collx, y+colly)
  816. sim.pressure(x/4,y/4,150)
  817. if chance < 51 then
  818. tpt.create(x+collx, y+colly, "mson")
  819. tpt.create(x+collx, y+colly, "mson")
  820. tpt.set_property("tmp", 1,x+collx,y+colly)
  821. tpt.create(x+collx, y+colly, "mson")
  822. tpt.set_property("life",1,i)
  823. end
  824. if chance > 50 then
  825. tpt.create(x+collx, y+colly, "mson")
  826. tpt.set_property("tmp", 1,x+collx,y+colly)
  827. tpt.create(x+collx, y+colly, "mson")
  828. tpt.set_property("tmp", -1,x+collx,y+colly)
  829. tpt.create(x+collx, y+colly, "mson")
  830. tpt.set_property("tmp", -1,x+collx,y+colly)
  831. tpt.set_property("life",1,i)
  832. end
  833. end
  834. if tpt.get_property("type", x+collx, y+colly) == tpt.element('hygn') then
  835. tpt.delete(x+collx, y+colly)
  836. tpt.create(x+collx, y+colly, "elec")
  837. sim.pressure(x/4,y/4,150)
  838. if chance < 51 then
  839. tpt.create(x+collx, y+colly, "mson")
  840. tpt.create(x+collx, y+colly, "mson")
  841. tpt.create(x+collx, y+colly, "mson")
  842. tpt.set_property("life",1,i)
  843. end
  844. if chance > 50 then
  845. tpt.create(x+collx, y+colly, "mson")
  846. tpt.create(x+collx, y+colly, "mson")
  847. tpt.set_property("tmp", 1,x+collx,y+colly)
  848. tpt.create(x+collx, y+colly, "mson")
  849. tpt.set_property("tmp", -1,x+collx,y+colly)
  850. tpt.set_property("life",1,i)
  851. end
  852. end
  853. end
  854. tpt.element_func(Aptn, tpt.element('aptn'))
  855.  
  856. local function AptnG(i, r, g, b)
  857.     return 1, 0x00020001, 255, 224, 47, 27, 7, 250, 170, 170
  858. end
  859. tpt.graphics_func(AptnG, tpt.element('aptn'))
  860.  
  861.  
  862.  
  863. local Antn = elements.allocate("Antn", "ANTN")
  864.  elements.element(Antn, elements.element(elements.DEFAULT_PT_NEUT))
  865.  elements.property(Antn, "Name", "ANTN")
  866.  elements.property(Antn, "Colour", 0x20E0FF)
  867.  elements.property(Antn, "Description", "Anti-neutron.")
  868.  elements.property(Antn, "MenuVisible", 0)
  869.  elements.property(Antn, "Weight", -1)
  870.  elements.property(Antn, "HeatConduct", 251)
  871.  elements.property(Antn, "Temperature", 295.15)
  872.  elements.property(Antn, "Properties" , 0x14010)
  873.  elements.property(Antn, "AirLoss", 1)
  874.  elements.property(Antn, "Loss", 1)
  875.  elements.property(Antn, "Collision", -0.99)
  876.  
  877. function Antn(i, x, y, surround, nt)
  878.       if tpt.get_property("tmp2", i) == 0 then
  879.       local a = (math.random(360)-1) * 0.01745329;
  880.       tpt.set_property("life",680,i)
  881.       tpt.set_property("vx",2*math.cos(a),i)
  882.       tpt.set_property("vy",2*math.sin(a),i)
  883.       tpt.set_property("tmp2",1,i)
  884.    end
  885. local collx = math.random(-1,1)
  886. local colly = math.random(-1,1)
  887. local chance = math.random(1,100)
  888. if tpt.get_property("type", x+collx, y+colly) == tpt.element('neut') then
  889. tpt.delete(x+collx, y+colly)
  890. sim.pressure(x/4,y/4,150)
  891. if chance < 51 then
  892. tpt.create(x+collx, y+colly, "mson")
  893. tpt.create(x+collx, y+colly, "mson")
  894. tpt.create(x+collx, y+colly, "mson")
  895. tpt.set_property("life",1,i)
  896. end
  897. if chance > 50 then
  898. tpt.create(x+collx, y+colly, "mson")
  899. tpt.create(x+collx, y+colly, "mson")
  900. tpt.set_property("tmp", 1,x+collx,y+colly)
  901. tpt.create(x+collx, y+colly, "mson")
  902. tpt.set_property("tmp", -1,x+collx,y+colly)
  903. tpt.set_property("life",1,i)
  904. end
  905. end
  906. if tpt.get_property("type", x+collx, y+colly) == tpt.element('prot') then
  907. tpt.delete(x+collx, y+colly)
  908. sim.pressure(x/4,y/4,150)
  909. if chance < 51 then
  910. tpt.create(x+collx, y+colly, "mson")
  911. tpt.create(x+collx, y+colly, "mson")
  912. tpt.set_property("tmp", 1,x+collx,y+colly)
  913. tpt.create(x+collx, y+colly, "mson")
  914. tpt.set_property("life",1,i)
  915. end
  916. if chance > 50 then
  917. tpt.create(x+collx, y+colly, "mson")
  918. tpt.set_property("tmp", 1,x+collx,y+colly)
  919. tpt.create(x+collx, y+colly, "mson")
  920. tpt.set_property("tmp", 1,x+collx,y+colly)
  921. tpt.create(x+collx, y+colly, "mson")
  922. tpt.set_property("tmp", -1,x+collx,y+colly)
  923. tpt.set_property("life",1,i)
  924. end
  925. end
  926. if tpt.get_property("type", x+collx, y+colly) == tpt.element('hygn') then
  927. tpt.delete(x+collx, y+colly)
  928. tpt.create(x+collx, y+colly, "elec")
  929. sim.pressure(x/4,y/4,150)
  930. if chance < 51 then
  931. tpt.create(x+collx, y+colly, "mson")
  932. tpt.create(x+collx, y+colly, "mson")
  933. tpt.set_property("tmp", 1,x+collx,y+colly)
  934. tpt.create(x+collx, y+colly, "mson")
  935. tpt.set_property("life",1,i)
  936. end
  937. if chance > 50 then
  938. tpt.create(x+collx, y+colly, "mson")
  939. tpt.set_property("tmp", 1,x+collx,y+colly)
  940. tpt.create(x+collx, y+colly, "mson")
  941. tpt.set_property("tmp", 1,x+collx,y+colly)
  942. tpt.create(x+collx, y+colly, "mson")
  943. tpt.set_property("tmp", -1,x+collx,y+colly)
  944. tpt.set_property("life",1,i)
  945. end
  946. end
  947. end
  948. tpt.element_func(Antn, tpt.element('antn'))
  949.  
  950. local function AntnG(i, r, g, b)
  951.     return 1, 0x00010001, 255, 32, 224, 255, 120, 170, 48, 208
  952.  
  953. end
  954. tpt.graphics_func(AntnG, tpt.element('antn'))
  955.  
  956.  
  957.  
  958. local Higg = elements.allocate("Higg", "HIGG")
  959.  elements.element(Higg, elements.element(elements.DEFAULT_PT_ELEC))
  960.  elements.property(Higg, "Name", "HIGG")
  961.  elements.property(Higg, "Colour", 0xFFF3932A)
  962.  elements.property(Higg, "Description", "Higgs boson, gives mass to particles.")
  963.  elements.property(Higg, "MenuVisible", 0)
  964.  elements.property(Higg, "Weight", -1)
  965.  elements.property(Higg, "HeatConduct", 251)
  966.  elements.property(Higg, "Temperature", 295.15)
  967.  elements.property(Higg, "Properties" , 0x14010)
  968.  elements.property(Higg, "AirLoss", 1)
  969.  elements.property(Higg, "Loss", 1)
  970.  elements.property(Higg, "Collision", -0.99)
  971.  
  972. function Higg(i, x, y, surround, nt)
  973.       if tpt.get_property("tmp2", i) == 0 then
  974.       local a = (math.random(360)-1) * 0.01745329;
  975.       tpt.set_property("life",10,i)
  976.       tpt.set_property("vx",2*math.cos(a),i)
  977.       tpt.set_property("vy",2*math.sin(a),i)
  978.       tpt.set_property("tmp2",1,i)
  979.    end
  980.  
  981. local collx = math.random(-1,1)
  982. local colly = math.random(-1,1)
  983. if tpt.get_property("tmp", i) == 0 then
  984. if tpt.get_property("type", x+collx, y+colly) == tpt.element('uqrk') then
  985. if tpt.get_property("tmp", x+collx, y+colly) == -1 then
  986. tpt.delete(x+collx, y+colly)
  987. sim.pressure(x/4,y/4,50)
  988. tpt.set_property("tmp2",0,i)
  989. tpt.set_property("tmp",0,i)
  990. tpt.set_property("type","mson",i)
  991. end
  992. end
  993. end
  994. end
  995. tpt.element_func(Higg, tpt.element('higg'))
  996.  
  997. local function HiggG(i, r, g, b)
  998.     return 1, 0x00010001, 255, 243, 147, 42, 70, 243, 147, 42
  999. end
  1000. tpt.graphics_func(HiggG, tpt.element('higg'))
  1001.  
  1002.  
  1003.  
  1004. function Pairproduction(i, x, y, surround, nt)
  1005. collx = math.random(-1,1)
  1006. colly = math.random(-1,1)
  1007. collx2 = math.random(-1,1)
  1008. colly2 = math.random(-1,1)
  1009. local atmp2 = tpt.get_property("tmp2", i)
  1010. local avx = tpt.get_property("vx", i)
  1011. local avy = tpt.get_property("vy", i)
  1012. local chance = math.random(1,2)
  1013. --if tpt.get_property("ctype", i) == 4177920 then
  1014. if atmp2 > 0 then
  1015. if tpt.get_property("type", x+collx, y+colly) == tpt.element('none') then
  1016. if tpt.get_property("type", x+collx2, y+colly2) == tpt.element('none') then
  1017. tpt.create(x+collx, y+colly, "elec")
  1018. tpt.set_property("tmp2", atmp2 - chance,x+collx,y+colly)
  1019. tpt.set_property("vx", avx/2,x+collx,y+colly)
  1020. tpt.set_property("vy", avy/2,x+collx,y+colly)
  1021. tpt.set_property("life", 500,x+collx,y+colly)
  1022.  
  1023. tpt.create(x+collx2, y+colly2, "ptrn")
  1024. tpt.set_property("tmp2", atmp2 - chance,x+collx2,y+colly2)
  1025. tpt.set_property("vx", avx/2,x+collx2,y+colly2)
  1026. tpt.set_property("vy", avy/2,x+collx2,y+colly2)
  1027. tpt.set_property("life", 500,x+collx2,y+colly2)
  1028. tpt.set_property("life",1,i)
  1029. --end
  1030. end
  1031. end
  1032. end
  1033.  
  1034. --if tpt.get_property("ctype", i) == 4177920 then
  1035. --if tpt.get_property("type", x+collx, y+colly) == tpt.element('nble') then
  1036. --tpt.set_property("type", "plsm",x+collx,y+colly)
  1037. --tpt.set_property("ctype", "nble",x+collx,y+colly)
  1038. --tpt.set_property("life",1000,x+collx,y+colly)
  1039. --tpt.set_property("life",0,i)
  1040. --end
  1041. --end
  1042.  
  1043. end
  1044. tpt.element_func(Pairproduction, tpt.element('phot'))
  1045.  
  1046. function test(event)
  1047.     for i = 1,27 do
  1048.         sim.can_move(tpt.element('ntno'), i, 2)
  1049.     end
  1050.     for i2 = 29,255 do
  1051.         sim.can_move(tpt.element('ntno'),i2, 2)
  1052.     end
  1053. end
  1054. tpt.register_step(test)
  1055.  
  1056. function Gravi(i, x, y, surround, nt)
  1057.       if tpt.get_property("tmp2", i) == 0 then
  1058.       local a = (math.random(360)-1) * 0.01745329;
  1059.       local avx = 2*math.cos(a)
  1060.       local avy = 2*math.sin(a)
  1061.       tpt.set_property("tmp2",1,i)
  1062.    end
  1063. tpt.set_property("vx",avx,i)
  1064. tpt.set_property("vy",avy,i)
  1065. end
  1066. tpt.element_func(Gravi, tpt.element('grvt'))
Advertisement
Add Comment
Please, Sign In to add comment