From db7d99359d62b05a1f6e2c551106b7bf26764889 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Mon, 18 Nov 2013 21:04:19 +0100 Subject: 3.3.0.3 -> 3.3.0.5 --- scripts/gear.lua | 166 +++++++++++++++++++++++++++---------------------------- 1 file changed, 83 insertions(+), 83 deletions(-) (limited to 'scripts/gear.lua') diff --git a/scripts/gear.lua b/scripts/gear.lua index 7015eef..4e6778b 100644 --- a/scripts/gear.lua +++ b/scripts/gear.lua @@ -9,59 +9,59 @@ function Ignition(gear, isFanatec) -- patch led function damage for ignition -- check if sim is rFactor2 if GetContextInfo("simulation") == "rFactor2.exe" then - if GetCarInfo("rpm") == 0 and GetCarInfo("rawspeed") == 0 then - if GetCarInfo("ignition") == 0 then - -- engine has been stopped - -- engine has been stopped - -- do nothing - - - elseif GetCarInfo("ignition") == 1 then - -- ignition ON after engine stop - -- engine has been stopped, ignition ON - - SetDigitsAllowed(false) - if isFanatec == true then - SetFanatecDigits(" ") - else - SetLeftDigits (" ") - SetRightDigits (" ") - end - - SetGearDigit("_") - - -- init led - toggleAllLed(0) - - -- blink damage led - if mOLDIgnitionticks == nil or GetTicks() > mOLDIgnitionticks then - mOLDIgnitionticks = GetTicks() + 1000 - initLedTable(mRPMLedTable, 1) - - SetWarnLed(GetLedIndex("damage"), 1) - - else - initLedTable(mRPMLedTable, 0) - SetWarnLed(GetLedIndex("damage"), 0) - end - SetRPMLed("mRPMLedTable") - SLISendReport() - return 1 - - elseif GetCarInfo("ignition") == 2 and GetCarInfo("rpm") == 0 and GetCarInfo("rawspeed") == 0 then - -- ignition ON and starter ON - -- engine has been stopped, ignition ON + Starter ON - - SetGearDigit("-") - SetDigitsAllowed(true) - -- stop blinking - initLedTable(mRPMLedTable, 1) - SetWarnLed(GetLedIndex("damage"), 1) - SetRPMLed("mRPMLedTable") - SLISendReport() - return 1 - end - end + if GetCarInfo("rpm") == 0 and GetCarInfo("rawspeed") == 0 then + if GetCarInfo("ignition") == 0 then + -- engine has been stopped + -- engine has been stopped + -- do nothing + + + elseif GetCarInfo("ignition") == 1 then + -- ignition ON after engine stop + -- engine has been stopped, ignition ON + + SetDigitsAllowed(false) + if isFanatec == true then + SetFanatecDigits(" ") + else + SetLeftDigits (" ") + SetRightDigits (" ") + end + + SetGearDigit("_") + + -- init led + toggleAllLed(0) + + -- blink damage led + if mOLDIgnitionticks == nil or GetTicks() > mOLDIgnitionticks then + mOLDIgnitionticks = GetTicks() + 1000 + initLedTable(mRPMLedTable, 1) + + SetWarnLed(GetLedIndex("damage"), 1) + + else + initLedTable(mRPMLedTable, 0) + SetWarnLed(GetLedIndex("damage"), 0) + end + SetRPMLed("mRPMLedTable") + SLISendReport() + return 1 + + elseif GetCarInfo("ignition") == 2 and GetCarInfo("rpm") == 0 and GetCarInfo("rawspeed") == 0 then + -- ignition ON and starter ON + -- engine has been stopped, ignition ON + Starter ON + + SetGearDigit("-") + SetDigitsAllowed(true) + -- stop blinking + initLedTable(mRPMLedTable, 1) + SetWarnLed(GetLedIndex("damage"), 1) + SetRPMLed("mRPMLedTable") + SLISendReport() + return 1 + end + end end return 2 end @@ -104,22 +104,22 @@ function gearEvent(gear) -- optimize display, call if changed if oldGear ~= g then - -- backup gear state - oldGear = g - -- set neutral, reverse or current gear - 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 - SetGearDigit(string.char(n)) - elseif g < 0 then - SetGearDigit(r) - else - -- if gear = 'E' give the hand to SLIMax Manager - if g == 69 then - return 0 - end - SetGearDigit(string.char(g)) - end + -- backup gear state + oldGear = g + -- set neutral, reverse or current gear + 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 + SetGearDigit(string.char(n)) + elseif g < 0 then + SetGearDigit(r) + else + -- if gear = 'E' give the hand to SLIMax Manager + if g == 69 then + return 0 + end + SetGearDigit(string.char(g)) + end end return 1 @@ -156,20 +156,20 @@ function gearFanatecEvent(gear) if oldGear == nil then oldGear = -1 end if oldGear ~= g then - local rumbbleGear = GetContextInfo("gearshock") - local rumbbleGearDelay = GetContextInfo("gearshockdelay") - - -- gear schock effect restricted to 1 to 7 - if rumbbleGear and g > 0 then - if g < oldGear then - SetFanatecWheelMotor(0, 100, rumbbleGearDelay) - elseif g > oldGear then - SetFanatecWheelMotor(1, 100, rumbbleGearDelay) - end - end - - -- backup gear state - oldGear = g + local rumbbleGear = GetContextInfo("gearshock") + local rumbbleGearDelay = GetContextInfo("gearshockdelay") + + -- gear schock effect restricted to 1 to 7 + if rumbbleGear and g > 0 then + if g < oldGear then + SetFanatecWheelMotor(0, 100, rumbbleGearDelay) + elseif g > oldGear then + SetFanatecWheelMotor(1, 100, rumbbleGearDelay) + end + end + + -- backup gear state + oldGear = g end return 2 -- cgit v1.2.3