"On_Spawn" Lua funtion

  • DUC
    4th Aug 2018 Member 0 Permalink

    I'm not sure if this should go in the lua thread, but since this is more of a speculation than an actual currently existing thing, I put it here. It would basically update the .elem or .tpt fields, adding a command to set a function for an element (like the "Update" and "Graphics" functions.) An example would be "tpt.spawn_func(function newfunction)" or "elem.property(ELEM, "Spawn", newfunction)." The function would be called just once, every time a particle of that element is created. This way, things like random values of tmp, starting life, starting velocity, etc could be set when the user simply draw that particle on the screen for the first time. It would aslo be able to replace the inefficient "Temperature" element property.

  • jacob1
    5th Aug 2018 Developer 0 Permalink
    Yeah, I do want this. It will likely happen in the future, but first TPT itself needs particle creation events, instead of that long switch statement in part_create.