Help with script element temp loss

  • catchphrase911
    10th Aug 2022 Member 0 Permalink

    i want to make it so this element cannot lose temperature, but can heat things up. (so it transfers heat but doesnt take on cool)

  • RebMiami
    10th Aug 2022 Member 0 Permalink

    Maybe try putting something like this in the update function:

    sim.partProperty(i, "temp", math.max(sim.partProperty(i, "temp"), sim.partProperty(i, "tmp")))
    sim.partProperty(i, "tmp", math.floor(sim.partProperty(i, "temp")))

    (I haven't tested this, so I don't know if it'll actually work, but this should allow the material to heat up but not cool down.)

  • catchphrase911
    11th Aug 2022 Member 0 Permalink

    hmm. when the element falls onto ttan, the ttan heats up and the element cools, is it possible to make it so that the element can heat the ttan, but stay at max temp on its own? the code is 

    elements.allocate('AU3FGEN', 'EXPL')
    elements.element(elements.AU3FGEN_PT_EXPL, elements.element(elements.DEFAULT_PT_BCOL))
    elements.property(elements.AU3FGEN_PT_EXPL, 'Name', 'EXPL')
    elements.property(elements.AU3FGEN_PT_EXPL, 'Description', 'explosive')
    elements.property(elements.AU3FGEN_PT_EXPL, 'Color', '0xF76D00')
    elements.property(elements.AU3FGEN_PT_EXPL, 'MenuSection', '5')
    elements.property(elements.AU3FGEN_PT_EXPL, 'Gravity', '7')
    elements.property(elements.AU3FGEN_PT_EXPL, 'Flammable', '0')
    elements.property(elements.AU3FGEN_PT_EXPL, 'Explosive', '0')
    elements.property(elements.AU3FGEN_PT_EXPL, 'Temperature', '9000')
    elements.property(elements.AU3FGEN_PT_EXPL, 'LowTemperature', '9999')
    elements.property(elements.AU3FGEN_PT_EXPL, 'HotAir', '10')
    elements.property(elements.AU3FGEN_PT_EXPL, 'Loss', '0')
    elements.property(elements.AU3FGEN_PT_EXPL, 'AirLoss', '0')
    elements.property(elements.AU3FGEN_PT_EXPL, 'AirDrag', '0.1')
    elements.property(elements.AU3FGEN_PT_EXPL, 'Advection', '1')
    elements.property(elements.AU3FGEN_PT_EXPL, 'Weight', '100')elements.property(elements.AU3FGEN_PT_EXPL, 'HeatConduct', '50')
    elements.property(elements.AU3FGEN_PT_EXPL, 'Diffusion', '1')
    elements.property(elements.AU3FGEN_PT_EXPL, 'Falldown', '0')
    elements.property(elements.AU3FGEN_PT_EXPL, 'LowPressure', -20)
    elements.property(elements.AU3FGEN_PT_EXPL, 'LowPressureTransition', tpt.element("fsep"))

    EXPLUpdate = function(i, x, y, s, n)
    sim.partProperty(i, "temp", math.max(sim.partProperty(i, "temp"), sim.partProperty(i, "tmp")))
    sim.partProperty(i, "tmp", math.floor(sim.partProperty(i, "temp")))
    end

    local g = function(i, r, g, b)
    local cola, colr, colg, colb, firea, firer, fireg, fireb
    cola = 255 -- Alpha
    colr = 255 -- Red
    colg = 102 -- Green
    colb = 0 -- Blue
    firea = 255 -- Alpha Glow
    firer = 255 -- Red Glow
    fireg = 102 -- Green Glow
    fireb = 0 -- Blue Glow
    --See Pixel Mode Values Table for more info
    return 0, 0xF76D00, cola, colr, colg, colb, firea, firer, fireg, fireb
    end
    tpt.graphics_func(g, tpt.element('EXPL'))

     

     

    it is messy and i didnt make half of it, it is an edited script i figured out, as i cant code very well at all ._.

     
    Edited once by catchphrase911. Last: 11th Aug 2022
  • Hecker
    3rd Sep 2022 Member 0 Permalink

    Ok, the heating of it is slower then it would normaly be,

    to change the speed of heat transfer

     

    change the numbers in these, (make them the same) in the update function

     

    sim.partProperty(i,'temp',sim.partProperty(i,'temp') + 1)
    sim.partProperty(r,'temp',sim.partProperty(r,'temp') - 1)

     

    if elem.EL_PT_test then elem.free(elem.EL_PT_test) end
    local test = elem.allocate('EL', 'test')
    elem.property(test, 'Name', 'test')
    elem.property(test, 'Description', 'test')
    elem.property(test, 'MenuVisible', 1)
    elem.property(test, 'MenuSection', 8)
    elem.property(test, 'Color', 0xffffff)
    elem.property(test, 'Flammable', 0)
    elem.property(test, 'Explosive', 0)
    elem.property(test, 'Properties', elem.TYPE_GAS)
    elem.property(test, 'Weight', 0)
    elem.property(test, 'Gravity', 0.1)
    elem.property(test, 'Diffusion', 0)
    elem.property(test, 'Advection', 1)
    elem.property(test, 'AirLoss', 1)
    elem.property(test, 'AirDrag', 0)
    elem.property(test, 'Temperature', convertCtoK(20))
    elem.property(test, 'HeatConduct', 0)
    elem.property(test, 'Falldown', 3)
    elem.property(test, 'Update',function(i, x, y, s, nt)
        for r in sim.neighbors(x,y,2,2) do
            if (sim.partProperty(r, "temp") >= sim.partProperty(i,'temp')) then
                sim.partProperty(i,'temp',sim.partProperty(i,'temp') + 1)
                sim.partProperty(r,'temp',sim.partProperty(r,'temp') - 1)
            end
        end
    end)
     
  • username90000
    3rd Sep 2022 Member 0 Permalink

    just use molten plutonium for this