how does LAVA know its ctype's meltp. ?

  • polokus
    28th Sep 2020 Member 0 Permalink

    How does LAVA know what melting point its 'ctype' has?

    LAVA has its melting point at max_temp to check constantly whether to solidify.

    I could write code:

     

        -- I AM METAL CHLORIDE
        if mytemp > 673.15 then
            if r ~= nil then
            elemHandle = tpt.create(x+math.random(-1,1), y+math.random(-1,1), "clor")
            if sim.partProperty(i,'type') == elem.DEFAULT_PT_NONE then
            sim.partProperty(i,'type', elem.DEFAULT_PT_METL)
            else
            sim.partProperty(i,'type', sim.partProperty(i,'ctype'))
            end
            mytemp = mytemp - 50
            end
        end
    end

     

    Could I somehow 'get' the melting point as a local?

     

    This code is for metal chloride uses a similar mechanism.

    It checks for its ctype to know what to turn into.

    However it does not have a specific decomposition temperature for Each Metal

    I am trying to think of a mechanism and a way to write it in code without writing ten lines for Each Element.

     

    Anything would help.

    Edited once by polokus. Last: 28th Sep 2020
  • LBPHacker
    28th Sep 2020 Developer 0 Permalink
    Since you're technically introducing a new element property (decomposition temperature), I guess initialising a table with these temperatures and looking the ctype up in it in that update function would work, which would look something like this. You'd have to be careful about the indices in the square brackets: they would need to already hold the metals' IDs by the time the table is initialised.
    Edited once by LBPHacker. Last: 28th Sep 2020
  • polokus
    17th Oct 2020 Member 0 Permalink

    elem.property(elem.POLOKUS_PT_KBVH, "HighPressure", 2426.75)
    elem.property(elem.POLOKUS_PT_DORT, "HighPressureTransition", elements.DEFAULT_PT_LAVA)

    , however it is blank ctype lava.

    Would updating be possible for you?

     

    Ooh I forgot to add, thnka you so verily much for your table, i never even knew i could do that!

    Edited 2 times by polokus. Last: 17th Oct 2020
  • LBPHacker
    17th Oct 2020 Developer 0 Permalink
    Blank ctype LAVA from a HighTemperatureTransition shouldn't be possible. That said, what you're configuring is a high pressure transition, which I don't think the game handles the same way as a high temperature transition (i.e. there's no code to set LAVA's ctype to whatever the source element was). Also, you're setting the threshold and destination for two different elements (KBVH vs. DORT).

    Not sure what you mean by "updating". I can just upload a new paste if you have more questions.
  • polokus
    17th Oct 2020 Member 0 Permalink

    @LBPHacker (View Post)

     I was vague, I fear this won't be accepted.

    I was asking whether you could add HighPressureTransition handling in the code.

    Oops! That's true, you're right, that is supposed to be DORT and not KBVH.

    Edited once by polokus. Last: 17th Oct 2020
  • ReallyJustDont
    4th Nov 2020 Member 0 Permalink

    You can make a fake HighPressureTransition using your Update function using sim.pressure:

    1. Check using an if statement to see if sim.pressure(x/4, y/4) is greater than your desired pressure transition threshold (hopefully not 2426.75, since pressure in tpt is capped at +/- 255)
    2. If it is, set your particle's type to LAVA and ctype to DORT