Trying to lock/unlock a specific differential with a keybind

Discussion in 'Programming' started by Spython, Nov 27, 2020.

  1. Spython

    Spython
    Expand Collapse

    Joined:
    Oct 16, 2017
    Messages:
    93
    I have been trying to make a center differential be controlled separately from axle diffs, so I made it use the binding for toggling between 2WD/4WD (alt + S) with a default 4wd controller and renamed differential file in the mod's powertrain folder. The reason for this is because of that particular bind becoming redundant with a permanently connected front drive shaft.

    The part adding 4wd controller for all rangebox and center diff options:
    Code:
        "controller": [
            ["fileName"],
            ["4wd", {"shaftName":"transfercase", "rangeBoxName":"rangebox"}],
        ],
    A differential that uses the renamed file (differential_custom):
    Code:
    "powertrain" : [
            ["type", "name", "inputName", "inputIndex"],
            //viscous coupling + lock
            ["differential_custom", "transfercase", "rangebox", 1, {"diffType":["viscous","locked"], "diffTorqueSplit":0.5, "viscousCoef":8, "viscousTorque":800, "lockTorque":20000, "friction":5, "uiName":"Center Differential","defaultVirtualInertia":0.1,"speedLimitCoef":0.1}],       
        ],
    At first this seemed to work perfectly, as the center differential would toggle just fine, apart from one specific issue.
    If I started a map with a default vehicle using one of vanilla transfer cases (D-series, Hopper etc.), and then used load & save tab from configs menu to load a vehicle equipped with my modded transfer case, it would show front shaft icon instead of a differential one on the simple powertrain app, and using the keybind would only give an UI message saying "4WD Status: connected".
    Loading a config from the vehicle selection menu or clicking the differential icon on advanced powertrain app would fix the bug and the mod works properly afterwards in that session. This makes me wonder how one would sort this small problem, since it's so specific.
     
  2. ralokh5

    ralokh5
    Expand Collapse

    Joined:
    Oct 16, 2020
    Messages:
    7
    I had same issue. I fixed it with changing viscous/locking type to open/locking center diff. For some reason simple powertarin app does not want to mix viscous/locking and open/locking icons together.
     
    #2 ralokh5, Jan 1, 2021
    Last edited: Jan 1, 2021
  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