summaryrefslogtreecommitdiff
path: root/scripts/global.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/global.lua')
-rwxr-xr-xscripts/global.lua39
1 files changed, 18 insertions, 21 deletions
diff --git a/scripts/global.lua b/scripts/global.lua
index 2d6cf3e..39bde4a 100755
--- a/scripts/global.lua
+++ b/scripts/global.lua
@@ -412,29 +412,26 @@ function SetDeltaTimeDelay(delay)
mDeltatimeDelay = delay
end
--- get current gear (even when engine/ignition is off)
+-- get current gear
function GetCurrentGear()
- local g = GetCarInfo("gear")
- -- get neutral
- local n = GetContextInfo("neutral")
- -- get reverse char and convert to string
- local r = string.char(GetContextInfo("reverse"))
- -- get state of custom Optimal Shift Point (OSP) records
- local ospcustom_on = GetContextInfo("ospcustom")
-
- -- set neutral, reverse or current gear
- local result = g
-
- if g == 0 then
- -- if neutral and using custom OSP record then add a dot to gear digit
- if ospcustom_on then n = n + 128 end
- result = string.char(n)
- elseif g < 0 then
- -- reverse
- result = r
- end
+ local g = GetCarInfo("gear")
+ -- get neutral
+ local n = string.char(GetContextInfo("neutral"))
+ -- get reverse char and convert to string
+ local r = string.char(GetContextInfo("reverse"))
+
+ -- set neutral, reverse or current gear
+ local result = g
+
+ if g == 0 then
+ -- neutral
+ result = n
+ elseif g < 0 then
+ -- reverse
+ result = r
+ end
- return result
+ return result
end