This is a simple mod, which automatically shuts off the turn signals. Open game_folder\lua\vehicle\electrics.lua After: Code: local blinkTimer = 0 add (with a new line): Code: local steering_old = 0 After: Code: updateValue("lowhighbeam") add (with a new line): Code: -- auto disable blinker if ( math.abs( M.values["steering"] ) < math.abs( steering_old ) and math.abs( M.values["steering"] ) < 0.3 and math.abs( steering_old ) > 0.3 ) then electrics.disableBlinkerSignals( M.values["steering"] ) end steering_old = M.values["steering"] -- auto disable blinker After "end" of "setLightsState" function (line 311) add (with a new line): Code: -- auto disable blinker local function disableBlinkerSignals( v ) if ( not signalWarnState ) then if ( v < 0 ) then signalRightState = false else signalLeftState = false end signalModeChanged() end end -- auto disable blinker After: Code: M.init = reset add (with a new line): Code: -- auto disable blinker M.disableBlinkerSignals = disableBlinkerSignals -- auto disable blinker Demonstration:
Update. It should now work correctly on keyboards. How to update for those who have used the previous version: Open game_folder\lua\vehicle\input.lua and delete: Code: -- auto disable blinker if ( math.abs( M.axisX ) < math.abs( M.axisX_old ) and math.abs( M.axisX ) < 0.3 and math.abs( M.axisX_old ) > 0.3 ) then electrics.disableBlinkerSignals() end M.axisX_old = M.axisX -- auto disable blinker and: Code: M.axisX_old = 0 Make the third and fourth steps which are specified in the first post.
Ok, I have just made my first modification to the game. I wanted to do the automatic shut-off of the turn signal when the steering wheel returns towards center, because it seemed an easy mod to start with, but I did not noticed that incognito has done it already . So anyway, here is my version of it: Code in blue must be copied into the corresponding lua script. The values (-)45 and (-)10 are the angles that the steering wheel must reach to shut of the turn signal. So steering must first exceed 45 degree and then return to 10 degree before shutting of the turn signal. game_folder\lua\vehicle\electrics.lua Code: -- internal functions local function signalModeChanged() updateValue("signal_right_input", 0) updateValue("signal_left_input", 0) end [COLOR=#0000ff]-- function to turn off indicators automatic: -- Mod by bits&bytes on 03-Sep-2013[/COLOR][COLOR=#0000ff] function IndicatorAutoOff()[/COLOR][COLOR=#0000ff] --Turn off left indicator:[/COLOR][COLOR=#0000ff] if M.values["steering"] > 45 and Steered_Left ~= true then[/COLOR][COLOR=#0000ff] Steered_Left = true[/COLOR][COLOR=#0000ff] end[/COLOR][COLOR=#0000ff] if M.values["steering"] < 10 and Steered_Left == true then [/COLOR][COLOR=#0000ff] Steered_Left = false[/COLOR][COLOR=#0000ff] if not signalWarnState then [/COLOR][COLOR=#0000ff] signalLeftState = false[/COLOR][COLOR=#0000ff] signalModeChanged()[/COLOR][COLOR=#0000ff] end[/COLOR][COLOR=#0000ff] end[/COLOR][COLOR=#0000ff] --Turn off right indicator:[/COLOR][COLOR=#0000ff] if M.values["steering"] < -45 and Steered_Right ~= true then[/COLOR][COLOR=#0000ff] Steered_Right = true[/COLOR][COLOR=#0000ff] end[/COLOR][COLOR=#0000ff] if M.values["steering"] > -10 and Steered_Right == true then [/COLOR][COLOR=#0000ff] Steered_Right = false[/COLOR][COLOR=#0000ff] if not signalWarnState then[/COLOR][COLOR=#0000ff] signalRightState = false[/COLOR][COLOR=#0000ff] signalModeChanged()[/COLOR][COLOR=#0000ff] end[/COLOR][COLOR=#0000ff] end[/COLOR][COLOR=#0000ff] end[/COLOR][COLOR=#0000ff] [/COLOR] -- user input functions local function toggle_left_signal() if not signalWarnState then signalLeftState = not signalLeftState else signalLeftState = true end if signalLeftState then signalRightState = false signalWarnState = false end signalModeChanged() end game_folder\lua\vehicle\hydros.lua Code: local function update(dts) -- state: the state of the hydro from -1 to 1 -- cmd the input value -- note: state is scaled to the ratio as the last step for i,h in pairs(M.hydros) do -- slowly approach the desired value if h.cmd < h.state then h.state = math.max(h.state - dts * h._inrate, h.cmd) else h.state = math.min(h.state + dts * h._outrate, h.cmd) end --if inputSource ~= "steering" then -- print("state: "..h.state .. " - inlimit: " .. h.inLimit.. " - state: "..h.state .. " cmd:"..h.cmd .. " val = "..val) --end obj:setBeamLengthRefRatio(h.beam.cid, h.state) end [COLOR=#0000ff]IndicatorAutoOff() -- Mod by bits&bytes on 03-sep-2013[/COLOR][COLOR=#0000ff] [/COLOR]end -- nop'ed functions M.updateGFX = updateGFX M.update = update Or you can replace both scripts with the ones in the .zip file. If you do it that way, keep in mind that earlier mods in those files, will be overwritten. Next modification will be an alternative way of steering for keyboard users (like me): I will try to reduce the steering speed so it looks more realistic (return speed is good like it is now). If possible I make the steering speed lower as airspeed increases. I will try to make some sort of incremental steering, so pressing left key will turn the steering wheel to the left. When releasing the key, the wheel will stay in its position. Right key will move the wheel to the right. Another button will release the steering wheel so it returns back to its center position. But I will make another topic for that.
Added the installation file for automatic installation with Lua-mod-installer . Unpack the "InstallScript" archive, in BeamNG Lua-mod Installer select adts_script.bls and press "Install" button.