diff --git a/lua/vehicle/extensions/ESBtnBoxDrivetrain.lua b/lua/vehicle/extensions/ESBtnBoxDrivetrain.lua index 7352153..d0f2e51 100644 --- a/lua/vehicle/extensions/ESBtnBoxDrivetrain.lua +++ b/lua/vehicle/extensions/ESBtnBoxDrivetrain.lua @@ -78,7 +78,6 @@ local function getDiff(diffObj) end local function openDiff(diffObj) - print("Opening diff") local diff = getDiff(diffObj) if next(diff) == nil then return {} @@ -89,7 +88,6 @@ local function openDiff(diffObj) end local function lockDiff(diffObj) - print("Locking diff") local diff = getDiff(diffObj) if next(diff) == nil then return diff --git a/lua/vehicle/extensions/ESBtnBoxHeadlights.lua b/lua/vehicle/extensions/ESBtnBoxHeadlights.lua index ee02abe..c1bf9cb 100644 --- a/lua/vehicle/extensions/ESBtnBoxHeadlights.lua +++ b/lua/vehicle/extensions/ESBtnBoxHeadlights.lua @@ -28,7 +28,6 @@ end -- HeadLight handling ---------------------------------------------------------------------------------------------------- local function toggleHighBeams() - print("toggling high beams") if currentHeadlightMode == highBeams then setHeadlightsTo(headlightsOff) else @@ -37,7 +36,6 @@ local function toggleHighBeams() end local function toggleLowBeams() - print("toggling low beams") if currentHeadlightMode == lowBeams then setHeadlightsTo(headlightsOff) else @@ -53,23 +51,25 @@ local lightbarOn = 1 local lightbarWithSound = 2 local lightbarCurrentMode = 0 + +local function setLightbarMode(mode) + electrics.set_lightbar_signal(mode) + lightbarCurrentMode = mode +end + local function turnLightbarLight() if lightbarCurrentMode == lightbarOn then - electrics.set_lightbar_signal(lightbarOff) - lightbarCurrentMode = lightbarOff + setLightbarMode(lightbarOff) else - electrics.set_lightbar_signal(lightbarOn) - lightbarCurrentMode = lightbarOn + setLightbarMode(lightbarOn) end end local function turnLightbarSound() if lightbarCurrentMode == lightbarWithSound then - electrics.set_lightbar_signal(lightbarOff) - lightbarCurrentMode = lightbarOff + setLightbarMode(lightbarOff) else - electrics.set_lightbar_signal(lightbarWithSound) - lightbarCurrentMode = lightbarWithSound + setLightbarMode(lightbarWithSound) end end @@ -78,4 +78,27 @@ M.toggleLowBeams = toggleLowBeams M.toggleLigthbarLight = turnLightbarLight M.toggleLigthbarSound = turnLightbarSound +local myTimer = 0 +local requestToReset = false +local function updateGFX(dt) + if not requestToReset then + return + end + + myTimer = myTimer + dt + if myTimer > 1 then + setLightbarMode(lightbarCurrentMode) + requestToReset = false + myTimer = 0 + end +end + +local function onReset() + requestToReset = true +end + + +M.onReset = onReset +M.updateGFX = updateGFX + return M \ No newline at end of file diff --git a/lua/vehicle/extensions/ESBtnBoxIgnition.lua b/lua/vehicle/extensions/ESBtnBoxIgnition.lua index 8c9c630..65d28c0 100644 --- a/lua/vehicle/extensions/ESBtnBoxIgnition.lua +++ b/lua/vehicle/extensions/ESBtnBoxIgnition.lua @@ -84,12 +84,9 @@ M.turnStarter = turnStarter M.releaseStarter = releaseStarter local function restoreIgnition(level) - print("Restoring ignition to " .. level) if level == ignitionAcc then - print("Setting ignition to acc") setIgnitionAcc() elseif level == ignitionOn then - print("Setting ignition to on") setIgnitionOn() end end @@ -108,6 +105,7 @@ local function updateGFX(dt) myTimer = myTimer + dt if myTimer > 1 then restoreIgnition(curIgnitionPos) + requestToReset = false myTimer = 0 end end