lua spark question

  • AerospaceFan
    1st September Member 0 Permalink

    how to know if a neighbouring element is sparkable? like you have a element that does stuff and once its done doing the stuff it sparks all neighbouring sparkable elements (im very bad at explaining)

  • LBPHacker
    1st September Developer 0 Permalink
    A particle has an element type, and a sparkable ("conductive") element's (very creatively named) Properties property (a number, a bunch of bits) will have the elem.PROP_CONDUCTS bit set. You can spark a conductive particle by changing its ctype to whatever element you want it to turn back into when it's done being sparked (most likely itself), changing its life to how long it should stay sparked (usually 4), and finally changing its type over to elem.DEFAULT_PT_SPRK with sim.partChangeType.
    Edited once by LBPHacker. Last: 1st September
  • Aklego-777
    1st September Member 0 Permalink

    I think the SPRK checks in a 1 or 2 px radius (1 or 2 pixel in all directions) for a conductive element.

    Edited once by Aklego-777. Last: 1st September
  • AerospaceFan
    1st September Member 0 Permalink

    i know but like in the code, i have this lead telluride element that sparks other stuff and i want it to search for conductive elements to spark only (to avoid stuff like sparked wood lol)

  • Bishifted
    1st September Member 0 Permalink
    @AerospaceFan (View Post)
    Write an if statement checking if the elem.PROP_CONDUCTS bit is set, if it isn't then do NOT generate a spark; if it is set then it DOES generate a spark.
  • AerospaceFan
    1st September Member 0 Permalink

    @Bishifted (View Post)

     does that even work? anyways this is now solved beacuse im stupid and i didnt think of turning the element to spark itself