Advertisement
DanielGalrito

Gluons

Oct 9th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. local Gluon = elements.allocate("Gluon", "GLUON")
  2. elements.element(Gluon, elements.element(elements.DEFAULT_PT_ELEC))
  3. elements.property(Gluon, "Name", "GLUON")
  4. elements.property(Gluon, "Colour", 0xFF00AEFF)
  5. elements.property(Gluon, "Description", "Gluon.")
  6. elements.property(Gluon, "Weight", -1)
  7. elements.property(Gluon, "HeatConduct", 251)
  8. elements.property(Gluon, "Temperature", 295.15)
  9. elements.property(Gluon, "Properties" , 0x0010)
  10. elements.property(Gluon, "AirLoss", 1)
  11. elements.property(Gluon, "Loss", 1)
  12. elements.property(Gluon, "Collision", -0.99)
  13.  
  14. function Gluon(i, x, y, surround, nt)
  15. if tpt.get_property("tmp2", i) == 0 then
  16. local a = (math.random(360)-1) * 0.01745329;
  17. tpt.set_property("life",680,i)
  18. tpt.set_property("vx",2*math.cos(a),i)
  19. tpt.set_property("vy",2*math.sin(a),i)
  20. tpt.set_property("tmp2",1,i)
  21. end
  22.  
  23. local collx = math.random(-1,1)
  24. local colly = math.random(-1,1)
  25.  
  26. if tpt.get_property("temp", i) > 273.15 then
  27. tpt.set_property("temp",tpt.get_property("temp", i)-1,i)
  28. tpt.set_property("tmp",tpt.get_property("tmp", i)+1,i)
  29. end
  30.  
  31.  
  32. if sim.pressure(x/4,y/4) > 0 then
  33. sim.pressure(x/4,y/4,sim.pressure(x/4,y/4)-1)
  34. tpt.set_property("tmp",tpt.get_property("tmp", i)+5,i)
  35. end
  36.  
  37. if tpt.get_property("life", i) > 0 then
  38. if tpt.get_property("life", i) >= 50 then
  39. tpt.set_property("life",tpt.get_property("life", i)-1,i)
  40. end
  41. if tpt.get_property("life", i) < 50 then
  42. if tpt.get_property("tmp", i) > 0 then
  43. tpt.set_property("tmp",tpt.get_property("tmp", i)-1,i)
  44. end
  45. if tpt.get_property("tmp", i) < 1 then
  46. tpt.set_property("life",tpt.get_property("life", i)-1,i)
  47. end
  48. end
  49. end
  50.  
  51. if tpt.get_property("life", i) == 0 then
  52. if tpt.get_property("tmp2", i) == 1 then
  53. tpt.set_property("type","none",i)
  54. end
  55. end
  56.  
  57. if tpt.get_property("type", x+collx, y+colly) == tpt.element('neut') or tpt.get_property("type", x+collx, y+colly) == tpt.element('phot') or tpt.get_property("type", x+collx, y+colly) == tpt.element('elec') or tpt.get_property("type", x+collx, y+colly) == tpt.element('prot') or tpt.get_property("type", x+collx, y+colly) == tpt.element('grvt') then
  58. if tpt.get_property("tmp", i) > 0 then
  59. tpt.set_property("life",tpt.get_property("life", x+collx, y+colly)+100,x+collx,y+colly)
  60. tpt.set_property("tmp",tpt.get_property("tmp", i)-1,i)
  61. end
  62. end
  63. end
  64. tpt.element_func(Gluon, tpt.element('gluon'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement