Custom Lua Element Reactions

  • TheAwesomeMutant
    4th Dec 2016 Member 0 Permalink

    I have a script for chlorine, it distills water. It works fine, except one it forms a layer of distilled water it stops distilling water. Anyone know a script to make distilled water turn water into distilled water? Here is my code:

    elements.allocate('MOD', 'CHLR') elements.element(elements.MOD_PT_CHLR, elements.element(elements.DEFAULT_PT_BCOL)) elements.property(elements.MOD_PT_CHLR, 'Name', 'CHLR') elements.property(elements.MOD_PT_CHLR, 'Description', 'Chlorine. Distills water.') elements.property(elements.MOD_PT_CHLR, 'Color', '0x00FFFF') elements.property(elements.MOD_PT_CHLR, 'MenuSection', '7') elements.property(elements.MOD_PT_CHLR, 'Gravity', '1') elements.property(elements.MOD_PT_CHLR, 'Flammable', '0') elements.property(elements.MOD_PT_CHLR, 'Explosive', '0') elements.property(elements.MOD_PT_CHLR, 'Loss', '0') elements.property(elements.MOD_PT_CHLR, 'AirLoss', '1') elements.property(elements.MOD_PT_CHLR, 'AirDrag', '0') elements.property(elements.MOD_PT_CHLR, 'Advection', '1') elements.property(elements.MOD_PT_CHLR, 'Weight', '0') elements.property(elements.MOD_PT_CHLR, 'Diffusion', '1') elements.property(elements.MOD_PT_CHLR, 'Falldown', '2') function element(i,x,y,s,n) type = tpt.get_property("type", x + math.random(-1,1), y + math.random(-1,1)) if type == elements.MOD_PT_CHLR then tpt.parts[i].type = tpt.el.dstw.id end end tpt.element_func(element,tpt.el.watr.id) function element(i,x,y,s,n) type = tpt.get_property("type", x + math.random(-1,1), y + math.random(-1,1)) if type == tpt.el.watr.id then tpt.parts[i].type = tpt.el.dstw.id end end tpt.element_func(element,elements.MOD_PT_CHLR) tpt.element_func(g, tpt.element('CHLR')) local g = function(i, r, g, b) local cola, colr, colg, colb, firea, firer, fireg, fireb cola = 255 -- Alpha colr = 0 -- Red colg = 255 -- Green colb = 255 -- Blue firea = 0 -- Alpha Glow

    P.S. Can you put multiple elements in one script?

    Edited 10 times by TheAwesomeMutant. Last: 4th Dec 2016
  • ssccsscc
    4th Dec 2016 Member 0 Permalink

    elements.property(elements.MOD_PT_CHLR, 'Weight', '50')

  • TPT_PL
    4th Dec 2016 Member 1 Permalink
  • TheAwesomeMutant
    4th Dec 2016 Member 0 Permalink

    Thank you. How would I find numeracal id for a custom element?

    Edited once by TheAwesomeMutant. Last: 4th Dec 2016
  • TPT_PL
    4th Dec 2016 Member 1 Permalink

    @TheAwesomeMutant (View Post)

     Numeral? You did:

    elem.allocate("MOD", "CHLR")

    So the id is elem.MOD_PT_CHLR.

  • LBPHacker
    4th Dec 2016 Developer 0 Permalink

    Or just whatever elem.allocate returns.

  • TPT_PL
    5th Dec 2016 Member 1 Permalink