Advertisement
MassacreLand

Element: MTOR(VideoGamer's)

Jan 29th, 2012
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.78 KB | None | 0 0
  1. tpt.el.elec.properties=0
  2. tpt.el.elec.heat=9999
  3. tpt.el.elec.airdrag=30
  4. tpt.el.elec.menusection=3
  5. tpt.el.elec.name="MTOR"
  6. tpt.el.elec.description="Meteor. Heats nearby objects (the closer the stronger the heating), makes a shockwave, and explodes on impact. Use sparingly."
  7.  
  8.  
  9. math.randomseed(os.time())
  10. function mtor_update(i, x, y, s, n)
  11. if tpt.get_property("tmp",i)==0 then
  12. tpt.parts[i].tmp=1
  13. randvel=math.random(-20,20)/10
  14. tpt.parts[i].vx=randvel
  15. tpt.parts[i].vy=math.sqrt(8-(randvel^2))
  16. end
  17.  
  18. xvel=tpt.get_property("vx",i)/2
  19. yvel=tpt.get_property("vy",i)/2
  20. if yvel <= 0 or math.abs(xvel) > 1 then
  21. tpt.delete(i)
  22.  
  23.  
  24. end
  25.  
  26. xpos=x-xvel
  27. ypos=y-yvel
  28. elemtype=tpt.get_property("type",xpos,ypos)
  29.  
  30. if elemtype == 0 then
  31. tpt.create(xpos,ypos,"bray")
  32. tpt.set_property("temp",5000,xpos,ypos)
  33. end
  34. tpt.parts[i].temp=9999
  35.  
  36. elemtype25=tpt.get_property("type",x+xvel*5,y+yvel*5)
  37. elemtype24=tpt.get_property("type",x+xvel*4,y+yvel*4)
  38. elemtype23=tpt.get_property("type",x+xvel*3,y+yvel*3)
  39. elemtype22=tpt.get_property("type",x+xvel*2,y+yvel*2)
  40. elemtype21=tpt.get_property("type",x+xvel,y+yvel)
  41. if elemtype25 ~= 0 and elemtype25 ~= tpt.el.elec.id and elemtype25 ~= tpt.el.bray.id and elemtype25 ~= tpt.el.dmnd.id and elemtype25 ~= tpt.el.void.id then
  42. tpt.set_property("type","bomb",i)
  43. tpt.set_property("life",0,i)
  44. tpt.set_property("tmp",0,i)
  45.  
  46.  
  47. elseif elemtype24 ~= 0 and elemtype24 ~= tpt.el.elec.id and elemtype24 ~= tpt.el.bray.id and elemtype24 ~= tpt.el.dmnd.id and elemtype24 ~= tpt.el.void.id then
  48. tpt.set_property("type","bomb",i)
  49. tpt.set_property("life",0,i)
  50. tpt.set_property("tmp",0,i)
  51. elseif elemtype23 ~= 0 and elemtype23 ~= tpt.el.elec.id and elemtype23 ~= tpt.el.bray.id and elemtype23 ~= tpt.el.dmnd.id and elemtype23 ~= tpt.el.void.id then
  52. tpt.set_property("type","bomb",i)
  53. tpt.set_property("life",0,i)
  54. tpt.set_property("tmp",0,i)
  55. elseif elemtype22 ~= 0 and elemtype22 ~= tpt.el.elec.id and elemtype22 ~= tpt.el.bray.id and elemtype22 ~= tpt.el.dmnd.id and elemtype22 ~= tpt.el.void.id then
  56. tpt.set_property("type","bomb",i)
  57. tpt.set_property("life",0,i)
  58. tpt.set_property("tmp",0,i)
  59. elseif elemtype21 ~= 0 and elemtype21 ~= tpt.el.elec.id and elemtype21 ~= tpt.el.bray.id and elemtype21 ~= tpt.el.dmnd.id and elemtype21 ~= tpt.el.void.id then
  60. tpt.set_property("type","bomb",i)
  61. tpt.set_property("life",0,i)
  62. tpt.set_property("tmp",0,i)
  63. end
  64.  
  65.  
  66.  
  67. for scany = -40,40 do
  68. maxscanx=math.sqrt(1600-(scany^2))
  69. for scanx = -maxscanx,maxscanx do
  70. elemtype3 = tpt.get_property("type",x+scanx,y+scany)
  71. if elemtype3 ~= 0 and elemtype3 ~= tpt.el.elec.id and elemtype3 ~= tpt.el.bray.id and elemtype3 ~= tpt.el.insl.id then
  72. tpt.set_property("temp",tpt.get_property("temp",x+scanx,y+scany)+(19200/((scanx^2)+(scany^2))),x+scanx,y+scany)
  73. end
  74. end
  75. end
  76. end
  77. tpt.element_func(mtor_update, tpt.el.elec.id,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement