Experimental Fuel Persistence Mod

Discussion in 'Mods and Skins' started by epicduck410, Dec 3, 2024.

  1. epicduck410

    epicduck410
    Expand Collapse

    Joined:
    Dec 3, 2024
    Messages:
    2
    This mod was tested across all vanilla cars, though not all configs. If you encounter any issues with vanilla vehicles, DM or post them here, and include the config you were using, if it isn't already included in the game. Issues caused by mods will not be fixed, that is up to you to add functionality for, which really isn't hard to do.

    First, unpack the mod in the mod manager. You can do that by double clicking the mod and clicking unpack.
    upload_2024-12-2_22-2-56.png
    upload_2024-12-2_22-3-10.png

    Then, click "Open in Explorer", this will bring you to the mod directory. Keep this folder open for now.

    Go into the game and spawn the car you wish to add support for. Let's say you want to add support for the Gavril Vertex. Open the console using the tilda key (~) or (`) under the escape key. Look closely at the output for the name of your vehicle:
    upload_2024-12-2_22-5-18.png
    "/vehicles/gavril_vertex/"

    Make the folder in /vehicles/ as so:
    upload_2024-12-2_22-6-25.png

    Now, copy the lua folder from the atv folder into the folder you just made.
    upload_2024-12-2_22-8-13.png
    Enter the lua folder in the new folder you just made for the car, and open fuelManager.lua.

    Copy and paste this outside of a function:

    local function printTable(tbl, indent)
    indent = indent or 0
    local indentString = string.rep(" ", indent)

    for key, value in pairs(tbl) do
    if type(value) == "table" then
    print(indentString .. tostring(key) .. ": {")
    printTable(value, indent + 1)
    print(indentString .. "}")
    else
    print(indentString .. tostring(key) .. ": " .. tostring(value))
    end
    end
    end

    And then paste this inside of the onInit() function:

    printTable(energyStorage.getStorages())

    This will provide us with the names of the fuel tanks on the car.
    upload_2024-12-2_22-12-54.png
    Save, go into the game, and press CTRL + R to reload the Lua environment. Scroll up to the printed information:
    upload_2024-12-2_22-16-20.png
    As we can see, the main fuel tank is called mainTank, and remainingVolume is the field that indicates how much fuel is left.

    With this, we can see it's already implemented into the table of storages here, meaning we don't need to do anything. However, this may not be the case for all vehicles, and some vehicles can have multiple fuel tanks, so it's still important to check. You should also check this for battery configurations.
    upload_2024-12-2_22-17-55.png
    If you did everything correctly, it should begin working. You can repack by going back to the first step and clicking "Pack", if you feel its necessary.

    This mod allows you to break your car without resetting burnt fuel. Only CTRL + R or vehicle configuration will reset your fuel level. If you think I should add more, like maybe even saving fuel across game sessions (if that's even possible), up to even mileage, feel free to pitch in ideas. I have no clue why nobody has made anything like this before as far as I know.

    Updates:
    (v1.1): Added support for the Bruckell Nine in v0.34
     

    Attached Files:

    #1 epicduck410, Dec 3, 2024
    Last edited: Jan 5, 2025
    • Like Like x 5
  2. Redknee

    Redknee
    Expand Collapse

    Joined:
    May 4, 2023
    Messages:
    13
    this is cool i hope you develop more on it
     
  3. MrMoose27

    MrMoose27
    Expand Collapse

    Joined:
    Aug 12, 2024
    Messages:
    3
    will this be getting updated for 0.34? it, at least for me, doesn't work after the update
    --- Post updated ---
    nvm
     
    • Agree Agree x 1
  4. epicduck410

    epicduck410
    Expand Collapse

    Joined:
    Dec 3, 2024
    Messages:
    2
    The latest vehicle likely needs added. I'll look into it now.
     
  5. Kizyo

    Kizyo
    Expand Collapse

    Joined:
    Mar 13, 2024
    Messages:
    1

    Yes please add a persistent odometer I am begging you cus this is a feature that I have been trying to implement all the way back in 0.23 and never got it to fn work !
     
    • Like Like x 1
  6. DonV2003

    DonV2003
    Expand Collapse

    Joined:
    Feb 7, 2025
    Messages:
    1
    Does/would this work with modded/automation vehicles? Or does it need to be physically coded fully for each car by you?

    Also, would this work in multiplayer if set up by the host? I would guess the answer would be no as it probably wouldnt be able to keep track of everyone's fuel properly.
    But in theory at least if everyone is in different cars it may work.

    Thanks

    Edit: I have tested both of these things and they work flawlessly. Even having multiple people in the same type of car works and it only resets each persons car. Overall very happy, this makes endurance races possible and i can finally force pits without going off of tire wear which is inconsistent.
     
    #6 DonV2003, Feb 7, 2025
    Last edited: Feb 12, 2025
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice