Script Announcement: Quantronics.

  • powder_is_epic
    8th May Member 0 Permalink

    I am working on a new lua script/mod called Quantronics. It will hopefully add some new radioactive elements, aswell as a (simplified) version of quantum computing to TPT. As a teaser, i've decided to showcase a little bit of the code. Copy the following code into a .lua file and then put it into your script folder (you need the mod manager for this) boot up TPT, and activate the mod from the mod manager. Here is the code:

    elem.allocate("ION", "ION")
    -- Credit to CXI'S Element Creator Mod, which helped me create some of the basic code for these elements.
    elem.element(elem.ION_PT_ION, elem.element(elem.DEFAULT_PT_NEUT))

    elem.property(elem.ION_PT_ION, "Name", "ION")

    elem.property(elem.ION_PT_ION, "Description", "Ion. Moves very unpredictedly, but is heavily influenced by pressure. Sparks conductors.")

    elem.property(elem.ION_PT_ION, "Colour", 0xd3d2)

    elem.property(elem.ION_PT_ION, "MenuVisible", 1)

    elem.property(elem.ION_PT_ION, "MenuSection", SC_NUCLEAR)

    elem.property(elem.ION_PT_ION, "Advection", 100)

    elem.property(elem.ION_PT_ION, "AirDrag", 0.01)

    elem.property(elem.ION_PT_ION, "AirLoss", 1)

    elem.property(elem.ION_PT_ION, "Loss", 0.5)

    elem.property(elem.ION_PT_ION, "Collision", 1)

    elem.property(elem.ION_PT_ION, "Gravity", 0)

    elem.property(elem.ION_PT_ION, "Diffusion", 15)

    elem.property(elem.ION_PT_ION, "HotAir", 0.001)

    elem.property(elem.ION_PT_ION, "Explosive", 0)

    elem.property(elem.ION_PT_ION, "Flammable", 0)

    elem.property(elem.ION_PT_ION, "Hardness", 0)

    elem.property(elem.ION_PT_ION, "Meltable", 0)

    elem.property(elem.ION_PT_ION, "Weight", -1)

    elem.property(elem.ION_PT_ION, "HeatConduct", 100)

    elem.property(elem.ION_PT_ION, "Temperature", 350.3)

    elem.property(elem.ION_PT_ION, "Falldown", 0)

    elem.property(elem.ION_PT_ION, "State", elem.ST_NONE)

    elem.property(elem.ION_PT_ION, "Properties", elem.TYPE_ENERGY)

    elem.property(elem.ION_PT_ION, "LowPressure", IPL)

    elem.property(elem.ION_PT_ION, "LowPressureTransition", NT)

    elem.property(elem.ION_PT_ION, "HighPressure", IPH)

    elem.property(elem.ION_PT_ION, "HighPressureTransition", NT)

    elem.property(elem.ION_PT_ION, "LowTemperature", ITL)

    elem.property(elem.ION_PT_ION, "LowTemperatureTransition", NT)

    elem.property(elem.ION_PT_ION, "HighTemperature", ITH)

    elem.property(elem.ION_PT_ION, "HighTemperatureTransition", NT)
    -- Update and graphics functions - credit to Mark Huss for posting some code that helped me figure out how to code update and graphics functions, because without that code, i would have never been able to figure this out.
    function IONup(i, x, y, s, nt)

    if s ~= nt then

    for dx = -1, 1 do
       
    for dy = -1, 1 do
       
    if dx ~= 0 or dy ~= 0 then
       
    sim.partCreate(-1, x + dx, y + dy, elem.DEFAULT_PT_SPRK)

    end

    end

    end

    end

    end

    function IONgr(i, colr, colg, colb)

    return 1, 0x00000040+0x000000080+0x00020000, 0, colr, colg, colb, 98, 0, 255, 255

    end
       
    elem.property(elem.ION_PT_ION, "Update", IONup)

    elements.property(elem.ION_PT_ION, "Graphics", IONgr)
    -- This mod/script will hopefully be released and completed by mid to late 2024. Comment any suggestions
    -- you have for the mod.
  • powder_is_epic
    15th September Member 0 Permalink

    Date pushed to early 2025