Advertisement
-Amy-

PhysicsMod Version 1 Update 0

May 4th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.30 KB | None | 0 0
  1.  
  2.  
  3. --Physics Mod
  4. --Please use cracker64's script manager
  5. --VER 0.0 UPDATE http://pastebin.com/raw.php?i=2ZZEtzu5
  6.  
  7. --Version 0
  8.  
  9. function DrawHUD()
  10.  
  11. function mouseclicky(mousex, mousey, button, event)
  12. if (event == 1) then
  13. var5 = 1
  14. end
  15. if (event == 2) then
  16. var5 = 2
  17. end
  18. end
  19.  
  20. function keyclicky(key, nkey, modifier, event)
  21. if (key == "." and event == 1) then
  22. var6 = 1
  23. else
  24. var6 = 2
  25. end
  26. if (key == "," and event == 1) then
  27. var7 = 1
  28. else
  29. var7 = 2
  30. end
  31. if (key == "z" and event == 1) then
  32. var8 = 1
  33. else
  34. var8 = 2
  35. end
  36. if (key == "=" and event == 1) then
  37. var10 = 1
  38. end
  39. if (key == "-" and event == 1) then
  40. var10 = 2
  41. end
  42. if (key == "m" and event == 1) then
  43. var13 = 1
  44. end
  45. end
  46.  
  47. -- if var13 == 1 and tpt.get_name() == "Amy" then
  48. -- print("Valid.")
  49. -- var14 = 1
  50. -- end
  51.  
  52. if var14 == 1 then
  53. tardis = 1
  54. else
  55. tardis = 0
  56. end
  57.  
  58.  
  59.  
  60.  
  61. tpt.register_keypress(keyclicky)
  62. tpt.register_mouseclick(mouseclicky)
  63.  
  64. if var7 == 1 then
  65. var9 = 1
  66. end
  67. if var6 == 1 then
  68. var9 = 2
  69. end
  70.  
  71. if var9 == 1 then
  72. rect = graphics.drawText
  73. draw = graphics.fillRect
  74. var10 = 2
  75. var8 = 1
  76. else
  77. rect = graphics.fillRect
  78. draw = graphics.drawText
  79. end
  80.  
  81. if var10 == 1 then
  82. draw1 = graphics.drawText
  83. rect1 = graphics.fillRect
  84. else
  85. draw1 = graphics.fillRect
  86. rect1 = graphics.drawText
  87. end
  88.  
  89. if var8 ~= 1 then
  90. draw2 = graphics.drawText
  91. else
  92. draw2 = graphics.fillRect
  93. end
  94.  
  95.  
  96. if tpt.mousex >= 611 then
  97. x2 = 611
  98. else
  99. x2 = tpt.mousex
  100. end
  101.  
  102. if tpt.mousey >= 383 then
  103. y2 = 383
  104. else
  105. y2 = tpt.mousey
  106. end
  107.  
  108. local x, y = sim.adjustCoords(x2, y2)
  109.  
  110. if tpt.get_property("type", x, y) >= 1 then
  111. ptype = tpt.element(tpt.get_property("type", x, y))
  112. else
  113. ptype = "Empty,"
  114. end
  115.  
  116. if tpt.get_property("type", x, y) >= 1 then
  117. var1 = tpt.get_property("temp", x, y)-273.15
  118. else
  119. var1 = 293.15
  120. end
  121.  
  122. local var2 = var1*100
  123. local var3 = math.floor(var2)/100
  124.  
  125. if tpt.get_property("type", x, y) >= 1 then
  126. temp = var3
  127. else
  128. temp = "()"
  129. end
  130.  
  131. if tpt.get_property("type", x, y) >= 1 then
  132. var12312389 = tpt.get_property("ctype", x, y)
  133. end
  134.  
  135. if tpt.get_property("type", x, y) >= 1 and var12312389 >= 0 and var12312389 < sim.PT_NUM then
  136. ctype = tpt.element(tpt.get_property("ctype", x, y))
  137. end
  138.  
  139. if tpt.get_property("type", x, y) == 0 or tpt.get_property("ctype", x, y) < 1 then
  140. ctype = "()"
  141. end
  142.  
  143. if x >= 609 then
  144. x1 = 609/4
  145. else
  146. x1 = x/4
  147. end
  148.  
  149. if y >= 381 then
  150. y1 = 381/4
  151. else
  152. y1 = y/4
  153. end
  154.  
  155. local var4 = sim.pressure(x1, y1)*100
  156. local pressure = math.floor(var4)/100
  157.  
  158. local parts = tpt.get_numOfParts()
  159. if tpt.get_property("type", x, y) >= 1 then
  160. tmp = tpt.get_property("tmp", x, y)
  161. else
  162. tmp = "0"
  163. end
  164.  
  165. if tpt.get_property("type", x, y) >= 1 then
  166. life = tpt.get_property("life", x, y)
  167. else
  168. life = "0"
  169. end
  170.  
  171. if tpt.get_property("type", x, y) >= 1 then
  172. tmp = tpt.get_property("tmp2", x, y)
  173. else
  174. tmp2 = "0"
  175. end
  176.  
  177. if tpt.get_property("type", x, y) >= 1 then
  178. var11 = tpt.get_property("vy", x, y)*1000
  179. else
  180. var11 = 0
  181. end
  182. local vy = math.floor(var11)/1000
  183.  
  184. if tpt.get_property("type", x, y) >= 1 then
  185. var12 = tpt.get_property("vx", x, y)*1000
  186. else
  187. var12 = 0
  188. end
  189. local vx = math.floor(var12)/1000
  190.  
  191. rect(398, 13, 187, 12, 55, 55, 55, 200)
  192. rect(398, 27, 200, 12, 55, 55, 55, 200)
  193. rect(14, 13, 210, 12, 55, 55, 55, 200)
  194. rect1(398, 41, 185, 12, 55, 55, 55, 200)
  195.  
  196. --{MAY BE USEFUL LATER???}graphics.drawText(6, 6, os.date("%a %b %d, %l:%M:%S %p"), 0, 255, 165, 200)
  197. draw(16, 15, os.date(), 0, 255, 165, 200)
  198. draw(550, 30, x, 0, 255, 165, 200)
  199. draw(578, 30, y, 0, 255, 165, 200)
  200. draw(541, 30, "X:", 0, 255, 165, 200)
  201. draw(570, 30, "Y:", 0, 255, 165, 200)
  202. draw(435, 15, ctype, 0, 255, 165, 200)
  203. draw(400, 15, ptype, 0, 255, 165, 200)
  204. draw(558, 15, pressure, 0, 255, 165, 200)
  205. draw(465, 15, "Temp:", 0, 255, 165, 200)
  206. draw(465, 30, "Tmp:", 0, 255, 165, 200)
  207. draw(400, 30, "Life:", 0, 255, 165, 200)
  208. draw(535, 15, "Pres:", 0, 255, 165, 200)
  209. draw(160, 15, "Parts:", 0, 255, 165, 200)
  210. draw(490, 15, temp, 0, 255, 165, 200)
  211. draw(485, 30, tmp, 0, 255, 165, 200)
  212. draw(422, 30, life, 0, 255, 165, 200)
  213. draw(187, 15, parts, 0, 255, 165, 200)
  214. draw1(400, 44, "Tmp2:", 0, 255, 165, 200)
  215. draw1(425, 44, tmp2, 0, 255, 165, 200)
  216. draw1(465, 44, "VX:", 0, 255, 165, 200)
  217. draw1(535, 44, "VY:", 0, 255, 165, 200)
  218. draw1(480, 44, vx, 0, 255, 165, 200)
  219. draw1(550, 44, vy, 0, 255, 165, 200)
  220. draw2(250, 6, "</> Turn HUD On/Off", 0, 255, 165, 150)
  221. draw2(250, 16, "-/+ Extra On/Off", 0, 255, 165, 150)
  222.  
  223. end
  224.  
  225. tpt.hud(0)
  226.  
  227. tpt.register_step(DrawHUD)
  228.  
  229. tpt.setfpscap(200)
  230.  
  231. --Draws starting texts
  232.  
  233. print("Physics Mod")
  234. print("Version 0")
  235. print("Update 0")
  236. print("Created by Amy. 100% new programming.")
  237. print("Contact via amywilsonmaster@gmail.com or http://powdertoy.co.uk")
  238.  
  239. --TUNG Mod :D
  240.  
  241. function moo(i, x, y, surround_space, nt)
  242. if sim.pressure(x/4, y/4)<-7 and sim.partProperty(i, sim.FIELD_LIFE)~=0 and surround_space~=0 then
  243. sim.partCreate(-1, x+math.random(-3,3), y+math.random(-3,3), elem.DEFAULT_PT_ELEC) end
  244. end
  245. tpt.element_func(moo, tpt.el.tung.id, 0)
  246.  
  247. tpt.el.tung.description="Tungsten. Brittle metal with a very high melting point. When sparked under a pressure of -7, emits electrons."
  248.  
  249. --Quarks
  250.  
  251. local QURK = elements.allocate("AMY", "QURK")
  252. elements.element(elements.AMY_PT_QURK, elements.element(elements.DEFAULT_PT_AMTR))
  253. elements.property(elements.AMY_PT_QURK, "Name", "QURK")
  254. elements.property(elements.AMY_PT_QURK, "Description", "Quarks. Make up all particles in existance.")
  255. elements.property(elements.AMY_PT_QURK, "Colour", 0x1E1E1E)
  256. elements.property(elements.AMY_PT_QURK, "MenuSection", elem.SC_NUCLEAR)
  257. elements.property(elements.AMY_PT_QURK, "MenuVisible", 1)
  258. elements.property(elements.AMY_PT_QURK, "Temperature",10000)
  259. elements.property(elements.AMY_PT_QURK, "Weight", 0)
  260. --elements.property(elements.AMY_PT_QURK, ")
  261. --elements.property(elements.AMY_PT_QURK, ")
  262. local function graphics1(i, colr, colg, colb)
  263. return 1,0x00010010,255,25,25,25,255,25,25,25
  264. end
  265. tpt.graphics_func(graphics1,QURK)
  266.  
  267. --Change PROT
  268.  
  269. --tpt.el.prot.name="NEUR"
  270. --tpt.el.prot.description="Neutrinos. Pass through everything."
  271. --tpt.el.prot.colour="0xFF27FE99"
  272.  
  273. --Neutrinos
  274.  
  275. local NEUR = elements.allocate("AMY", "NEUR")
  276. elements.element(elements.AMY_PT_NEUR, elements.element(elements.DEFAULT_PT_NEUT))
  277. elements.property(elements.AMY_PT_NEUR, "Name", "NEUR")
  278. elements.property(elements.AMY_PT_NEUR, "Description", "Neutrinos. Pass through everything.")
  279. elements.property(elements.AMY_PT_NEUR, "Colour", 0x27FE99)
  280. elements.property(elements.AMY_PT_NEUR, "MenuSection", elem.SC_NUCLEAR)
  281. elements.property(elements.AMY_PT_NEUR, "MenuVisible", 1)
  282. elements.property(elements.AMY_PT_NEUR, "Temperature", 0)
  283. elements.property(elements.AMY_PT_NEUR, "Weight", -10)
  284. elements.property(elements.AMY_PT_NEUR, "Diffusion", 1)
  285. --elements.property(elements.AMY_PT_NEUR, "Explosive", 0)
  286.  
  287. math.randomseed(os.time())
  288. function NEUR_update(i, x, y, s, n)
  289. if tpt.get_property("tmp",i)==0 then
  290. tpt.parts[i].tmp=1
  291. randvel=math.random(-20,20)/5
  292. randvel2=math.random(-20,20)/5
  293. tpt.parts[i].vx=randvel
  294. tpt.parts[i].vy=randvel2
  295. end
  296.  
  297. xvel=tpt.parts[i].vx
  298. yvel=tpt.parts[i].vy
  299.  
  300. xpos=x+xvel
  301. ypos=y+yvel
  302.  
  303. --if elemtype == 0 then
  304. -- tpt.create(xpos,ypos,"neut")
  305. -- tpt.set_property("temp",5000,xpos,ypos)
  306. -- end
  307.  
  308. if xpos >= 608 then
  309. tpt.delete(i)
  310. end
  311. if ypos >= 380 then
  312. tpt.delete(i)
  313. end
  314.  
  315. tpt.parts[i].temp=300
  316. end
  317.  
  318. --[[local function Glow(i, colr, colg, colb)
  319. return 1, 0x00000008
  320. end
  321. tpt.graphics_func(Glow, NEUR)]]
  322. local function graphics1(i, colr, colg, colb)
  323. return 1,0x00010000,255,39,254,153,255,39,254,153
  324. end
  325. tpt.graphics_func(graphics1,NEUR)
  326.  
  327. tpt.element_func(NEUR_update, elements.AMY_PT_NEUR,1)
  328. --39 254 153 255
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement