New:Sodium and Ammonia

  • peeps
    3rd Mar 2012 Member 1 Permalink
    take the code here:
    --------------------------------
    tpt.el.wax.name="SODM"
    tpt.el.wax.color=0xCBCBCB
    tpt.el.wax.description="Sodium"
    tpt.el.mwax.name="LSDM"
    tpt.el.mwax.color=0xA9A9A9
    tpt.el.mwax.description="Liquid Sodium"
    math.randomseed(os.time())
    function sodium(i,x,y,s,n)
    if tpt.parts[i].life==0 then
    tpt.parts[i].life=8
    end
    ox=math.random(x-1,x+1)
    oy=math.random(y-1,y+1)
    if tpt.get_property("type",ox,oy)==tpt.el.watr.id or tpt.get_property("type",ox,oy)==tpt.el.dstw.id or tpt.get_property("type",ox,oy)==tpt.el.sltw.id then
    tpt.set_property("type",tpt.el.hygn.id,ox,oy)
    tpt.set_property("temp",tpt.get_property("temp",ox,oy)+100,ox,oy)
    tpt.create(math.random(x-1,x+1),math.random(y-1,y+1),tpt.el.caus.id)
    tpt.parts[i].life=tpt.parts[i].life-1
    end
    if tpt.get_property("type",ox,oy)==tpt.el.wtrv.id then
    tpt.delete(i)
    tpt.create(x,y,tpt.el.fire.id)
    end
    if tpt.parts[i].life==1 then
    tpt.delete(i)
    end
    end
    tpt.element_func(sodium, tpt.el.wax.id,1)
    tpt.element_func(sodium, tpt.el.mwax.id,1)
    function amon(i,x,y,s,n)
    for ex=x-1,x+1,1 do
    for ey=y-1,y+1,1 do
    if tpt.get_property("type",ex,ey)==tpt.el.acid.id then
    tpt.delete(ex,ey)
    tpt.parts[i].life=tpt.parts[i].life-1
    if tpt.parts[i].life==51 then
    tpt.delete(i)
    end
    end
    end
    end
    end
    tpt.element_func(amon, tpt.el.caus.id,1)

    -----------------------------------
    that's all,it can react with water,and it's perfect for timebombs.
  • Lynxrufus
    3rd Mar 2012 Banned 0 Permalink
    This post is hidden because the user is banned
  • mniip
    3rd Mar 2012 Developer 0 Permalink
    @peeps (View Post)
    use code box