New elements made via Lua

  • jacksonmj
    26th Dec 2011 Developer 0 Permalink
    There are currently 6 empty element slots (mostly from all life types being merged into one element) that can be used for temporary elements.

    The names are: bran, lote, wind, frg2, frog, star

    An example of how to enable one, making it do something interesting is left as an exercise for the reader.
    tpt.el.bran.name="BOOM" -- change name, must be at most four letters long, doesn't currently update name in tpt.el.XXXX
    tpt.el.bran.enabled=1 -- allow it to be used
    tpt.el.bran.menu=1 -- enable display in menu
    tpt.el.bran.menusection=1 -- put it in a menu
    tpt.el.bran.description="A test element"


    (Yes, an API function to do this might be nice, use something similar to the above code for now)

    There are some things which don't yet update to reflect changes to tpt.el, they are: graphics cache (so graphics might not change when tpt.el.colour or tpt.el.properties are changed), menu item count (scrolling menus might not work), and can_move (changes to tpt.el.properties and tpt.el.weight don't affect which elements displace which other elements). I'm currently working on fixing these.



    Duplicating existing elements wouldn't work well, because some reactions are hardcoded to occur with a specific element ID. For example, RBDM: the reaction is triggered in the water update function when there is a particle with RBDM's element ID nearby. So duplicating RBDM would not correctly duplicate all it's reactions.

    It doesn't need to be done in autorun.lua, since autorun.lua is run after everything is initialised anyway.


    If PT_NUM is kept a bit higher then the last element ID, then there will continue to be empty element slots that can be used for Lua elements. I think the element limit is actually lower than 255 at the moment - wall numbers will need moving up again at some point.
  • Simon
    26th Dec 2011 Administrator 0 Permalink
    Testing
  • hiroki75
    26th Dec 2011 Member 0 Permalink
    @Videogamer555 (View Post) it works but it doesnt change the name actually it does
  • ZER02541714
    26th Dec 2011 Member 0 Permalink
    @Simon (View Post)
    Yeah Go SIMON!!!
  • ozone
    26th Dec 2011 Member 0 Permalink

    ZER02541714:

    I keep getting an error
    @ZER02541714 (View Post) That's because this is a suggestion, it doesn't actually exist :P
  • ZER02541714
    26th Dec 2011 Member 0 Permalink
    @ozone (View Post)
    yeah thanks for telling me but i already found that out last year