Self Sealing Fuel Cell

  • plypencil
    11th May 2012 Member 1 Permalink
    Fuel can now be contained! When it escapes from its containment a viscous material will be able to seal small gaps in the container allowing for the structural integrity to remain for a little while longer.

    The script works by turning desl into gel when it touches bmtl. The simulation below shows you how you can use this to create a fuel cell with a self sealing technology.



    Here is the script.

    desl_breach = 0
    tpt.el.desl.description="Modified desl"
    math.randomseed(os.time())
    tpt.setfpscap(50)

    function desl_clog(i,x,y,surround_space,nt)
    local found_bmtl = false
    if tpt.get_property("type",x+1,y)==tpt.el.bmtl.id then
    found_bmtl = true
    end
    if tpt.get_property("type",x-1,y)==tpt.el.bmtl.id then
    found_bmtl = true
    end
    if tpt.get_property("type",x,y+1)==tpt.el.bmtl.id then
    found_bmtl = true
    end
    if tpt.get_property("type",x,y-1)==tpt.el.bmtl.id then
    found_bmtl = true
    end
    if found_bmtl then
    tpt.set_property("type","GEL",x,y)
    desl_breach = 100
    end
    end

    function text_display()
    if desl_breach>=1 then
    desl_breach = desl_breach - 1
    tpt.drawtext(32,32,"Containment Breach")
    end
    end

    tpt.element_func(desl_clog,tpt.el.desl.id,1)
    tpt.register_step(text_display)


    Instructions on how to run: https://powdertoy.co.uk/Wiki/W/How_to_run_a_script.html

    Special thanks to jacob1 for his help with the code!
    Thanks to mniip too
  • mniip
    11th May 2012 Developer 0 Permalink
    Save the code into a file in the application
    directory then in the console type dofile
    ("filename.lua")


    https://powdertoy.co.uk/Wiki/W/How_to_run_a_script.html