Lua element Naquadah [NQDH]

  • cartman300
    14th Sep 2012 Member 6 Permalink

    Hello. This is my first element i've made in lua. Naqudah. Everything works as expected but

    for some reason my naquadah doesn't conduct electricity, however, it did conduct it before.

     

    tpt.el.bran.name='NQDH'
    tpt.el.bran.description='Naquadah. Does stuff.'
    tpt.el.bran.color=0x4E4C51
    tpt.el.bran.menusection=8
    tpt.el.bran.menu=1
    tpt.el.bran.enabled=1
    tpt.el.bran.falldown=0
    tpt.el.bran.heat=22+273.15
    tpt.el.bran.hardness=0
    tpt.el.bran.weight=1200
    tpt.el.bran.airloss=0
    tpt.el.bran.explosive=0
    tpt.el.bran.flammable=0
    tpt.el.bran.properties=0x4124

    function nthk(i,x,y,s,n)
    local t = tpt.get_property("temp",i)
    if (t>=(400+273.15)) and (t<=(1500+273.15)) then
    tpt.create(x,y,"sprk")
    end
    if t>=(2900+273.15) then
    explode(x,y,false)
    end
    end
    tpt.element_func(nthk,tpt.el.bran.id)

    function explode(x,y,ne)
    tpt.delete(x,y)
    tpt.create(x,y,"plsm")
    tpt.delete(x+1,y)
    tpt.delete(x-1,y)
    tpt.delete(x,y+1)
    tpt.delete(x,y-1)
    tpt.create(x+1,y,"plsm")
    tpt.create(x-1,y,"plsm")
    tpt.create(x,y+1,"plsm")
    tpt.create(x,y-1,"plsm")
    if ne then
    tpt.delete(x+1,y+1)
    tpt.delete(x+1,y-1)
    tpt.delete(x-1,y+1)
    tpt.delete(x-1,y-1)
    tpt.create(x+1,y+1,"elec")
    tpt.create(x+1,y-1,"elec")
    tpt.create(x-1,y+1,"elec")
    tpt.create(x-1,y-1,"elec")
    else
    tpt.delete(x+1,y+1)
    tpt.delete(x+1,y-1)
    tpt.delete(x-1,y+1)
    tpt.delete(x-1,y-1)
    tpt.create(x+1,y+1,"neut")
    tpt.create(x+1,y-1,"neut")
    tpt.create(x-1,y+1,"neut")
    tpt.create(x-1,y-1,"neut")
    end
    tpt.set_property("temp", 9000, x+3,y+3)
    tpt.set_property("temp", 9000, x-3,y-3)
    tpt.set_property("temp", 9000, x+3,y-3)
    tpt.set_property("temp", 9000, x-3,y+3)
    tpt.set_property("temp", 9000, x,y+3)
    tpt.set_property("temp", 9000, x+3,y)
    tpt.set_property("temp", 9000, x-3,y)
    tpt.set_property("temp", 9000, x,y-3)
    tpt.set_pressure(x/4,y/4,4,4,50)
    end
    function expl(i,x,y,s,n)
    if tpt.get_property("ctype",i)==tpt.el.bran.id then
    local tmp = tpt.get_property("temp",i)
    if tmp>=(2100+273.15) then
    explode(x,y,true)
    end
    tpt.set_property("temp", tmp+10, i)
    end
    end
    tpt.element_func(expl,tpt.el.sprk.id)

  • Sergeant_Starfruit
    15th Sep 2012 Member 0 Permalink

    Wow! This is really good! Me likes! Me likes!

  • mniip
    15th Sep 2012 Developer 0 Permalink
    why this debug pairs shit in the ending?
  • cartman300
    15th Sep 2012 Member 0 Permalink

    @mniip (View Post)

     

    I forgot to remove it. >.>

     

    Edit:

     

    Okay, updates! I've fixed the bug where the naquadah absorbed electrons instead of conducting them! Now it works almost perfect from my perspective.

     

    Edit2:

     

    Another small fix.

  • GAPDaTsar
    25th Sep 2012 Member 0 Permalink

    function nthk(i,x,y,s,n)  Why the heck does this same exact part within Lua scripting no matter what Lua script it is get screwy with me?!  It always says it requires a firetrucking "end" after that line of code.  It is really starting to bug me!  I want the script to go on like it is supposed to!  Not giving me all of these extensions that need to be included at the end!

  • cartman300
    27th Sep 2012 Member 0 Permalink

    @GAPDaTsar (View Post)

     What???

    Words you wrote made no sense to me. What do you mean?

  • antoine
    3rd Jan 2014 Banned 0 Permalink
    This post is hidden because the user is banned
  • Nobody905
    3rd Jan 2014 Member 0 Permalink

    No, no, no, no, NO! You DON'T replace elements, you create new ones! We all know BRAN is bloody useless, but still...

  • mniip
    3rd Jan 2014 Developer 0 Permalink
    @Nobody905 (View Post)
    that's how they did it in 2012
  • Nobody905
    3rd Jan 2014 Member 2 Permalink

    @mniip (View Post)

     Didn't notice the necro. How the hell to people even find these threads?