summaryrefslogtreecommitdiff
path: root/scripts/gear.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gear.lua')
-rw-r--r--[-rwxr-xr-x]scripts/gear.lua86
1 files changed, 77 insertions, 9 deletions
diff --git a/scripts/gear.lua b/scripts/gear.lua
index 88dad9f..54649d6 100755..100644
--- a/scripts/gear.lua
+++ b/scripts/gear.lua
@@ -1,9 +1,72 @@
--- SLIMax Mgr Lua Script v3
+-- SLIMax Mgr Lua Script v3.2.1
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- gear event
--- last change by Zappadoc - 2013-02-15
+-- last change by Zappadoc - 2013-09
--- SLI-M, SLI-PRO Gear Event
+function Ignition(gear, isFanatec)
+ -- ========================================================================================
+ -- IGNITION
+ -- 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
+ end
+ return 2
+end
+
+-- SIM RACE Deluxe, SIM RACE F1, SLI-M, SLI-PRO Gear Event
function gearEvent(gear)
-- get the rpm limit already computed by my OSP method
-- using OSP Factor parameter
@@ -26,6 +89,9 @@ function gearEvent(gear)
result = global_custom_gearEvent(gear)
if result <= 1 then return result end
+ -- ignition
+ if Ignition(gear, false) <= 1 then return 1 end
+
local g = gear
if oldGear == nil then oldGear = -1 end
@@ -52,7 +118,6 @@ function gearEvent(gear)
if g == 69 then
return 0
end
-
SetGearDigit(string.char(g))
end
end
@@ -77,16 +142,19 @@ function gearFanatecEvent(gear)
if gRedZone == nil then gRedZone = 18000 end
-- call custom script
- local result = custom_gearEvent(gear)
+ local result = custom_gearFanatecEvent(gear)
if result <= 1 then return result end
-- call global custom script
- result = global_custom_gearEvent(gear)
+ result = global_custom_gearFanatecEvent(gear)
if result <= 1 then return result end
+ -- ignition
+ if Ignition(gear, true) <= 1 then return 1 end
+
local g = gear
if oldGear == nil then oldGear = -1 end
-
+
if oldGear ~= g then
local rumbbleGear = GetContextInfo("gearshock")
local rumbbleGearDelay = GetContextInfo("gearshockdelay")
@@ -104,5 +172,5 @@ function gearFanatecEvent(gear)
oldGear = g
end
- return 1
-end
+ return 2
+end \ No newline at end of file