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=0x4124function 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)
Wow! This is really good! Me likes! Me likes!
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.
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!
Didn't notice the necro. How the hell to people even find these threads?