Obvious Lua bug!

  • Videogamer555
    31st Dec 2011 Member 0 Permalink
    When I do tpt.el.dmnd.properties=32
    to set the electrical conductive property for diamond for DMND, it makes it conduct 1 spark. After that spark passes, it doesn't conduct any more! What's wrong with it?!
  • jacksonmj
    31st Dec 2011 Developer 0 Permalink
    Use PROP_LIFE_DEC as well as PROP_CONDUCTS (16384 + 32 = 16416).

    Conductive materials only conduct when their life reaches zero (this stops SPRK from travelling backwards).
  • Videogamer555
    31st Dec 2011 Member 0 Permalink
    Thanks, that gave me an idea. I can change the density of SPRK by simply making it so as soon as SPRK has passed it resets to 0. Normally SPRK sets life to 4 and then it's decremented using the normal decrement by 1 per frame (the PROP_LIFE_DEC property you mentioned). But that will take 4 frames to reset to 0. By using this line in an element update function. The life of the conductor immediately resets to 0 when the SPRK has passed.
    tpt.parts[i].life=0

    This allows more sparks per second to pass, effectively increasing the current through the conductor. I wonder if this might be useful for something. Maybe to make a "superconductor" since I don't think any other conductor in TPT behaves like this.
  • ads999
    31st Dec 2011 Member 0 Permalink
    @Videogamer555 (View Post)
    INST does, ish... Evewn then what you suggested (as @jacksonmj (View Post) said) will make spark go backwards. I think a life of 2 rather than 0 would probably be sufficient.