Setting two differential modes in one mode

Discussion in 'Programming' started by Chvrch, Nov 5, 2024.

  1. Chvrch

    Chvrch
    Expand Collapse

    Joined:
    Oct 13, 2024
    Messages:
    2
    I am working on a transfer case that can lock and unlock the front and rear differentials in the different drive modes, such as locking both diffs in 4lo and unlocking them in 2hi. It would be simple enough using stock open/locked diffs, but I also added lsd/locking diffs. This would also be simple, but I want to be able to control either one without creating multiple parts (no control f/r, open/lock f no rear, etc...) Ideally I could set diff_f/diff_r to open and lsd at the same time. I have tried
    Code:
                "2hi": {
                    "name": "2WD High Gear",
                    "order": 10,
                    "settings": [
                        ["type"]
                        ["powertrainDeviceMode", {"deviceName":"lowrange", "mode":"high"}]
                        ["powertrainDeviceMode", {"deviceName":"transfercase_F", "mode":"disconnected"}]
                        ["powertrainDeviceMode", {"deviceName":"differential_F", "mode":"open"}]
                        ["powertrainDeviceMode", {"deviceName":"differential_F", "mode":"lsd"}]
                    ],
                },
    
    as well as
    Code:
     ["powertrainDeviceMode", {"deviceName":"differential_F", "mode":"lsd"}] 
    ["powertrainDeviceMode", {"deviceName":"differential_F", "mode":"open"}]
    
    and
    Code:
    ["powertrainDeviceMode", {"deviceName":"differential_F", "mode":"lsd", "mode":"open"}]
    but it will only set whichever line comes second. so "mode":"lsd" ... "mode":"open" only sets an open diff but leaves an lsd locked.

    I have also tried
    Code:
    ["powertrainDeviceMode", {"deviceName":"differential_F", "mode":"lsd","open"}]
    Code:
    ["powertrainDeviceMode", {"deviceName":"differential_F", "mode":"lsd":"open"}]
    Code:
    ["powertrainDeviceMode", {"deviceName":"differential_F", "mode":"lsd" "open"}]
    but these all throw an error and stop the game from reading the part properly.

    Trying
    Code:
    ["powertrainDeviceMode", {"deviceName":"differential_F", "mode":"lsd"}, {"deviceName":"differential_F", "mode":"open"}]
    causes the game to crash any time it tries to load the file.

    I could use diff toggle instead but I want it to set the diff mode each time you enter a 4wd mode so that locking/unlocking a diff independently won't throw off the whole system. The ability to turn off the auto locking per axle would be nice as well.

    I tried making a slot
    Code:
    "slots": [
            ["type", "default", "description"],
            ["differential_F_controller", "differential_F_controller_LSD", "Front Differential Control", {"coreSlot":true}],
        ],
        "controller": [
            ["fileName"],
            ["driveModes", {"name":"transfercaseControl"}]
            ["4wd", {"driveModesTransfercaseNames":["transfercaseControl"], "driveModesRangeNames":["transfercaseControl"], "driveModesDifferentialNames":["differential_F_controller"]}]
        ],
       
        "transfercaseControl":{
            "enabledModes":["2hi", "4hi", "4lo"]
            "defaultMode": "2hi"
            "modes": {
                "2hi": {
                    "name": "2WD High Gear",
                    "order": 10,
                    "settings": [
                        ["type"]
                        ["powertrainDeviceMode", {"deviceName":"lowrange", "mode":"high"}]
                        ["powertrainDeviceMode", {"deviceName":"transfercase_F", "mode":"disconnected"}]
                        ["powertrainDeviceMode", {"deviceName":"differential_F_controller", "mode":"2hi"}]
                    ],
                },
    ...
    "nodifferential_F_controller": {
        "information":{
            "name":"No Front Differential Controller",
        },
        "slotType" : "differential_F_controller",
    },
    "differential_F_controller_LSD": {
        "information":{
            "name":"LSD Front Differential Controller",
        },
        "slotType" : "differential_F_controller",
        "differential_F_controller":{
            "enabledModes":["2hi","4hi","4lo"]
            "defaultMode": "2hi"
            "modes": {
                "2hi": {
                    "name": "Front Diff LSD",
                    "order": 10,
                    "settings": [
                        ["type"]
                        ["powertrainDeviceMode", {"deviceName":"differential_F", "mode":"lsd"}]
                    ],
                },
                "4hi": {
                    "name": "Front Diff Locked",
                    "order": 30,
                    "settings": [
                        ["type"]
                        ["powertrainDeviceMode", {"deviceName":"differential_F", "mode":"locked"}]
                    ],
                },
                "4lo": {
                    "name": "Front Diff Locked",
                    "order": 40,
                    "settings": [
                        ["type"]
                        ["powertrainDeviceMode", {"deviceName":"differential_F", "mode":"locked"}]
                    ],
                },
            }
        }
    },
    ,
    
    and
    Code:
     "controller": [
            ["fileName"],
            ["driveModes", {"name":"transfercaseControl"}]
            ["4wd", {"driveModesTransfercaseNames":["transfercaseControl"], "driveModesRangeNames":["transfercaseControl"], "driveModesDifferentialNames":["driveModesDifferentials"]}]
        ],
        
    ...
        
    "differential_F_controller_LSD": {
        "information":{
           "name":"LSD Front Differential Controller",    },
        "slotType" : "differential_F_controller",
        "driveModesDifferentials":{    
    but it wont switch the slot to the different modes.

    I can override "transfercaseControl" in the slot but that just moves the problem of making a part for every combination of front and rear no control, lsd control, and open control to the slots instead of the main transfercase, as well as having to dive into the engine>transmission<transfercase>slot every time you want t change a diff type. . My idea from the beginning was to simplify the whole process and make it dummy proof, but that just trades the complexity from operating it to setting it up,
     
    • Like Like x 1
  2. epicfacecanada

    epicfacecanada
    Expand Collapse

    Joined:
    Oct 8, 2016
    Messages:
    445
    One solution might be to use the "Components" function to store variables from the diffs and apply them to the transfer case modes.

    Put this in the diff Jbeam

    "components": {
    "frontDiffType": "lsd"
    },

    Then do this to apply it to the transfercase.

    ["powertrainDeviceMode", {"deviceName":"differential_F", "mode":$=$components.frontDiffType}]
     
  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