Guest User

TPT Cockroaches element

a guest
Jul 15th, 2013
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. --[[
  2.  
  3. Cockroach element v 1.0
  4.  
  5. Blocks pressure and temperature and it's a particle.
  6. It's also a powder and a solid at the same time!
  7. (cool it down to 0.00 C or below to make it a solid)
  8.  
  9. okay until this doesn't work let's do it differently
  10. I can't get pressure blocking without TTAN's update function, so let's
  11. just use TTAN itself?
  12.  
  13. local el = elements.allocate("packedbread", "COCK")
  14. elements.element(el, elements.element(elements.DEFAULT_PT_TTAN))
  15. elements.property(el, "Weight", "45")
  16. elements.property(el, "State", elements.ST_SOLID)
  17. elements.property(el, "HeatConduct", "0")
  18. elements.property(el, "Meltable", "0")
  19. elements.property(el, "Hardness", "0")
  20. elements.property(el, "Gravity", "1")
  21. elements.property(el, "Falldown", "1")
  22. elements.property(el, "Diffusion", "1")
  23. elements.property(el, "Properties", bit.bor(elements.TYPE_PART, elements.PROP_BLACK, elements.PROP_NOAMBHEAT, elements.PROP_NEUTABSORB))
  24. elements.property(el, "Name", "COCK")
  25. elements.property(el, "Description", "Cockroaches. Invulnerable. Don't conduct heat or pressure.")
  26. elements.property(el, "Colour", 0xDEADBEEF)
  27. elements.property(el, "MenuVisible", 1)
  28. elements.property(el, "MenuSection", elements.SC_SPECIAL)
  29. --]]--
  30.  
  31. tpt.el.ttan.colour = 0xDEADBEEF
  32. tpt.el.ttan.name = "COCK"
  33. tpt.el.ttan.description = "Cockroaches. Survive anything. Block everything."
  34. tpt.el.ttan.meltable = 0
  35. tpt.el.ttan.hconduct = 0
  36. tpt.el.ttan.weight = 45
  37. tpt.el.ttan.gravity = 1
  38. tpt.el.ttan.falldown = 1
  39. tpt.el.ttan.diffusion = 1
  40. tpt.el.ttan.properties = bit.bor(elements.TYPE_PART, elements.PROP_BLACK, elements.PROP_NOAMBHEAT, elements.PROP_NEUTABSORB)
  41. tpt.el.ttan.msection = elements.SC_SPECIAL
  42.  
  43. function el_Update(index, partx, party, surround_space, nt)
  44. -- Stand still stolen from EXOT
  45. if sim.partProperty(index, "temp") < 273.15 then
  46. sim.partProperty(index, "vx", 0)
  47. sim.partProperty(index, "vy", 0)
  48. end
  49.  
  50. --[[--
  51. -- Pressure blocking stolen from TTAN
  52. local ttan = 0
  53. if nt <= 2 then
  54. ttan = 2
  55. else if sim.partProperty(index, "tmp") then
  56. ttan = 2
  57. else if nt <= 6 then
  58. for ry=-1,1,1 do
  59. for rx=-1,1,1 do
  60. if sim.partProperty(sim.partID(x, y), "type") == "TTAN" then
  61. ttan = ttan + 1
  62. end
  63. end
  64. end
  65. end
  66. if ttan >= 2 then
  67. --!! waits for pv blocking code
  68.  
  69.  
  70. end
  71. --]]--
  72. return 0
  73. end
  74. tpt.element_func(el_Update, tpt.element("ttan"))--, el)
Advertisement
Add Comment
Please, Sign In to add comment