From e92432e1b49de8b6fa2d3087b2cddb675906fc84 Mon Sep 17 00:00:00 2001 From: Dueesberch Date: Thu, 15 Apr 2021 21:30:11 +0200 Subject: [PATCH 01/46] deactivate CP action --- FS19_AutoDrive/gui/userSettingsPage.xml | 16 ++++++++-------- FS19_AutoDrive/scripts/AutoDrive.lua | 4 ++-- FS19_AutoDrive/scripts/Manager/InputManager.lua | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/FS19_AutoDrive/gui/userSettingsPage.xml b/FS19_AutoDrive/gui/userSettingsPage.xml index 03fb807f..0f805397 100644 --- a/FS19_AutoDrive/gui/userSettingsPage.xml +++ b/FS19_AutoDrive/gui/userSettingsPage.xml @@ -97,14 +97,14 @@ - - - - - - - - + diff --git a/FS19_AutoDrive/scripts/AutoDrive.lua b/FS19_AutoDrive/scripts/AutoDrive.lua index 4b6c6cd7..e397ccbe 100644 --- a/FS19_AutoDrive/scripts/AutoDrive.lua +++ b/FS19_AutoDrive/scripts/AutoDrive.lua @@ -91,8 +91,8 @@ AutoDrive.actions = { {"AD_open_notification_history", false, 0}, {"AD_continue", false, 3}, {"ADParkVehicle", false, 0}, - {"AD_devAction", false, 0} - -- {"COURSEPLAY_MOUSEACTION_SECONDARY", true, 1} + {"AD_devAction", false, 0}--[[. + {"COURSEPLAY_MOUSEACTION_SECONDARY", true, 1}]] } function AutoDrive:onAllModsLoaded() diff --git a/FS19_AutoDrive/scripts/Manager/InputManager.lua b/FS19_AutoDrive/scripts/Manager/InputManager.lua index 83626be8..dbff2bc1 100644 --- a/FS19_AutoDrive/scripts/Manager/InputManager.lua +++ b/FS19_AutoDrive/scripts/Manager/InputManager.lua @@ -23,7 +23,7 @@ ADInputManager.actionsToInputs = { AD_FieldSpeed_down = "input_decreaseFieldSpeed", ADToggleHud = "input_toggleHud", ADToggleMouse = "input_toggleMouse", - COURSEPLAY_MOUSEACTION_SECONDARY = "input_toggleMouse", + --COURSEPLAY_MOUSEACTION_SECONDARY = "input_toggleMouse", ADDebugDeleteWayPoint = "input_removeWaypoint", AD_routes_manager = "input_routesManager", ADSelectNextFillType = "input_nextFillType", From b00d320c70466b210c5b0538cc7b437c6d8adac5 Mon Sep 17 00:00:00 2001 From: Dueesberch Date: Fri, 16 Apr 2021 00:17:15 +0200 Subject: [PATCH 02/46] bugfix 1886 --- FS19_AutoDrive/gui/userSettingsPage.xml | 4 +- FS19_AutoDrive/scripts/AutoDrive.lua | 41 +++++++++++++++++-- FS19_AutoDrive/scripts/Hud.lua | 6 ++- .../scripts/Manager/InputManager.lua | 4 +- 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/FS19_AutoDrive/gui/userSettingsPage.xml b/FS19_AutoDrive/gui/userSettingsPage.xml index 0f805397..061bcb0c 100644 --- a/FS19_AutoDrive/gui/userSettingsPage.xml +++ b/FS19_AutoDrive/gui/userSettingsPage.xml @@ -97,14 +97,14 @@ - + diff --git a/FS19_AutoDrive/scripts/AutoDrive.lua b/FS19_AutoDrive/scripts/AutoDrive.lua index e397ccbe..6620a136 100644 --- a/FS19_AutoDrive/scripts/AutoDrive.lua +++ b/FS19_AutoDrive/scripts/AutoDrive.lua @@ -63,7 +63,7 @@ AutoDrive.toggleSphrere = true AutoDrive.enableSphrere = true AutoDrive.actions = { - {"ADToggleMouse", true, 1}, + {"ADToggleMouse", true, 1}, -- can be changed by AutoDrive:enableCPaction() {"ADToggleHud", true, 1}, {"ADEnDisable", true, 1}, {"ADSelectTarget", false, 0}, @@ -91,8 +91,8 @@ AutoDrive.actions = { {"AD_open_notification_history", false, 0}, {"AD_continue", false, 3}, {"ADParkVehicle", false, 0}, - {"AD_devAction", false, 0}--[[. - {"COURSEPLAY_MOUSEACTION_SECONDARY", true, 1}]] + {"AD_devAction", false, 0}, + {"COURSEPLAY_MOUSEACTION_SECONDARY", true, 1} -- can be changed by AutoDrive:enableCPaction() } function AutoDrive:onAllModsLoaded() @@ -366,4 +366,39 @@ function AutoDrive:FarmStats_getStatisticData(superFunc) return Utils.getNoNil(self.statisticData, {}) end +function AutoDrive:enableCPaction(enableCPaction) + local found = false + if enableCPaction then + ADInputManager.actionsToInputs["ADToggleMouse"] = nil + ADInputManager.actionsToInputs["COURSEPLAY_MOUSEACTION_SECONDARY"] = "input_toggleMouse" + + for key, val in pairs(AutoDrive.actions) do + if val[1] == "ADToggleMouse" then + table.remove(AutoDrive.actions, key) + end + if val[1] == "COURSEPLAY_MOUSEACTION_SECONDARY" then + found = true + end + end + if not found then + table.insert(AutoDrive.actions, {"COURSEPLAY_MOUSEACTION_SECONDARY", true, 1}) + end + else + ADInputManager.actionsToInputs["COURSEPLAY_MOUSEACTION_SECONDARY"] = nil + ADInputManager.actionsToInputs["ADToggleMouse"] = "input_toggleMouse" + + for key, val in pairs(AutoDrive.actions) do + if val[1] == "COURSEPLAY_MOUSEACTION_SECONDARY" then + table.remove(AutoDrive.actions, key) + end + if val[1] == "ADToggleMouse" then + found = true + end + end + if not found then + table.insert(AutoDrive.actions, {"ADToggleMouse", true, 1}) + end + end +end + addModEventListener(AutoDrive) diff --git a/FS19_AutoDrive/scripts/Hud.lua b/FS19_AutoDrive/scripts/Hud.lua index d88c90b4..4c7e92d1 100644 --- a/FS19_AutoDrive/scripts/Hud.lua +++ b/FS19_AutoDrive/scripts/Hud.lua @@ -142,14 +142,18 @@ function AutoDriveHud:createHudAt(hudX, hudY) self.statesHud = 0 if AutoDrive.getSetting("combineCPADHudMouse") > 1.0 and g_courseplay ~= nil then + AutoDrive:enableCPaction(true) if AutoDrive.getSetting("combineCPADHudMouse") == 2.0 then self.statesHud = 1 elseif AutoDrive.getSetting("combineCPADHudMouse") == 3.0 then self.statesHud = 2 end + else + AutoDrive:enableCPaction(false) + self.statesHud = 0 end -- TODO: deactivated until PR #1862 solved with issue #1886 - self.statesHud = 0 + --self.statesHud = 0 if ADGraphManager:getMapMarkerById(1) ~= nil then self.Target = ADGraphManager:getMapMarkerById(1).name diff --git a/FS19_AutoDrive/scripts/Manager/InputManager.lua b/FS19_AutoDrive/scripts/Manager/InputManager.lua index dbff2bc1..271e0924 100644 --- a/FS19_AutoDrive/scripts/Manager/InputManager.lua +++ b/FS19_AutoDrive/scripts/Manager/InputManager.lua @@ -22,8 +22,8 @@ ADInputManager.actionsToInputs = { AD_FieldSpeed_up = "input_increaseFieldSpeed", AD_FieldSpeed_down = "input_decreaseFieldSpeed", ADToggleHud = "input_toggleHud", - ADToggleMouse = "input_toggleMouse", - --COURSEPLAY_MOUSEACTION_SECONDARY = "input_toggleMouse", + ADToggleMouse = "input_toggleMouse", -- can be changed by AutoDrive:enableCPaction() + COURSEPLAY_MOUSEACTION_SECONDARY = "input_toggleMouse", -- can be changed by AutoDrive:enableCPaction() ADDebugDeleteWayPoint = "input_removeWaypoint", AD_routes_manager = "input_routesManager", ADSelectNextFillType = "input_nextFillType", From 259e54a3311c2d7589852e9774a895786a63ecd6 Mon Sep 17 00:00:00 2001 From: Dueesberch Date: Tue, 20 Apr 2021 18:24:30 +0200 Subject: [PATCH 03/46] bugfix 1886, mouse working --- FS19_AutoDrive/scripts/AutoDrive.lua | 9 +++++---- FS19_AutoDrive/scripts/Hud.lua | 2 -- FS19_AutoDrive/translations/translation_br.xml | 2 +- FS19_AutoDrive/translations/translation_cz.xml | 2 +- FS19_AutoDrive/translations/translation_de.xml | 2 +- FS19_AutoDrive/translations/translation_en.xml | 2 +- FS19_AutoDrive/translations/translation_es.xml | 2 +- FS19_AutoDrive/translations/translation_fr.xml | 2 +- FS19_AutoDrive/translations/translation_hu.xml | 2 +- FS19_AutoDrive/translations/translation_it.xml | 2 +- FS19_AutoDrive/translations/translation_nl.xml | 2 +- FS19_AutoDrive/translations/translation_pl.xml | 2 +- FS19_AutoDrive/translations/translation_pt.xml | 2 +- FS19_AutoDrive/translations/translation_ru.xml | 2 +- FS19_AutoDrive/translations/translation_tr.xml | 2 +- 15 files changed, 18 insertions(+), 19 deletions(-) diff --git a/FS19_AutoDrive/scripts/AutoDrive.lua b/FS19_AutoDrive/scripts/AutoDrive.lua index 6620a136..45c876a0 100644 --- a/FS19_AutoDrive/scripts/AutoDrive.lua +++ b/FS19_AutoDrive/scripts/AutoDrive.lua @@ -366,6 +366,7 @@ function AutoDrive:FarmStats_getStatisticData(superFunc) return Utils.getNoNil(self.statisticData, {}) end +-- disable / enable ADToggleMouse to get only one button to hanlde mouse function AutoDrive:enableCPaction(enableCPaction) local found = false if enableCPaction then @@ -384,16 +385,16 @@ function AutoDrive:enableCPaction(enableCPaction) table.insert(AutoDrive.actions, {"COURSEPLAY_MOUSEACTION_SECONDARY", true, 1}) end else - ADInputManager.actionsToInputs["COURSEPLAY_MOUSEACTION_SECONDARY"] = nil ADInputManager.actionsToInputs["ADToggleMouse"] = "input_toggleMouse" + ADInputManager.actionsToInputs["COURSEPLAY_MOUSEACTION_SECONDARY"] = nil for key, val in pairs(AutoDrive.actions) do - if val[1] == "COURSEPLAY_MOUSEACTION_SECONDARY" then - table.remove(AutoDrive.actions, key) - end if val[1] == "ADToggleMouse" then found = true end + if val[1] == "COURSEPLAY_MOUSEACTION_SECONDARY" then + table.remove(AutoDrive.actions, key) + end end if not found then table.insert(AutoDrive.actions, {"ADToggleMouse", true, 1}) diff --git a/FS19_AutoDrive/scripts/Hud.lua b/FS19_AutoDrive/scripts/Hud.lua index 4c7e92d1..2ec50851 100644 --- a/FS19_AutoDrive/scripts/Hud.lua +++ b/FS19_AutoDrive/scripts/Hud.lua @@ -152,8 +152,6 @@ function AutoDriveHud:createHudAt(hudX, hudY) AutoDrive:enableCPaction(false) self.statesHud = 0 end - -- TODO: deactivated until PR #1862 solved with issue #1886 - --self.statesHud = 0 if ADGraphManager:getMapMarkerById(1) ~= nil then self.Target = ADGraphManager:getMapMarkerById(1).name diff --git a/FS19_AutoDrive/translations/translation_br.xml b/FS19_AutoDrive/translations/translation_br.xml index 86470187..b60fa0a8 100644 --- a/FS19_AutoDrive/translations/translation_br.xml +++ b/FS19_AutoDrive/translations/translation_br.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_cz.xml b/FS19_AutoDrive/translations/translation_cz.xml index 9e77dfe8..378cd036 100644 --- a/FS19_AutoDrive/translations/translation_cz.xml +++ b/FS19_AutoDrive/translations/translation_cz.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_de.xml b/FS19_AutoDrive/translations/translation_de.xml index af533338..c5c8f04d 100644 --- a/FS19_AutoDrive/translations/translation_de.xml +++ b/FS19_AutoDrive/translations/translation_de.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_en.xml b/FS19_AutoDrive/translations/translation_en.xml index c6d3ec7d..2b6d4d05 100644 --- a/FS19_AutoDrive/translations/translation_en.xml +++ b/FS19_AutoDrive/translations/translation_en.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_es.xml b/FS19_AutoDrive/translations/translation_es.xml index e31749e2..b04da1b7 100644 --- a/FS19_AutoDrive/translations/translation_es.xml +++ b/FS19_AutoDrive/translations/translation_es.xml @@ -323,6 +323,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_fr.xml b/FS19_AutoDrive/translations/translation_fr.xml index b344ec0d..89427a01 100644 --- a/FS19_AutoDrive/translations/translation_fr.xml +++ b/FS19_AutoDrive/translations/translation_fr.xml @@ -327,7 +327,7 @@ - + diff --git a/FS19_AutoDrive/translations/translation_hu.xml b/FS19_AutoDrive/translations/translation_hu.xml index 8d60e5f2..b5959ffe 100644 --- a/FS19_AutoDrive/translations/translation_hu.xml +++ b/FS19_AutoDrive/translations/translation_hu.xml @@ -304,6 +304,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_it.xml b/FS19_AutoDrive/translations/translation_it.xml index ed1f5309..81671b74 100644 --- a/FS19_AutoDrive/translations/translation_it.xml +++ b/FS19_AutoDrive/translations/translation_it.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_nl.xml b/FS19_AutoDrive/translations/translation_nl.xml index 2e7666fa..e622c09c 100644 --- a/FS19_AutoDrive/translations/translation_nl.xml +++ b/FS19_AutoDrive/translations/translation_nl.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_pl.xml b/FS19_AutoDrive/translations/translation_pl.xml index 44a93689..9a9f3049 100644 --- a/FS19_AutoDrive/translations/translation_pl.xml +++ b/FS19_AutoDrive/translations/translation_pl.xml @@ -324,6 +324,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_pt.xml b/FS19_AutoDrive/translations/translation_pt.xml index 770daf0a..5f9f04c7 100644 --- a/FS19_AutoDrive/translations/translation_pt.xml +++ b/FS19_AutoDrive/translations/translation_pt.xml @@ -328,6 +328,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_ru.xml b/FS19_AutoDrive/translations/translation_ru.xml index 3b3dce18..f12abf20 100644 --- a/FS19_AutoDrive/translations/translation_ru.xml +++ b/FS19_AutoDrive/translations/translation_ru.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_tr.xml b/FS19_AutoDrive/translations/translation_tr.xml index c08fe327..5928be2b 100644 --- a/FS19_AutoDrive/translations/translation_tr.xml +++ b/FS19_AutoDrive/translations/translation_tr.xml @@ -323,7 +323,7 @@ - + From b3e2d33a306407fbb9904bae29e0a4f7c9ca2449 Mon Sep 17 00:00:00 2001 From: Dueesberch Date: Tue, 20 Apr 2021 21:56:21 +0200 Subject: [PATCH 04/46] rework tooltip text --- FS19_AutoDrive/translations/translation_br.xml | 2 +- FS19_AutoDrive/translations/translation_cz.xml | 2 +- FS19_AutoDrive/translations/translation_de.xml | 2 +- FS19_AutoDrive/translations/translation_en.xml | 2 +- FS19_AutoDrive/translations/translation_es.xml | 2 +- FS19_AutoDrive/translations/translation_fr.xml | 2 +- FS19_AutoDrive/translations/translation_hu.xml | 2 +- FS19_AutoDrive/translations/translation_it.xml | 2 +- FS19_AutoDrive/translations/translation_nl.xml | 2 +- FS19_AutoDrive/translations/translation_pl.xml | 2 +- FS19_AutoDrive/translations/translation_pt.xml | 2 +- FS19_AutoDrive/translations/translation_ru.xml | 2 +- FS19_AutoDrive/translations/translation_tr.xml | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/FS19_AutoDrive/translations/translation_br.xml b/FS19_AutoDrive/translations/translation_br.xml index b60fa0a8..8092d130 100644 --- a/FS19_AutoDrive/translations/translation_br.xml +++ b/FS19_AutoDrive/translations/translation_br.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_cz.xml b/FS19_AutoDrive/translations/translation_cz.xml index 378cd036..1324e513 100644 --- a/FS19_AutoDrive/translations/translation_cz.xml +++ b/FS19_AutoDrive/translations/translation_cz.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_de.xml b/FS19_AutoDrive/translations/translation_de.xml index c5c8f04d..a5b68028 100644 --- a/FS19_AutoDrive/translations/translation_de.xml +++ b/FS19_AutoDrive/translations/translation_de.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_en.xml b/FS19_AutoDrive/translations/translation_en.xml index 2b6d4d05..b876d137 100644 --- a/FS19_AutoDrive/translations/translation_en.xml +++ b/FS19_AutoDrive/translations/translation_en.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_es.xml b/FS19_AutoDrive/translations/translation_es.xml index b04da1b7..f9bf4042 100644 --- a/FS19_AutoDrive/translations/translation_es.xml +++ b/FS19_AutoDrive/translations/translation_es.xml @@ -323,6 +323,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_fr.xml b/FS19_AutoDrive/translations/translation_fr.xml index 89427a01..db99c61e 100644 --- a/FS19_AutoDrive/translations/translation_fr.xml +++ b/FS19_AutoDrive/translations/translation_fr.xml @@ -327,7 +327,7 @@ - + diff --git a/FS19_AutoDrive/translations/translation_hu.xml b/FS19_AutoDrive/translations/translation_hu.xml index b5959ffe..05564d48 100644 --- a/FS19_AutoDrive/translations/translation_hu.xml +++ b/FS19_AutoDrive/translations/translation_hu.xml @@ -304,6 +304,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_it.xml b/FS19_AutoDrive/translations/translation_it.xml index 81671b74..c665ad25 100644 --- a/FS19_AutoDrive/translations/translation_it.xml +++ b/FS19_AutoDrive/translations/translation_it.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_nl.xml b/FS19_AutoDrive/translations/translation_nl.xml index e622c09c..a54e4089 100644 --- a/FS19_AutoDrive/translations/translation_nl.xml +++ b/FS19_AutoDrive/translations/translation_nl.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_pl.xml b/FS19_AutoDrive/translations/translation_pl.xml index 9a9f3049..2fa8764e 100644 --- a/FS19_AutoDrive/translations/translation_pl.xml +++ b/FS19_AutoDrive/translations/translation_pl.xml @@ -324,6 +324,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_pt.xml b/FS19_AutoDrive/translations/translation_pt.xml index 5f9f04c7..3c9b2f4d 100644 --- a/FS19_AutoDrive/translations/translation_pt.xml +++ b/FS19_AutoDrive/translations/translation_pt.xml @@ -328,6 +328,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_ru.xml b/FS19_AutoDrive/translations/translation_ru.xml index f12abf20..a4d130b8 100644 --- a/FS19_AutoDrive/translations/translation_ru.xml +++ b/FS19_AutoDrive/translations/translation_ru.xml @@ -325,6 +325,6 @@ - + diff --git a/FS19_AutoDrive/translations/translation_tr.xml b/FS19_AutoDrive/translations/translation_tr.xml index 5928be2b..83f4f871 100644 --- a/FS19_AutoDrive/translations/translation_tr.xml +++ b/FS19_AutoDrive/translations/translation_tr.xml @@ -323,7 +323,7 @@ - + From c6605a67ca5d63082be295be7ce78b406728891b Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Sun, 9 May 2021 18:29:45 +0200 Subject: [PATCH 05/46] Fixed debug marker issue caused by telemetryExport --- FS19_AutoDrive/scripts/ExternalInterface.lua | 1 + FS19_AutoDrive/scripts/TelemetryExport.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/FS19_AutoDrive/scripts/ExternalInterface.lua b/FS19_AutoDrive/scripts/ExternalInterface.lua index 23f7e94a..17cae7dd 100644 --- a/FS19_AutoDrive/scripts/ExternalInterface.lua +++ b/FS19_AutoDrive/scripts/ExternalInterface.lua @@ -195,6 +195,7 @@ function AutoDrive:notifyDestinationListeners() for object, callBackFunction in pairs(AutoDrive.destinationListeners) do callBackFunction(object, true) end + AutoDrive.triggerStaticOutput() end function AutoDrive:combineIsCallingDriver(combine) --only for CoursePlay diff --git a/FS19_AutoDrive/scripts/TelemetryExport.lua b/FS19_AutoDrive/scripts/TelemetryExport.lua index f9ae3277..e74fe90f 100644 --- a/FS19_AutoDrive/scripts/TelemetryExport.lua +++ b/FS19_AutoDrive/scripts/TelemetryExport.lua @@ -19,7 +19,7 @@ function AutoDrive.initTelemetry() g_logManager:info("[AD] AutoDrive.xmlFileName_telemetry " .. AutoDrive.xmlFileName_telemetry) - AutoDrive:registerDestinationListener(AutoDrive, AutoDrive.triggerStaticOutput) + --AutoDrive:registerDestinationListener(AutoDrive, AutoDrive.triggerStaticOutput) end function AutoDrive.triggerStaticOutput() From 8f9d8db5b1540f271eb448ed7d5a98bddd884a7f Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Sun, 9 May 2021 18:30:29 +0200 Subject: [PATCH 06/46] Added subPrio recording. Started by mousewheel up on the record button for now. --- .../Events/Graph/RecordWayPointEvent.lua | 11 ++- .../scripts/Gui/EnterGroupNameGUI.lua | 5 +- FS19_AutoDrive/scripts/Hud.lua | 55 ++++++++------ FS19_AutoDrive/scripts/Hud/HudButton.lua | 10 ++- .../scripts/Manager/GraphManager.lua | 71 +++++++++++++++++- .../scripts/Manager/InputManager.lua | 16 +++- .../scripts/Modules/RecordingModule.lua | 10 ++- .../scripts/Modules/StateModule.lua | 19 ++++- FS19_AutoDrive/scripts/Specialization.lua | 42 +++++++---- FS19_AutoDrive/textures/input_record_4.dds | Bin 0 -> 16512 bytes 10 files changed, 177 insertions(+), 62 deletions(-) create mode 100644 FS19_AutoDrive/textures/input_record_4.dds diff --git a/FS19_AutoDrive/scripts/Events/Graph/RecordWayPointEvent.lua b/FS19_AutoDrive/scripts/Events/Graph/RecordWayPointEvent.lua index 93e44c80..2c10fda5 100644 --- a/FS19_AutoDrive/scripts/Events/Graph/RecordWayPointEvent.lua +++ b/FS19_AutoDrive/scripts/Events/Graph/RecordWayPointEvent.lua @@ -9,7 +9,7 @@ function AutoDriveRecordWayPointEvent:emptyNew() return o end -function AutoDriveRecordWayPointEvent:new(x, y, z, connectPrevious, dual, isReverse, previousId) +function AutoDriveRecordWayPointEvent:new(x, y, z, connectPrevious, dual, isReverse, isSubPrio, previousId) local o = AutoDriveRecordWayPointEvent:emptyNew() o.x = x o.y = y @@ -18,6 +18,7 @@ function AutoDriveRecordWayPointEvent:new(x, y, z, connectPrevious, dual, isReve o.dual = dual or false o.isReverse = isReverse o.previousId = previousId + o.isSubPrio = isSubPrio return o end @@ -29,6 +30,7 @@ function AutoDriveRecordWayPointEvent:writeStream(streamId, connection) streamWriteBool(streamId, self.dual) streamWriteBool(streamId, self.isReverse) streamWriteFloat32(streamId, self.previousId) + streamWriteBool(streamId, self.isSubPrio) end function AutoDriveRecordWayPointEvent:readStream(streamId, connection) @@ -39,19 +41,20 @@ function AutoDriveRecordWayPointEvent:readStream(streamId, connection) self.dual = streamReadBool(streamId) self.isReverse = streamReadBool(streamId) self.previousId = streamReadFloat32(streamId) + self.isSubPrio = streamReadBool(streamId) self:run(connection) end function AutoDriveRecordWayPointEvent:run(connection) if connection:getIsServer() then -- If the event is coming from the server, clients have to record the way point - ADGraphManager:recordWayPoint(self.x, self.y, self.z, self.connectPrevious, self.dual, self.isReverse, self.previousId, false) + ADGraphManager:recordWayPoint(self.x, self.y, self.z, self.connectPrevious, self.dual, self.isReverse, self.previousId, self.isSubPrio, false) end end -function AutoDriveRecordWayPointEvent.sendEvent(x, y, z, connectPrevious, dual, isReverse, previousId) +function AutoDriveRecordWayPointEvent.sendEvent(x, y, z, connectPrevious, dual, isReverse, previousId, isSubPrio) if g_server ~= nil then -- Server have to broadcast to all clients - g_server:broadcastEvent(AutoDriveRecordWayPointEvent:new(x, y, z, connectPrevious, dual, isReverse, previousId)) + g_server:broadcastEvent(AutoDriveRecordWayPointEvent:new(x, y, z, connectPrevious, dual, isReverse, previousId, isSubPrio)) end end diff --git a/FS19_AutoDrive/scripts/Gui/EnterGroupNameGUI.lua b/FS19_AutoDrive/scripts/Gui/EnterGroupNameGUI.lua index ce526c92..d8c5006e 100644 --- a/FS19_AutoDrive/scripts/Gui/EnterGroupNameGUI.lua +++ b/FS19_AutoDrive/scripts/Gui/EnterGroupNameGUI.lua @@ -27,10 +27,7 @@ end function ADEnterGroupNameGui:onClickOk() ADEnterGroupNameGui:superClass().onClickOk(self) - if self.textInputElement.text ~= ADGraphManager.debugGroupName then - -- do not allow user to create debug group - ADGraphManager:addGroup(self.textInputElement.text) - end + ADGraphManager:addGroup(self.textInputElement.text) self:onClickBack() end diff --git a/FS19_AutoDrive/scripts/Hud.lua b/FS19_AutoDrive/scripts/Hud.lua index 4fff5407..ffe621de 100644 --- a/FS19_AutoDrive/scripts/Hud.lua +++ b/FS19_AutoDrive/scripts/Hud.lua @@ -169,7 +169,7 @@ function AutoDriveHud:createHudAt(hudX, hudY) local posX = self.posX + self.width - (closeWidth * 1.1) local posY = self.rowHeader -- close crossing - table.insert(self.hudElements, ADHudButton:new(posX, posY, closeWidth, closeHeight, "input_toggleHud", nil, "", 1, true)) + table.insert(self.hudElements, ADHudButton:new(posX, posY, closeWidth, closeHeight, "input_toggleHud", nil, nil, "", 1, true)) -- axel - is this used? table.insert(self.hudElements, ADHudIcon:new(self.posX, self.row4, self.iconWidth, self.iconHeight, AutoDrive.directory .. "textures/destination.dds", 1, "destinationOverlay")) @@ -196,18 +196,18 @@ function AutoDriveHud:createHudAt(hudX, hudY) ) -------- BASE ROW BUTTONS -------------- - self:AddButton("input_start_stop", nil, "input_ADEnDisable", 1, true) - self:AddButton("input_silomode", "input_previousMode", "input_ADSilomode", 1, true) - self:AddButton("input_continue", nil, "input_AD_continue", 1, true) - self:AddButton("input_parkVehicle", "input_setParkDestination", "input_ADParkVehicle", 1, true) - self:AddButton("input_incLoopCounter", "input_decLoopCounter", "input_ADIncLoopCounter", 1, true) + self:AddButton("input_start_stop", nil, nil, "input_ADEnDisable", 1, true) + self:AddButton("input_silomode", "input_previousMode", nil, "input_ADSilomode", 1, true) + self:AddButton("input_continue", nil, nil, "input_AD_continue", 1, true) + self:AddButton("input_parkVehicle", nil, "input_setParkDestination", "input_ADParkVehicle", 1, true) + self:AddButton("input_incLoopCounter", nil, "input_decLoopCounter", "input_ADIncLoopCounter", 1, true) local speedX = self.posX + (self.cols - 1 + self.buttonCollOffset) * self.borderX + (self.cols - 2 + self.buttonCollOffset) * self.buttonWidth local speedY = self.posY + (1) * self.borderY + (0) * self.buttonHeight table.insert(self.hudElements, ADHudSpeedmeter:new(speedX, speedY, self.buttonWidth, self.buttonHeight, false)) self.buttonCounter = self.buttonCounter + 1 - self:AddButton("input_debug", "input_displayMapPoints", "input_ADActivateDebug", 1, true) + self:AddButton("input_debug", "input_displayMapPoints", nil, "input_ADActivateDebug", 1, true) -------------------------------------------------- ---------- SECOND ROW BUTTONS --------------------- @@ -222,10 +222,10 @@ function AutoDriveHud:createHudAt(hudX, hudY) self:AddEditModeButtons() if g_courseplay ~= nil then self.buttonCounter = self.buttonCounter - 1 - self:AddButton("input_startCp", "input_toggleCP_AIVE", "hud_startCp", 1, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 1, true) elseif (vehicle ~= nil and vehicle.acParameters ~= nil) then self.buttonCounter = self.buttonCounter - 1 - self:AddButton("input_startCp", "input_toggleCP_AIVE", "hud_startCp", 3, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 3, true) end end @@ -234,16 +234,16 @@ function AutoDriveHud:createHudAt(hudX, hudY) table.insert(self.hudElements, ADHudSpeedmeter:new(speedX, speedY, self.buttonWidth, self.buttonHeight, true)) self.buttonCounter = self.buttonCounter + 1 - self:AddButton("input_openGUI", nil, "input_ADOpenGUI", 1, true) + self:AddButton("input_openGUI", nil, nil, "input_ADOpenGUI", 1, true) else self:AddEditModeButtons() if AutoDrive.getSetting("addSettingsToHUD") then self.buttonCounter = self.buttonCounter - 5 if g_courseplay ~= nil then - self:AddButton("input_startCp", "input_toggleCP_AIVE", "hud_startCp", 1, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 1, true) elseif (vehicle ~= nil and vehicle.acParameters ~= nil) then - self:AddButton("input_startCp", "input_toggleCP_AIVE", "hud_startCp", 3, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 3, true) else self:AddSettingsButton("enableTrafficDetection", "gui_ad_enableTrafficDetection", 1, true) end @@ -255,10 +255,10 @@ function AutoDriveHud:createHudAt(hudX, hudY) else if g_courseplay ~= nil then self.buttonCounter = self.buttonCounter - 1 - self:AddButton("input_startCp", "input_toggleCP_AIVE", "hud_startCp", 1, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 1, true) elseif (vehicle ~= nil and vehicle.acParameters ~= nil) then self.buttonCounter = self.buttonCounter - 1 - self:AddButton("input_startCp", "input_toggleCP_AIVE", "hud_startCp", 3, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 3, true) end end @@ -267,7 +267,7 @@ function AutoDriveHud:createHudAt(hudX, hudY) table.insert(self.hudElements, ADHudSpeedmeter:new(speedX, speedY, self.buttonWidth, self.buttonHeight, true)) self.buttonCounter = self.buttonCounter + 1 - self:AddButton("input_openGUI", nil, "input_ADOpenGUI", 1, true) + self:AddButton("input_openGUI", nil, nil, "input_ADOpenGUI", 1, true) end -------------------------------------------------- @@ -276,9 +276,9 @@ function AutoDriveHud:createHudAt(hudX, hudY) self:AddEditModeButtons() if g_courseplay ~= nil then - self:AddButton("input_startCp", "input_toggleCP_AIVE", "hud_startCp", 1, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 1, true) elseif (vehicle ~= nil and vehicle.acParameters ~= nil) then - self:AddButton("input_startCp", "input_toggleCP_AIVE", "hud_startCp", 3, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 3, true) end end @@ -287,17 +287,17 @@ function AutoDriveHud:createHudAt(hudX, hudY) end function AutoDriveHud:AddEditModeButtons() - self:AddButton("input_record", "input_record_dual", "input_ADRecord", 1, false) - self:AddButton("input_routesManager", nil, "input_AD_routes_manager", 1, false) - self:AddButton("input_createMapMarker", nil, "input_ADDebugCreateMapMarker", 1, false) - self:AddButton("input_removeWaypoint", "input_removeMapMarker", "input_ADDebugDeleteWayPoint", 1, false) - self:AddButton("input_editMapMarker", nil, "input_ADRenameMapMarker", 1, false) + self:AddButton("input_record", "input_record_dual", "input_record_subPrio", "input_ADRecord", 1, false) + self:AddButton("input_routesManager", nil, nil, "input_AD_routes_manager", 1, false) + self:AddButton("input_createMapMarker", nil, nil, "input_ADDebugCreateMapMarker", 1, false) + self:AddButton("input_removeWaypoint", "input_removeMapMarker", nil, "input_ADDebugDeleteWayPoint", 1, false) + self:AddButton("input_editMapMarker", nil, nil, "input_ADRenameMapMarker", 1, false) if AutoDrive.getSetting("wideHUD") and AutoDrive.getSetting("addSettingsToHUD") then - self:AddButton("input_removeMapMarker", nil, "input_ADDebugDeleteDestination", 1, false) + self:AddButton("input_removeMapMarker", nil, nil, "input_ADDebugDeleteDestination", 1, false) end end -function AutoDriveHud:AddButton(primaryAction, secondaryAction, toolTip, state, visible) +function AutoDriveHud:AddButton(primaryAction, secondaryAction, tertiaryAction, toolTip, state, visible) self.buttonCounter = self.buttonCounter + 1 self.colCurrent = self.buttonCounter % self.cols if self.colCurrent == 0 then @@ -309,7 +309,7 @@ function AutoDriveHud:AddButton(primaryAction, secondaryAction, toolTip, state, local posX = self.posX + self.colCurrent * self.borderX + (self.colCurrent - 1) * self.buttonWidth local posY = self.posY + (self.rowCurrent) * self.borderY + (self.rowCurrent - 1) * self.buttonHeight --toolTip = string.sub(g_i18n:getText(toolTip), 4, string.len(g_i18n:getText(toolTip))) - table.insert(self.hudElements, ADHudButton:new(posX, posY, self.buttonWidth, self.buttonHeight, primaryAction, secondaryAction, toolTip, state, visible)) + table.insert(self.hudElements, ADHudButton:new(posX, posY, self.buttonWidth, self.buttonHeight, primaryAction, secondaryAction, tertiaryAction, toolTip, state, visible)) end function AutoDriveHud:AddSettingsButton(setting, toolTip, state, visible) @@ -504,6 +504,11 @@ function AutoDriveHud:mouseEvent(vehicle, posX, posY, isDown, isUp, button) vehicle.ad.selectedNodeId = vehicle.ad.newcreated end + if button == 1 and isUp and AutoDrive.leftALTmodifierKeyPressed and AutoDrive.leftCTRLmodifierKeyPressed and vehicle.ad.hoveredNodeId ~= nil then + g_logManager:info("[AD]toggling subPrio marker now for " .. vehicle.ad.hoveredNodeId) + ADGraphManager:toggleWayPointAsSubPrio(vehicle.ad.hoveredNodeId) + end + --If no node is hovered / moved - create new node if vehicle.ad.nodeToMoveId == nil and vehicle.ad.hoveredNodeId == nil then if button == 1 and isUp and not AutoDrive.leftALTmodifierKeyPressed and AutoDrive.leftCTRLmodifierKeyPressed then diff --git a/FS19_AutoDrive/scripts/Hud/HudButton.lua b/FS19_AutoDrive/scripts/Hud/HudButton.lua index 8ce5b521..30a2a9b0 100644 --- a/FS19_AutoDrive/scripts/Hud/HudButton.lua +++ b/FS19_AutoDrive/scripts/Hud/HudButton.lua @@ -1,10 +1,11 @@ ADHudButton = ADInheritsFrom(ADGenericHudElement) -function ADHudButton:new(posX, posY, width, height, primaryAction, secondaryAction, toolTip, state, visible) +function ADHudButton:new(posX, posY, width, height, primaryAction, secondaryAction, tertiaryAction, toolTip, state, visible) local o = ADHudButton:create() o:init(posX, posY, width, height) o.primaryAction = primaryAction o.secondaryAction = secondaryAction + o.tertiaryAction = tertiaryAction o.toolTip = toolTip o.state = state o.isVisible = visible @@ -65,6 +66,9 @@ function ADHudButton:getNewState(vehicle) if vehicle.ad.stateModule:isInDualCreationMode() then newState = 3 end + if vehicle.ad.stateModule:isInSubPrioCreationMode() then + newState = 4 + end else newState = 1 end @@ -197,6 +201,10 @@ function ADHudButton:act(vehicle, posX, posY, isDown, isUp, button) elseif (button == 3 or button == 2) and isUp then ADInputManager:onInputCall(vehicle, self.secondaryAction) return true + elseif button == 4 and isUp then + ADInputManager:onInputCall(vehicle, self.tertiaryAction) + AutoDrive.mouseWheelActive = true + return true end end diff --git a/FS19_AutoDrive/scripts/Manager/GraphManager.lua b/FS19_AutoDrive/scripts/Manager/GraphManager.lua index 80d00463..0f086d36 100644 --- a/FS19_AutoDrive/scripts/Manager/GraphManager.lua +++ b/FS19_AutoDrive/scripts/Manager/GraphManager.lua @@ -1,6 +1,7 @@ ADGraphManager = {} ADGraphManager.debugGroupName = "AD_Debug" +ADGraphManager.SUB_PRIO_FACTOR = 20 function ADGraphManager:load() self.wayPoints = {} @@ -336,7 +337,7 @@ function ADGraphManager:createMapMarker(markerId, markerName, sendEvent) end function ADGraphManager:addGroup(groupName, sendEvent) - if groupName:len() > 1 and self.groups[groupName] == nil then + if groupName:len() > 1 and self.groups[groupName] == nil and groupName ~= ADGraphManager.debugGroupName then if sendEvent == nil or sendEvent == true then -- Propagating group creation all over the network AutoDriveGroupsEvent.sendEvent(groupName, AutoDriveGroupsEvent.TYPE_ADD) @@ -535,6 +536,8 @@ function ADGraphManager:createWayPoint(x, y, z, sendEvent) local newWp = self:createNode(newId, x, y, z, {}, {}) self:setWayPoint(newWp) self:markChanges() + + return newWp end end @@ -560,7 +563,7 @@ function ADGraphManager:moveWayPoint(wayPonitId, x, y, z, sendEvent) end end -function ADGraphManager:recordWayPoint(x, y, z, connectPrevious, dual, isReverse, previousId, sendEvent) +function ADGraphManager:recordWayPoint(x, y, z, connectPrevious, dual, isReverse, previousId, isSubPrio, sendEvent) previousId = previousId or 0 local previous if connectPrevious then @@ -572,7 +575,7 @@ function ADGraphManager:recordWayPoint(x, y, z, connectPrevious, dual, isReverse if g_server ~= nil then if sendEvent ~= false then -- Propagating waypoint recording to clients - AutoDriveRecordWayPointEvent.sendEvent(x, y, z, connectPrevious, dual, isReverse, previousId) + AutoDriveRecordWayPointEvent.sendEvent(x, y, z, connectPrevious, dual, isReverse, previousId, isSubPrio) end else if sendEvent ~= false then @@ -589,6 +592,11 @@ function ADGraphManager:recordWayPoint(x, y, z, connectPrevious, dual, isReverse self:toggleConnectionBetween(newWp, previous, isReverse, false) end end + + if isSubPrio then + self:toggleWayPointAsSubPrio(newId) + end + self:markChanges() return newWp end @@ -626,6 +634,10 @@ function ADGraphManager:getDistanceBetweenNodes(start, target) end end + if self:getIsPointSubPrio(self.wayPoints[target].id) then + distance = distance * ADGraphManager.SUB_PRIO_FACTOR + end + return distance end @@ -982,7 +994,6 @@ function ADGraphManager:createDebugMarkers(updateMap) end end - function ADGraphManager:checkForWrongReverseStart(wp_ref, wp_current, wp_ahead) local reverseStart = false @@ -1002,3 +1013,55 @@ function ADGraphManager:checkForWrongReverseStart(wp_ref, wp_current, wp_ahead) return reverseStart end + +function ADGraphManager:toggleWayPointAsSubPrio(wayPointId) + local wayPoint = self:getWayPointById(wayPointId) + if wayPoint ~= nil then + -- check if debug node for subPrio exists + local subPrioNode = self:getSubPrioMarkerNode() + + self:toggleConnectionBetween(wayPoint, subPrioNode, false) + end +end + +function ADGraphManager:getSubPrioMarkerNode() + if self.subPrioMarkerNode == nil then + for _, wp in pairs(self.wayPoints) do + if self:getIsPointSubPrioMarker(wp.id) then + self.subPrioMarkerNode = wp + break + end + end + end + + if self.subPrioMarkerNode == nil then + self.subPrioMarkerNode = self:createWayPoint(-1, -1, -1) + end + + return self.subPrioMarkerNode +end + +function ADGraphManager:getIsPointSubPrio(wayPointId) + local wayPoint = self:getWayPointById(wayPointId) + + for _, neighborId in pairs(wayPoint.out) do + local neighbor = ADGraphManager:getWayPointById(neighborId) + if neighbor ~= nil then + if neighbor.id == self:getSubPrioMarkerNode().id then + return true + end + end + end + + return false +end + +function ADGraphManager:getIsPointSubPrioMarker(wayPointId) + local wayPoint = self:getWayPointById(wayPointId) + + if wayPoint.x >= -1.01 and wayPoint.x <= -0.99 and wayPoint.z >= -1.01 and wayPoint.z <= -0.99 then + return true + end + + return false +end diff --git a/FS19_AutoDrive/scripts/Manager/InputManager.lua b/FS19_AutoDrive/scripts/Manager/InputManager.lua index 83626be8..4735788b 100644 --- a/FS19_AutoDrive/scripts/Manager/InputManager.lua +++ b/FS19_AutoDrive/scripts/Manager/InputManager.lua @@ -4,6 +4,7 @@ ADInputManager.actionsToInputs = { ADSilomode = "input_silomode", ADRecord = "input_record", ADRecord_Dual = "input_record_dual", + ADRecord_SubPrio = "input_record_subPrio", ADEnDisable = "input_start_stop", ADSelectTarget = "input_nextTarget", ADSelectPreviousTarget = "input_previousTarget", @@ -71,7 +72,8 @@ ADInputManager.inputsToIds = { input_nextTarget = 23, input_previousTarget = 24, input_startCp = 25, - input_toggleCP_AIVE = 26 + input_toggleCP_AIVE = 26, + input_record_subPrio = 27 } ADInputManager.idsToInputs = {} @@ -257,7 +259,7 @@ function ADInputManager:input_previousMode(vehicle) end function ADInputManager:input_record(vehicle) - if not vehicle.ad.stateModule:isInCreationMode() and not vehicle.ad.stateModule:isInDualCreationMode() then + if not vehicle.ad.stateModule:isInCreationMode() and not vehicle.ad.stateModule:isInDualCreationMode() and not vehicle.ad.stateModule:isInSubPrioCreationMode() then vehicle.ad.stateModule:startNormalCreationMode() else vehicle.ad.stateModule:disableCreationMode() @@ -265,13 +267,21 @@ function ADInputManager:input_record(vehicle) end function ADInputManager:input_record_dual(vehicle) - if not vehicle.ad.stateModule:isInCreationMode() and not vehicle.ad.stateModule:isInDualCreationMode() then + if not vehicle.ad.stateModule:isInCreationMode() and not vehicle.ad.stateModule:isInDualCreationMode() and not vehicle.ad.stateModule:isInSubPrioCreationMode() then vehicle.ad.stateModule:startDualCreationMode() else vehicle.ad.stateModule:disableCreationMode() end end +function ADInputManager:input_record_subPrio(vehicle) + if not vehicle.ad.stateModule:isInCreationMode() and not vehicle.ad.stateModule:isInDualCreationMode() and not vehicle.ad.stateModule:isInSubPrioCreationMode() then + vehicle.ad.stateModule:startSubPrioCreationMode() + else + vehicle.ad.stateModule:disableCreationMode() + end +end + function ADInputManager:input_debug(vehicle) AutoDrive.cycleEditMode() end diff --git a/FS19_AutoDrive/scripts/Modules/RecordingModule.lua b/FS19_AutoDrive/scripts/Modules/RecordingModule.lua index 4e35ea65..fe49dce1 100644 --- a/FS19_AutoDrive/scripts/Modules/RecordingModule.lua +++ b/FS19_AutoDrive/scripts/Modules/RecordingModule.lua @@ -10,11 +10,13 @@ function ADRecordingModule:new(vehicle) o.lastWp = nil o.secondLastWp = nil o.isRecordingReverse = false + o.isSubPrio = false return o end -function ADRecordingModule:start(dual) +function ADRecordingModule:start(dual, subPrio) self.isDual = dual + self.isSubPrio = subPrio self.vehicle:stopAutoDrive() local rearOffset = 0 @@ -28,7 +30,7 @@ function ADRecordingModule:start(dual) if self.drivingReverse then x1, y1, z1 = localToWorld(self.vehicle.ad.specialDrivingModule:getReverseNode(), 0, 0, rearOffset) end - self.lastWp = ADGraphManager:recordWayPoint(x1, y1, z1, false, false, self.drivingReverse) + self.lastWp = ADGraphManager:recordWayPoint(x1, y1, z1, false, false, self.drivingReverse, 0, self.isSubPrio) self.lastWpPosition = {} self.lastWpPosition.x, self.lastWpPosition.y, self.lastWpPosition.z = getWorldTranslation(self.vehicle.components[1].node) @@ -114,7 +116,7 @@ function ADRecordingModule:updateTick(dt, isActiveForInput, isActiveForInputIgno if self.secondLastWp == nil then if MathUtil.vector2Length(x - self.lastWp.x, z - self.lastWp.z) > 3 and MathUtil.vector2Length(vehicleX - self.lastWp.x, vehicleZ - self.lastWp.z) > 3 then self.secondLastWp = self.lastWp - self.lastWp = ADGraphManager:recordWayPoint(x, y, z, true, self.isDual, self.drivingReverse, self.secondLastWp.id) + self.lastWp = ADGraphManager:recordWayPoint(x, y, z, true, self.isDual, self.drivingReverse, self.secondLastWp.id, self.isSubPrio) self.lastWpPosition.x, self.lastWpPosition.y, self.lastWpPosition.z = getWorldTranslation(self.vehicle.components[1].node) self.isRecordingReverse = self.drivingReverse end @@ -145,7 +147,7 @@ function ADRecordingModule:updateTick(dt, isActiveForInput, isActiveForInputIgno if MathUtil.vector2Length(x - self.lastWp.x, z - self.lastWp.z) > max_distance and minDistanceToLastWayPoint and speedMatchesRecording then self.secondLastWp = self.lastWp - self.lastWp = ADGraphManager:recordWayPoint(x, y, z, true, self.isDual, self.drivingReverse, self.secondLastWp.id) + self.lastWp = ADGraphManager:recordWayPoint(x, y, z, true, self.isDual, self.drivingReverse, self.secondLastWp.id, self.isSubPrio) self.lastWpPosition.x, self.lastWpPosition.y, self.lastWpPosition.z = getWorldTranslation(self.vehicle.components[1].node) self.isRecordingReverse = self.drivingReverse end diff --git a/FS19_AutoDrive/scripts/Modules/StateModule.lua b/FS19_AutoDrive/scripts/Modules/StateModule.lua index be29a841..834b3d69 100644 --- a/FS19_AutoDrive/scripts/Modules/StateModule.lua +++ b/FS19_AutoDrive/scripts/Modules/StateModule.lua @@ -3,6 +3,7 @@ ADStateModule = {} ADStateModule.CREATE_OFF = 1 ADStateModule.CREATE_NORMAL = 2 ADStateModule.CREATE_DUAL = 3 +ADStateModule.CREATE_SUB_PRIO = 4 ADStateModule.CALCULATE_REMAINING_DRIVETIME_INTERVAL = 1000 @@ -431,7 +432,7 @@ function ADStateModule:setActive(active) end function ADStateModule:isInCreationMode() - return (self.creationMode == ADStateModule.CREATE_NORMAL) or (self.creationMode == ADStateModule.CREATE_DUAL) + return (self.creationMode == ADStateModule.CREATE_NORMAL) or (self.creationMode == ADStateModule.CREATE_DUAL) or (self.creationMode == ADStateModule.CREATE_SUB_PRIO) end function ADStateModule:isInNormalCreationMode() @@ -442,6 +443,10 @@ function ADStateModule:isInDualCreationMode() return self.creationMode == ADStateModule.CREATE_DUAL end +function ADStateModule:isInSubPrioCreationMode() + return self.creationMode == ADStateModule.CREATE_SUB_PRIO +end + function ADStateModule:disableCreationMode() self.creationMode = ADStateModule.CREATE_OFF self:raiseDirtyFlag() @@ -454,7 +459,7 @@ function ADStateModule:startNormalCreationMode() self.creationMode = ADStateModule.CREATE_NORMAL self:raiseDirtyFlag() if self.vehicle.ad.recordingModule ~= nil then - self.vehicle.ad.recordingModule:start(false) + self.vehicle.ad.recordingModule:start(false, false) end end @@ -462,7 +467,15 @@ function ADStateModule:startDualCreationMode() self.creationMode = ADStateModule.CREATE_DUAL self:raiseDirtyFlag() if self.vehicle.ad.recordingModule ~= nil then - self.vehicle.ad.recordingModule:start(true) + self.vehicle.ad.recordingModule:start(true, false) + end +end + +function ADStateModule:startSubPrioCreationMode() + self.creationMode = ADStateModule.CREATE_SUB_PRIO + self:raiseDirtyFlag() + if self.vehicle.ad.recordingModule ~= nil then + self.vehicle.ad.recordingModule:start(false, true) end end diff --git a/FS19_AutoDrive/scripts/Specialization.lua b/FS19_AutoDrive/scripts/Specialization.lua index 9ccd4001..74d6211a 100644 --- a/FS19_AutoDrive/scripts/Specialization.lua +++ b/FS19_AutoDrive/scripts/Specialization.lua @@ -532,6 +532,8 @@ function AutoDrive:onDrawEditorMode() local x = point.x local y = point.y local z = point.z + local isSubPrio = ADGraphManager:getIsPointSubPrio(point.id) + if AutoDrive.isInExtendedEditorMode() then arrowPosition = DrawingManager.arrows.position.middle if AutoDrive.enableSphrere == true then @@ -585,21 +587,33 @@ function AutoDrive:onDrawEditorMode() table.insert(outPointsSeen, neighbor) local target = ADGraphManager:getWayPointById(neighbor) if target ~= nil then - --check if outgoing connection is a dual way connection - local nWp = ADGraphManager:getWayPointById(neighbor) - if point.incoming == nil or table.contains(point.incoming, neighbor) then - --draw dual way line - DrawingManager:addLineTask(x, y, z, nWp.x, nWp.y, nWp.z, 0, 0, 1) - else - --draw line with direction markers (arrow) - if (nWp.incoming == nil or table.contains(nWp.incoming, point.id)) then - -- one way line - DrawingManager:addLineTask(x, y, z, nWp.x, nWp.y, nWp.z, 0, 1, 0) - DrawingManager:addArrowTask(x, y, z, nWp.x, nWp.y, nWp.z, arrowPosition, 0, 1, 0) + local isSubPrioMarker = ADGraphManager:getIsPointSubPrioMarker(neighbor) + if not isSubPrioMarker then + --check if outgoing connection is a dual way connection + local nWp = ADGraphManager:getWayPointById(neighbor) + if point.incoming == nil or table.contains(point.incoming, neighbor) then + --draw dual way line + if isSubPrio then + DrawingManager:addLineTask(x, y, z, nWp.x, nWp.y, nWp.z, 0.389, 0.177, 0) + else + DrawingManager:addLineTask(x, y, z, nWp.x, nWp.y, nWp.z, 0, 0, 1) + end else - -- reverse way line - DrawingManager:addLineTask(x, y, z, nWp.x, nWp.y, nWp.z, 0.0, 0.569, 0.835) - DrawingManager:addArrowTask(x, y, z, nWp.x, nWp.y, nWp.z, arrowPosition, 0.0, 0.569, 0.835) + --draw line with direction markers (arrow) + if (nWp.incoming == nil or table.contains(nWp.incoming, point.id)) then + -- one way line + if isSubPrio then + DrawingManager:addLineTask(x, y, z, nWp.x, nWp.y, nWp.z, 1, 0.531, 0.14) + DrawingManager:addArrowTask(x, y, z, nWp.x, nWp.y, nWp.z, arrowPosition, 1, 0.531, 0.14) + else + DrawingManager:addLineTask(x, y, z, nWp.x, nWp.y, nWp.z, 0, 1, 0) + DrawingManager:addArrowTask(x, y, z, nWp.x, nWp.y, nWp.z, arrowPosition, 0, 1, 0) + end + else + -- reverse way line + DrawingManager:addLineTask(x, y, z, nWp.x, nWp.y, nWp.z, 0.0, 0.569, 0.835) + DrawingManager:addArrowTask(x, y, z, nWp.x, nWp.y, nWp.z, arrowPosition, 0.0, 0.569, 0.835) + end end end end diff --git a/FS19_AutoDrive/textures/input_record_4.dds b/FS19_AutoDrive/textures/input_record_4.dds new file mode 100644 index 0000000000000000000000000000000000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eV|jKV^AvSsuiLvsJ%DfFQ^_-pCVodBeA8sJ_$g=~3e$CSIRjT8JfJ0rjs z`p(-IjU;%J(O=Fp;V<#qLnAEszsE>PF*fP_h$j{jdh_l8`qyY2eJx73g!Rq&aXZ*t z4`58xhqcjqJX+ri-dIvgVG%T6D7|rD+Rx6iEtFe?_TWX_P^7ey7T_8d8|}Fsi<5rv z{irhnM=X%V*P^jv6O4W`Ki!{^JpIczt57j(X&<`-o2|~ zc~T!3$;aGZZpZ$F@?Nh0GzWjw_njSDDus9v8YI*2LQaRn+^;j+M`)l3^JO)dOhkrh ztVD=pkye!Ie4ep`MQR`A6M@qj<)s2^J~zIhhxNKt z%?$K(S>{*gW{^=`&bEmE4?9%i|F&oV`8y5&$`mKD^Sg%#9T89HB>rV=qaacL=lp!| zToL_i&)~IyKvN`;^%>b=7Wo;r%;(afuAVVe5X6#)*_o~$xqd(|sD9$NDsR*;4iHZc zz2g_WE7#Z66BqSyyyJIq{9l9jt-SSn6>6!WuLj-&J@mcpZ5#_wp!U9I&K8#QUxxgf zjlU2N;#=!4Um=?88P4~xe_vND_Ths+R>GUce^$JI+cD?=_EH1;XEy#^1DmFA+&chz zuLZvg1NCbeOn-zuJYUA~VlEjM-VEUGj_JnmuJ3O){>{bT7|+o7Mp35FgJ3|s=NYc| zP=J?ZT<{?p@y*(V!+F69>{UjxII zE&o~ZKTsTJSyqteMI5jhwmC*O(|ICuc?x_!I$u&9PPYP`uH&bc-ecj{>+|{k-Wh;Q zCdSc3(w7d=U$H__Pdl)^-C@A=a(R~8TU-94bd%)cg^>41=p6Bb(+!wenq6ANLwyp@ z`tv{G8-dxt2{=sW0Z*SfbCS*q-eWh-^J3Xp;R Date: Mon, 10 May 2021 00:47:00 +0200 Subject: [PATCH 07/46] Worked on harvest unloader efficiency. WIP --- .../scripts/Manager/HarvestManager.lua | 4 ++-- .../scripts/Modes/CombineUnloaderMode.lua | 10 +++++++--- .../scripts/Modules/DrivePathModule.lua | 16 +++++++++++++--- .../scripts/Modules/PathFinderModule.lua | 8 ++++---- .../scripts/Tasks/CatchCombinePipeTask.lua | 1 + 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/FS19_AutoDrive/scripts/Manager/HarvestManager.lua b/FS19_AutoDrive/scripts/Manager/HarvestManager.lua index b930170d..11d17922 100644 --- a/FS19_AutoDrive/scripts/Manager/HarvestManager.lua +++ b/FS19_AutoDrive/scripts/Manager/HarvestManager.lua @@ -120,7 +120,7 @@ function ADHarvestManager:update(dt) for _, harvester in pairs(self.harvesters) do if harvester ~= nil and g_currentMission.nodeToObject[harvester.components[1].node] ~= nil and entityExists(harvester.components[1].node) then - if self.assignmentDelayTimer:done() then + --if self.assignmentDelayTimer:done() then if not self:alreadyAssignedUnloader(harvester) then if ADHarvestManager.doesHarvesterNeedUnloading(harvester) or ((not AutoDrive.combineIsTurning(harvester)) and ADHarvestManager.isHarvesterActive(harvester)) then self:assignUnloaderToHarvester(harvester) @@ -141,7 +141,7 @@ function ADHarvestManager:update(dt) end end end - end + --end if (harvester.ad ~= nil and harvester.ad.noMovementTimer ~= nil and harvester.lastSpeedReal ~= nil) then harvester.ad.noMovementTimer:timer((harvester.lastSpeedReal <= 0.0004), 3000, dt) diff --git a/FS19_AutoDrive/scripts/Modes/CombineUnloaderMode.lua b/FS19_AutoDrive/scripts/Modes/CombineUnloaderMode.lua index d978e2c2..7b13127c 100644 --- a/FS19_AutoDrive/scripts/Modes/CombineUnloaderMode.lua +++ b/FS19_AutoDrive/scripts/Modes/CombineUnloaderMode.lua @@ -609,9 +609,13 @@ function CombineUnloaderMode:getRearChaseOffsetZ() if AutoDrive.isSugarcaneHarvester(self.combine) then rearChaseOffset = -self.combine.sizeLength / 2 - AutoDrive.getTractorTrainLength(self.vehicle, true, false) * math.sqrt(2) else - --there is no need to be close to the rear of the harvester here. We can make it hard on the pathfinder since we have no strong desire to chase there anyway for normal harvesters - --Especially when they are CP driven, we have to be prepared for that massive reverse maneuver when the combine is filled and wants to avoid the crop. - rearChaseOffset = -45 + if self.combine.lastSpeedReal > 0.002 and self.combine.ad.sensors.frontSensorFruit:pollInfo() then + rearChaseOffset = -10 + else + --there is no need to be close to the rear of the harvester here. We can make it hard on the pathfinder since we have no strong desire to chase there anyway for normal harvesters + --Especially when they are CP driven, we have to be prepared for that massive reverse maneuver when the combine is filled and wants to avoid the crop. + rearChaseOffset = -45 + end end end diff --git a/FS19_AutoDrive/scripts/Modules/DrivePathModule.lua b/FS19_AutoDrive/scripts/Modules/DrivePathModule.lua index 383e414a..d8b0c2c4 100644 --- a/FS19_AutoDrive/scripts/Modules/DrivePathModule.lua +++ b/FS19_AutoDrive/scripts/Modules/DrivePathModule.lua @@ -207,12 +207,22 @@ function ADDrivePathModule:followWaypoints(dt) self.distanceToLookAhead = 8 if self.wayPoints[self:getCurrentWayPointIndex() - 1] ~= nil and self:getNextWayPoint() ~= nil then local highestAngle = self:getHighestApproachingAngle() - self.speedLimit = math.min(self.speedLimit, self:getMaxSpeedForAngle(highestAngle)) + + if self:isOnRoadNetwork() then + self.speedLimit = math.min(self.speedLimit, self:getMaxSpeedForAngle(highestAngle)) + else + -- Let's increase the cornering speed for paths generated with the pathfinder module. There are many 45° angles in there that slow the process down otherwise. + self.speedLimit = math.min(self.speedLimit, self:getMaxSpeedForAngle(highestAngle) * 2) + end end self.distanceToTarget = self:getDistanceToLastWaypoint(40) if self.distanceToTarget < self.distanceToLookAhead then - self.speedLimit = math.clamp(8, self.speedLimit, 2 + self.distanceToTarget) + local currentTask = self.vehicle.ad.taskModule:getActiveTask() + local isCatchingCombine = currentTask.taskType ~= nil and self.vehicle.ad.taskModule:getActiveTask().taskType == "CatchCombinePipeTask" + if not isCatchingCombine then + self.speedLimit = math.clamp(8, self.speedLimit, 2 + self.distanceToTarget) + end end self.speedLimit = math.min(self.speedLimit, self:getSpeedLimitBySteeringAngle()) @@ -286,7 +296,7 @@ end -- To differentiate between waypoints on the road and ones created from pathfinder function ADDrivePathModule:isOnRoadNetwork() - return (self.wayPoints ~= nil and self:getNextWayPoint() ~= nil and not self:getNextWayPoint().isPathFinderPoint) + return (self.wayPoints ~= nil and self:getCurrentWayPoint() ~= nil and not self:getCurrentWayPoint().isPathFinderPoint) end function ADDrivePathModule:getWayPoints() diff --git a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua index 33c9987c..e7403be3 100644 --- a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua +++ b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua @@ -1544,10 +1544,6 @@ function PathFinderModule:createWayPoints() self:smoothResultingPPPath_Refined() if self.smoothStep == 2 then - for i = 1, #self.wayPoints, 1 do - self.wayPoints[i].isPathFinderPoint = true - end - if self.appendWayPoints ~= nil then for i = 1, #self.appendWayPoints, 1 do self.wayPoints[#self.wayPoints + 1] = self.appendWayPoints[i] @@ -1561,6 +1557,10 @@ function PathFinderModule:createWayPoints() ) end + + for i = 1, #self.wayPoints, 1 do + self.wayPoints[i].isPathFinderPoint = true + end end end diff --git a/FS19_AutoDrive/scripts/Tasks/CatchCombinePipeTask.lua b/FS19_AutoDrive/scripts/Tasks/CatchCombinePipeTask.lua index 3ecab798..35076112 100644 --- a/FS19_AutoDrive/scripts/Tasks/CatchCombinePipeTask.lua +++ b/FS19_AutoDrive/scripts/Tasks/CatchCombinePipeTask.lua @@ -21,6 +21,7 @@ function CatchCombinePipeTask:new(vehicle, combine) o.reverseTimer = AutoDriveTON:new() o.waitForCheckTimer = AutoDriveTON:new() o.waitForCheckTimer.elapsedTime = 4000 + o.taskType = "CatchCombinePipeTask" return o end From b097bea936f2fd544eca6598e29b5e89bf69a467 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Mon, 10 May 2021 14:44:24 +0200 Subject: [PATCH 08/46] =?UTF-8?q?Testing=20improved=20reaction=20to=20comb?= =?UTF-8?q?ines=2090=C2=B0=20turn.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua b/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua index 8bf938c1..14486a36 100644 --- a/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua +++ b/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua @@ -119,7 +119,7 @@ function FollowCombineTask:update(dt) self.vehicle.ad.specialDrivingModule:stopVehicle() self.vehicle.ad.specialDrivingModule:update(dt) end - if not AutoDrive.combineIsTurning(self.combine) and (self.combine.ad.sensors.frontSensorFruit:pollInfo() or self.waitForTurnTimer.elapsedTime > 15000) then + if not AutoDrive.combineIsTurning(self.combine) and ((self.combine.ad.sensors.frontSensorFruit:pollInfo() and (self.combine:getIsBufferCombine() or self.combine.ad.driveForwardTimer.elapsedTime > 8000) ) or self.waitForTurnTimer.elapsedTime > 15000) then if (self.angleToCombineHeading + self.angleToCombine) < 180 and self.vehicle.ad.modes[AutoDrive.MODE_UNLOAD]:isUnloaderOnCorrectSide(self.chaseSide) then AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_COMBINEINFO, "combine turn finished - Heading looks good - start chasing again") From d872d6ff5c39d402d80e6b3c2a3c1c76f4e3dbed Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Mon, 10 May 2021 14:44:44 +0200 Subject: [PATCH 09/46] Added initial version of 'Tip of the day' feature. --- FS19_AutoDrive/gui/guiProfiles.xml | 62 ++++++++++++++ FS19_AutoDrive/gui/tipOfTheDayGUI.xml | 29 +++++++ FS19_AutoDrive/gui/userSettingsPage.xml | 8 ++ FS19_AutoDrive/register.lua | 2 + FS19_AutoDrive/scripts/AutoDrive.lua | 3 + FS19_AutoDrive/scripts/Gui.lua | 12 +++ FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua | 77 ++++++++++++++++++ FS19_AutoDrive/scripts/Settings.lua | 11 +++ FS19_AutoDrive/scripts/TipOfTheDayHandler.lua | 62 ++++++++++++++ FS19_AutoDrive/scripts/XML.lua | 6 ++ FS19_AutoDrive/textures/tipOfTheDay_icons.dds | Bin 0 -> 1048704 bytes .../translations/translation_br.xml | 40 +++++++++ .../translations/translation_cz.xml | 40 +++++++++ .../translations/translation_de.xml | 45 ++++++++++ .../translations/translation_en.xml | 41 ++++++++++ .../translations/translation_es.xml | 40 +++++++++ .../translations/translation_fr.xml | 39 +++++++++ .../translations/translation_hu.xml | 40 +++++++++ .../translations/translation_it.xml | 40 +++++++++ .../translations/translation_nl.xml | 40 +++++++++ .../translations/translation_pl.xml | 40 +++++++++ .../translations/translation_pt.xml | 40 +++++++++ .../translations/translation_ru.xml | 40 +++++++++ .../translations/translation_tr.xml | 39 +++++++++ 24 files changed, 796 insertions(+) create mode 100644 FS19_AutoDrive/gui/tipOfTheDayGUI.xml create mode 100644 FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua create mode 100644 FS19_AutoDrive/scripts/TipOfTheDayHandler.lua create mode 100644 FS19_AutoDrive/textures/tipOfTheDay_icons.dds diff --git a/FS19_AutoDrive/gui/guiProfiles.xml b/FS19_AutoDrive/gui/guiProfiles.xml index 7aa76fba..8a079b1c 100644 --- a/FS19_AutoDrive/gui/guiProfiles.xml +++ b/FS19_AutoDrive/gui/guiProfiles.xml @@ -276,4 +276,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/gui/tipOfTheDayGUI.xml b/FS19_AutoDrive/gui/tipOfTheDayGUI.xml new file mode 100644 index 00000000..96f045d5 --- /dev/null +++ b/FS19_AutoDrive/gui/tipOfTheDayGUI.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FS19_AutoDrive/gui/userSettingsPage.xml b/FS19_AutoDrive/gui/userSettingsPage.xml index 03fb807f..704d3ca9 100644 --- a/FS19_AutoDrive/gui/userSettingsPage.xml +++ b/FS19_AutoDrive/gui/userSettingsPage.xml @@ -97,6 +97,14 @@ + + + + + + + + diff --git a/FS19_AutoDrive/register.lua b/FS19_AutoDrive/register.lua index 9a0eca43..82fee900 100644 --- a/FS19_AutoDrive/register.lua +++ b/FS19_AutoDrive/register.lua @@ -129,6 +129,8 @@ source(Utils.getFilename("scripts/Gui/SettingsPage.lua", g_currentModDirectory)) source(Utils.getFilename("scripts/Gui/DebugSettingsPage.lua", g_currentModDirectory)) source(Utils.getFilename("scripts/Gui/ExperimentalFeaturesSettingsPage.lua", g_currentModDirectory)) source(Utils.getFilename("scripts/Gui/Settings.lua", g_currentModDirectory)) +source(Utils.getFilename("scripts/Gui/TipOfTheDayGUI.lua", g_currentModDirectory)) +source(Utils.getFilename("scripts/TipOfTheDayHandler.lua", g_currentModDirectory)) AutoDriveRegister = {} AutoDriveRegister.version = g_modManager:getModByName(g_currentModName).version diff --git a/FS19_AutoDrive/scripts/AutoDrive.lua b/FS19_AutoDrive/scripts/AutoDrive.lua index cf10f92e..198cea8c 100644 --- a/FS19_AutoDrive/scripts/AutoDrive.lua +++ b/FS19_AutoDrive/scripts/AutoDrive.lua @@ -5,6 +5,7 @@ AutoDrive.directory = g_currentModDirectory g_autoDriveUIFilename = AutoDrive.directory .. "textures/GUI_Icons.dds" g_autoDriveDebugUIFilename = AutoDrive.directory .. "textures/gui_debug_Icons.dds" +g_autoDriveTipOfTheDayUIFilename = AutoDrive.directory .. "textures/tipOfTheDay_icons.dds" AutoDrive.experimentalFeatures = {} AutoDrive.experimentalFeatures.redLinePosition = false @@ -184,6 +185,7 @@ g_logManager:info("[AD] Start register later loaded mods end") ADMultipleTargetsManager:load() AutoDrive.initTelemetry() + AutoDrive.initTipOfTheDay() end function AutoDrive:init() @@ -317,6 +319,7 @@ function AutoDrive:update(dt) ADRoutesManager:update(dt) AutoDrive.handleTelemetry(dt) + AutoDrive.handleTipOfTheDay(dt) end function AutoDrive:draw() diff --git a/FS19_AutoDrive/scripts/Gui.lua b/FS19_AutoDrive/scripts/Gui.lua index 37a79c82..ad475898 100644 --- a/FS19_AutoDrive/scripts/Gui.lua +++ b/FS19_AutoDrive/scripts/Gui.lua @@ -9,6 +9,7 @@ function AutoDrive:loadGUI() AutoDrive.gui.ADEnterDestinationFilterGui = ADEnterDestinationFilterGui:new() AutoDrive.gui.ADRoutesManagerGui = ADRoutesManagerGui:new() AutoDrive.gui.ADNotificationsHistoryGui = ADNotificationsHistoryGui:new() + AutoDrive.gui.ADTipOfTheDayGUI = ADTipOfTheDayGUI:new() g_gui:loadGui(AutoDrive.directory .. "gui/enterDriverNameGUI.xml", "ADEnterDriverNameGui", AutoDrive.gui.ADEnterDriverNameGui) g_gui:loadGui(AutoDrive.directory .. "gui/enterTargetNameGUI.xml", "ADEnterTargetNameGui", AutoDrive.gui.ADEnterTargetNameGui) @@ -16,6 +17,7 @@ function AutoDrive:loadGUI() g_gui:loadGui(AutoDrive.directory .. "gui/enterDestinationFilterGUI.xml", "ADEnterDestinationFilterGui", AutoDrive.gui.ADEnterDestinationFilterGui) g_gui:loadGui(AutoDrive.directory .. "gui/routesManagerGUI.xml", "ADRoutesManagerGui", AutoDrive.gui.ADRoutesManagerGui) g_gui:loadGui(AutoDrive.directory .. "gui/notificationsHistoryGUI.xml", "ADNotificationsHistoryGui", AutoDrive.gui.ADNotificationsHistoryGui) + g_gui:loadGui(AutoDrive.directory .. "gui/tipOfTheDayGUI.xml", "ADTipOfTheDayGui", AutoDrive.gui.ADTipOfTheDayGUI) AutoDrive.gui.ADSettingsPage = ADSettingsPage:new() AutoDrive.gui.ADUserSettingsPage = ADSettingsPage:new() @@ -44,6 +46,8 @@ function AutoDrive.GuiOverlay_loadOverlay(superFunc, ...) overlay.filename = g_autoDriveDebugUIFilename elseif overlay.filename == "g_autoDriveUIFilename" then overlay.filename = g_autoDriveUIFilename + elseif overlay.filename == "g_autoDriveTipOfTheDayUIFilename" then + overlay.filename = g_autoDriveTipOfTheDayUIFilename end return overlay @@ -87,8 +91,16 @@ function AutoDrive.onOpenRoutesManager() end end +--[[ function AutoDrive.onOpenNotificationsHistory() if not AutoDrive.gui.ADNotificationsHistoryGui.isOpen then g_gui:showGui("ADNotificationsHistoryGui") end end +--]] + +function AutoDrive.onOpenNotificationsHistory() + if not AutoDrive.gui.ADTipOfTheDayGUI.isOpen then + g_gui:showGui("ADTipOfTheDayGui") + end +end diff --git a/FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua b/FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua new file mode 100644 index 00000000..b175785d --- /dev/null +++ b/FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua @@ -0,0 +1,77 @@ +ADTipOfTheDayGUI = {} +ADTipOfTheDayGUI.CONTROLS = {"tipOfTheDayTemplate"} + +local ADTipOfTheDayGUI_mt = Class(ADTipOfTheDayGUI, ScreenElement) + +function ADTipOfTheDayGUI:new(target) + local o = ScreenElement:new(target, ADTipOfTheDayGUI_mt) + o.returnScreenName = "" + --o.history = {} + o:registerControls(ADTipOfTheDayGUI.CONTROLS) + return o +end + +function ADTipOfTheDayGUI:onCreate() + --self.tipOfTheDayTemplate:unlinkElement() + --self.tipOfTheDayTemplate:setVisible(false) +end + +function ADTipOfTheDayGUI:onOpen() + self:refreshItems() + ADTipOfTheDayGUI:superClass().onOpen(self) + g_depthOfFieldManager:setBlurState(false) + + if self.activeCheckbox ~= nil then + self.activeCheckbox:setIsChecked(AutoDrive.getSetting("showTipOfTheDay")) + end +end + +function ADTipOfTheDayGUI:refreshItems() + AutoDrive.showNextTipOfTheDay() + self.tipOfTheDayContent = AutoDrive.tipOfTheDay.currentTipOfTheDay + + self.tipOfTheDayTemplate.elements[1]:setText(g_i18n:getText(self.tipOfTheDayContent.titletext)) + self.tipOfTheDayTemplate.elements[2]:setImageUVs(nil, unpack(getNormalizedUVs(self.tipOfTheDayContent.imageUV))) + self.tipOfTheDayTemplate.elements[3]:setText(g_i18n:getText(self.tipOfTheDayContent.text)) + + self.imageWidth, self.imageHeight = getNormalizedScreenValues(self.tipOfTheDayContent.imageSize[1], self.tipOfTheDayContent.imageSize[2]) + self.tipOfTheDayTemplate.elements[2]:setSize(self.imageWidth, self.imageHeight) + +end + +function ADTipOfTheDayGUI:onListSelectionChanged(rowIndex) +end + +function ADTipOfTheDayGUI:onDoubleClick(rowIndex) +end + +function ADTipOfTheDayGUI:onClickBack() + ADTipOfTheDayGUI:superClass().onClickBack(self) +end + +function ADTipOfTheDayGUI:onClickCancel() + ADTipOfTheDayGUI:superClass().onClickCancel(self) +end + +function ADTipOfTheDayGUI:onClickActivate() + --ADTipOfTheDayGUI:superClass().onClickActivate(self) + AutoDrive.toggleTipOfTheDay() + self:refreshItems() +end + +function ADTipOfTheDayGUI:onEnterPressed(_, isClick) +end + +function ADTipOfTheDayGUI:onEscPressed() + self:onClickBack() +end + +function ADTipOfTheDayGUI:onCreateCheckbox(element) + self.activeCheckbox = element.elements[1] +end + +function ADTipOfTheDayGUI:onClickToggle(element) + AutoDrive.toggleTipOfTheDay() + + self.activeCheckbox:setIsChecked(AutoDrive.getSetting("showTipOfTheDay")) +end diff --git a/FS19_AutoDrive/scripts/Settings.lua b/FS19_AutoDrive/scripts/Settings.lua index b058f3ee..8949f346 100644 --- a/FS19_AutoDrive/scripts/Settings.lua +++ b/FS19_AutoDrive/scripts/Settings.lua @@ -938,6 +938,17 @@ AutoDrive.settings.autoTrailerCover = { isVehicleSpecific = true } +AutoDrive.settings.showTipOfTheDay = { + values = {false, true}, + texts = {"gui_ad_no", "gui_ad_yes"}, + default = 2, + current = 2, + text = "gui_ad_showTipOfTheDay", + tooltip = "gui_ad_showTipOfTheDay_tooltip", + translate = true, + isVehicleSpecific = false +} + function AutoDrive.getSetting(settingName, vehicle) if AutoDrive.settings[settingName] ~= nil then local setting = AutoDrive.settings[settingName] diff --git a/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua b/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua new file mode 100644 index 00000000..074eea36 --- /dev/null +++ b/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua @@ -0,0 +1,62 @@ +AutoDrive.tipOfTheDay = {} +AutoDrive.tipOfTheDay.Entries = {} +AutoDrive.tipOfTheDay.Entries[1] = {} +AutoDrive.tipOfTheDay.Entries[1].imageFile = g_autoDriveTipOfTheDayUIFilename +AutoDrive.tipOfTheDay.Entries[1].imageUV = {0, 0, 128, 128} +AutoDrive.tipOfTheDay.Entries[1].imageSize = {128, 128} +AutoDrive.tipOfTheDay.Entries[1].text = "ad_totd_01_text" +AutoDrive.tipOfTheDay.Entries[1].titletext = "ad_totd_01_title" + +AutoDrive.tipOfTheDay.Entries[2] = {} +AutoDrive.tipOfTheDay.Entries[2].imageFile = g_autoDriveTipOfTheDayUIFilename +AutoDrive.tipOfTheDay.Entries[2].imageUV = {0, 0, 128, 512} +AutoDrive.tipOfTheDay.Entries[2].imageSize = {128, 512} +AutoDrive.tipOfTheDay.Entries[2].text = "ad_totd_02_text" +AutoDrive.tipOfTheDay.Entries[2].titletext = "ad_totd_02_title" + +AutoDrive.tipOfTheDay.Entries[3] = {} +AutoDrive.tipOfTheDay.Entries[3].imageFile = g_autoDriveTipOfTheDayUIFilename +AutoDrive.tipOfTheDay.Entries[3].imageUV = {128, 0, 128, 128} +AutoDrive.tipOfTheDay.Entries[3].imageSize = {128, 128} +AutoDrive.tipOfTheDay.Entries[3].text = "ad_totd_03_text" +AutoDrive.tipOfTheDay.Entries[3].titletext = "ad_totd_03_title" + +AutoDrive.tipOfTheDay.Entries[4] = {} +AutoDrive.tipOfTheDay.Entries[4].imageFile = g_autoDriveTipOfTheDayUIFilename +AutoDrive.tipOfTheDay.Entries[4].imageUV = {128, 128, 128, 128} +AutoDrive.tipOfTheDay.Entries[4].imageSize = {128, 128} +AutoDrive.tipOfTheDay.Entries[4].text = "ad_totd_04_text" +AutoDrive.tipOfTheDay.Entries[4].titletext = "ad_totd_04_title" + +AutoDrive.tipOfTheDay.currentTipId = 1 +AutoDrive.tipOfTheDay.displayedYet = false + +function AutoDrive.initTipOfTheDay() + +end + +function AutoDrive.handleTipOfTheDay(dt) + if AutoDrive.getSetting("showTipOfTheDay") and not AutoDrive.tipOfTheDay.displayedYet then + if not AutoDrive.gui.ADTipOfTheDayGUI.isOpen then + g_gui:showGui("ADTipOfTheDayGui") + AutoDrive.tipOfTheDay.displayedYet = true + end + end +end + +function AutoDrive.showNextTipOfTheDay() + AutoDrive.tipOfTheDay.currentTipId = AutoDrive.tipOfTheDay.currentTipId + 1 + if AutoDrive.tipOfTheDay.Entries[AutoDrive.tipOfTheDay.currentTipId] == nil then + AutoDrive.tipOfTheDay.currentTipId = 1 + end + + AutoDrive.tipOfTheDay.currentTipOfTheDay = AutoDrive.tipOfTheDay.Entries[AutoDrive.tipOfTheDay.currentTipId] +end + +function AutoDrive.toggleTipOfTheDay() + if AutoDrive.getSetting("showTipOfTheDay") then + AutoDrive.setSettingState("showTipOfTheDay", 1) + else + AutoDrive.setSettingState("showTipOfTheDay", 2) + end +end \ No newline at end of file diff --git a/FS19_AutoDrive/scripts/XML.lua b/FS19_AutoDrive/scripts/XML.lua index 15c10dd3..10f9c43b 100644 --- a/FS19_AutoDrive/scripts/XML.lua +++ b/FS19_AutoDrive/scripts/XML.lua @@ -249,6 +249,9 @@ function AutoDrive.readFromXML(xmlFile) -- if debug channel for road network was saved and loaded, the debug wayPoints shall be created ADGraphManager:createDebugMarkers() + + AutoDrive.tipOfTheDay.currentTipId = getXMLInt(xmlFile, "AutoDrive.lastTipOfTheDay") or 1 + g_logManager:info("[AD] AutoDrive.readFromXML waypoints: %s", tostring(ADGraphManager:getWayPointsCount())) g_logManager:info("[AD] AutoDrive.readFromXML markers: %s", tostring(#ADGraphManager:getMapMarkers())) g_logManager:info("[AD] AutoDrive.readFromXML groups: %s", tostring(table.count(ADGraphManager:getGroups()))) @@ -325,6 +328,9 @@ function AutoDrive.saveToXML(xmlFile) markerIndex = markerIndex + 1 end end + + setXMLInt(xmlFile, "AutoDrive.lastTipOfTheDay", AutoDrive.tipOfTheDay.currentTipId) + saveXMLFile(xmlFile) if g_client == nil then g_logManager:info("[AD] AutoDrive.saveToXML waypoints: %s", tostring(ADGraphManager:getWayPointsCount())) diff --git a/FS19_AutoDrive/textures/tipOfTheDay_icons.dds b/FS19_AutoDrive/textures/tipOfTheDay_icons.dds new file mode 100644 index 0000000000000000000000000000000000000000..caa6c55d66e258c77d1affd4167015d609908662 GIT binary patch literal 1048704 zcmeFa4RoBTmTP&|p=oYUPBAw{(3FG5=O%YK35iCr z4Fk5NeV=FVZ-0OK8I3fOM)JGI*3A3u{q3Lk-TU3oyMH%q`2Ec1lu{R@8y`v(b+BN~;xG|8kpBxo(xotY3fE zT`z0Bdc8WJv&)ucv%S58gMGyZHmP2r=Nmt2)XJJ$S01_5$n!FtrSMbgEy~Kfw#ifm zBmX7aqw>#d$Xnz;@9V#lzmaE5{*<>be^deu*9&LrgV4ecsSnZ~L?4Jg^g9IUAEbX2 zd?5Hp@S)|vg3*WDGM~ykz5XTIhuyn&?fUV^uk?u4g^inbY-AbX1_z(%+Z@t^gT1}k ztk8}>RmTtg%-}7rI{6g#>H%FC(T;wX`cTczn%yfY@1`|t)+k^8v=2r8wz|*r`aLQ6 zQ{G1Yg6|9mD0#s*f^P)hEHHc{`c3p3I3W66`Zwv{rGNLk1JMUQ-o5@8_QUyonE$)< zpzbT|EPTw_i#slQf9fL47;C*_W45_IwQQN?prP?o=<4Ff<&UPftIJi|$fv!{8`Q7r zr$-KtIC*}j*?uT*nEz`;{?#SF>9(hGy8bY!53bn=pL*fX zc>GE7OK8!jqEBZ^U*z@so>ZQTU8#X0XtTQ6KASGB8Gp*I#%GKR6(1(;zrqdn%EUEmec?GgEB;FX<#=9^J}(#?tR=WqMp zUAQmZk=@fmuFz>{L+lK-L{-u&8nW4&I$Z{5zJHjmzLNK4ygP0x>5R(uuc-;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(9;!j3QA+e6Mg3jdFm_uy^%-;Q7Kzh68F|NC{l;D313j<@6|u!kbq zL*D#C{U3g|?LTk(<9Lq!!T-z`7l$jnSAdqv_s@(W?k3Ce& z9^ilY-}Zm(p!)Fid9UFf@U;i-t`h&BrHQfxJ`}tFc zWqrmu{RX_XJ8uoUf8hVo_W!W2@1Xnd`fFYLYZ(6igSCmhx*2SSN5|J1Q;+I5;Js?` z9@m@e4ewcc*SC5t=ga(ko7V=l2lyZUx9tggsFXc~VGw-i(aR0Z17Y~lEAnqMA3*Ab z4=%Ly)*w*x1Defk^M>NlW>a?3ebF9%f7I*8b$17$ylg#}fBV$oxw$*m`3(Q}V{eJS z#s2satN(xh!I=ru6#Mw|=cU!q?`+Cf4?VEQ_%}QV58Ckqd#IK@Q17i+y?0Pv + + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/translations/translation_cz.xml b/FS19_AutoDrive/translations/translation_cz.xml index 9e77dfe8..c8a28fb5 100644 --- a/FS19_AutoDrive/translations/translation_cz.xml +++ b/FS19_AutoDrive/translations/translation_cz.xml @@ -326,5 +326,45 @@ + + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/translations/translation_de.xml b/FS19_AutoDrive/translations/translation_de.xml index af533338..25fdeba8 100644 --- a/FS19_AutoDrive/translations/translation_de.xml +++ b/FS19_AutoDrive/translations/translation_de.xml @@ -326,5 +326,50 @@ + + + + + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/translations/translation_en.xml b/FS19_AutoDrive/translations/translation_en.xml index c6d3ec7d..05d736e3 100644 --- a/FS19_AutoDrive/translations/translation_en.xml +++ b/FS19_AutoDrive/translations/translation_en.xml @@ -326,5 +326,46 @@ + + + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/translations/translation_es.xml b/FS19_AutoDrive/translations/translation_es.xml index e31749e2..8d560b30 100644 --- a/FS19_AutoDrive/translations/translation_es.xml +++ b/FS19_AutoDrive/translations/translation_es.xml @@ -324,5 +324,45 @@ + + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/translations/translation_fr.xml b/FS19_AutoDrive/translations/translation_fr.xml index b344ec0d..758040cf 100644 --- a/FS19_AutoDrive/translations/translation_fr.xml +++ b/FS19_AutoDrive/translations/translation_fr.xml @@ -329,5 +329,44 @@ + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/translations/translation_hu.xml b/FS19_AutoDrive/translations/translation_hu.xml index 8d60e5f2..21ac1c31 100644 --- a/FS19_AutoDrive/translations/translation_hu.xml +++ b/FS19_AutoDrive/translations/translation_hu.xml @@ -305,5 +305,45 @@ + + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/translations/translation_it.xml b/FS19_AutoDrive/translations/translation_it.xml index ed1f5309..56f64095 100644 --- a/FS19_AutoDrive/translations/translation_it.xml +++ b/FS19_AutoDrive/translations/translation_it.xml @@ -326,5 +326,45 @@ + + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/translations/translation_nl.xml b/FS19_AutoDrive/translations/translation_nl.xml index 2e7666fa..bd526734 100644 --- a/FS19_AutoDrive/translations/translation_nl.xml +++ b/FS19_AutoDrive/translations/translation_nl.xml @@ -326,5 +326,45 @@ + + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/translations/translation_pl.xml b/FS19_AutoDrive/translations/translation_pl.xml index 44a93689..b0628b88 100644 --- a/FS19_AutoDrive/translations/translation_pl.xml +++ b/FS19_AutoDrive/translations/translation_pl.xml @@ -325,5 +325,45 @@ + + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/translations/translation_pt.xml b/FS19_AutoDrive/translations/translation_pt.xml index 770daf0a..19a44fe5 100644 --- a/FS19_AutoDrive/translations/translation_pt.xml +++ b/FS19_AutoDrive/translations/translation_pt.xml @@ -329,5 +329,45 @@ + + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/translations/translation_ru.xml b/FS19_AutoDrive/translations/translation_ru.xml index 3b3dce18..6bb5c29c 100644 --- a/FS19_AutoDrive/translations/translation_ru.xml +++ b/FS19_AutoDrive/translations/translation_ru.xml @@ -326,5 +326,45 @@ + + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/translations/translation_tr.xml b/FS19_AutoDrive/translations/translation_tr.xml index c08fe327..234ab414 100644 --- a/FS19_AutoDrive/translations/translation_tr.xml +++ b/FS19_AutoDrive/translations/translation_tr.xml @@ -325,5 +325,44 @@ + + + + + + + + + + + + + From 25bbe18231816c520d8ba8b26f219bd7327ea820 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Mon, 10 May 2021 14:46:31 +0200 Subject: [PATCH 10/46] Version bump to RC1 --- FS19_AutoDrive/scripts/AutoDrive.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FS19_AutoDrive/scripts/AutoDrive.lua b/FS19_AutoDrive/scripts/AutoDrive.lua index 198cea8c..9e9f458d 100644 --- a/FS19_AutoDrive/scripts/AutoDrive.lua +++ b/FS19_AutoDrive/scripts/AutoDrive.lua @@ -1,5 +1,5 @@ AutoDrive = {} -AutoDrive.version = "1.1.1.0" +AutoDrive.version = "1.1.1.1-RC1" AutoDrive.directory = g_currentModDirectory From edf478f7d0310f38c1a85f3ac363539531d2d38d Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Tue, 11 May 2021 13:19:05 +0200 Subject: [PATCH 11/46] Reduced grid cell size check when cell is on the field. --- FS19_AutoDrive/scripts/Gui.lua | 4 +--- FS19_AutoDrive/scripts/Modules/PathFinderModule.lua | 6 ++++++ FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/FS19_AutoDrive/scripts/Gui.lua b/FS19_AutoDrive/scripts/Gui.lua index ad475898..9a142641 100644 --- a/FS19_AutoDrive/scripts/Gui.lua +++ b/FS19_AutoDrive/scripts/Gui.lua @@ -91,15 +91,13 @@ function AutoDrive.onOpenRoutesManager() end end ---[[ function AutoDrive.onOpenNotificationsHistory() if not AutoDrive.gui.ADNotificationsHistoryGui.isOpen then g_gui:showGui("ADNotificationsHistoryGui") end end ---]] -function AutoDrive.onOpenNotificationsHistory() +function AutoDrive.onTipOfTheDay() if not AutoDrive.gui.ADTipOfTheDayGUI.isOpen then g_gui:showGui("ADTipOfTheDayGui") end diff --git a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua index e7403be3..7731ab76 100644 --- a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua +++ b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua @@ -793,6 +793,7 @@ function PathFinderModule:testNextCells(cell) end if duplicatePointDirection >= 0 then -- if different direction, it is not necessary to check the cell details again, just add a new entry in grid with known required restrictions + -- Todo : Not true!! If we come from a different direction we ususally have a differently sized collision box to check. There is a difference between a 0° angle when coming from the last cell and a +/- 45° angle. gridKey = string.format("%d|%d|%d", location.x, location.z, duplicatePointDirection) location.isRestricted = self.grid[gridKey].isRestricted location.hasCollision = self.grid[gridKey].hasCollision @@ -835,6 +836,7 @@ function PathFinderModule:checkGridCell(cell) local worldPos = self:gridLocationToWorldLocation(cell) --Try going through the checks in a way that fast checks happen before slower ones which might then be skipped + cell.isOnField = AutoDrive.checkIsOnField(worldPos.x, 0, worldPos.z) if self.restrictToField and (self.fallBackMode1 and not self.fallBackMode2) then -- limit cells to field border only possible if started on field cell.bordercells = cell.incoming.bordercells + 1 -- by default we assume the new cell is not on field, so increase the counter @@ -1472,9 +1474,13 @@ function PathFinderModule:getShapeDefByDirectionType(cell) end local increaseCellFactor = 1.15 + if cell.isOnField ~= nil and cell.isOnField == true then + increaseCellFactor = 0.65 + end shapeDefinition.widthX = shapeDefinition.widthX * increaseCellFactor shapeDefinition.widthZ = shapeDefinition.widthZ * increaseCellFactor + local corners = self:getCornersFromShapeDefinition(shapeDefinition) if corners ~= nil then for _, corner in pairs(corners) do diff --git a/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua b/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua index 14486a36..ab429ed7 100644 --- a/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua +++ b/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua @@ -78,7 +78,7 @@ function FollowCombineTask:update(dt) -- Also for small fields, there is often no purpose in chasing so far behind the combine as it will already start a turn soon self:finished() end - if (not self.combine:getIsBufferCombine()) and self.combineFillPercent > 90 then + if (not self.combine:getIsBufferCombine()) and self.combineFillPercent > 90 and AutoDrive.getDistanceBetween(self.vehicle, self.combine) > self.MIN_COMBINE_DISTANCE then -- Stop chasing and wait for a normal unload call while standing self:finished() end From 1b91664c1f496a1b4819e56dd9ae748f5379f61b Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Tue, 11 May 2021 17:39:20 +0200 Subject: [PATCH 12/46] Removed possible cause for undrivable pathfinder coursed. --- FS19_AutoDrive/scripts/Modules/PathFinderModule.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua index 7731ab76..2ec83590 100644 --- a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua +++ b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua @@ -769,12 +769,12 @@ function PathFinderModule:testNextCells(cell) self.grid[gridKey].incoming = cell self.grid[gridKey].steps = cell.steps + 1 end - elseif self.grid[gridKey].direction ~= location.direction then - duplicatePointDirection = self.grid[gridKey].direction -- remember the grid direction - if self.grid[gridKey].steps > (cell.steps + 1) then --found shortcut - self.grid[gridKey].incoming = cell - self.grid[gridKey].steps = cell.steps + 1 - end + --elseif self.grid[gridKey].direction ~= location.direction then + --duplicatePointDirection = self.grid[gridKey].direction -- remember the grid direction + --if self.grid[gridKey].steps > (cell.steps + 1) then --found shortcut -> not true!!! The outgoing angles would be all wrong here. This caused issues with undrivable paths being generated! + --self.grid[gridKey].incoming = cell + --self.grid[gridKey].steps = cell.steps + 1 + --end end end end From 7ccfe5fc6488999be347dafb9c2fb3d43e9a123a Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Tue, 11 May 2021 22:48:33 +0200 Subject: [PATCH 13/46] Improved tip of the day Now it also stores highest displayed tip id. This way we can only activate the feature if a new tip is available. Also added a keybinding option to open the window. --- FS19_AutoDrive/modDesc.xml | 1 + FS19_AutoDrive/scripts/AutoDrive.lua | 3 ++- FS19_AutoDrive/scripts/Gui.lua | 2 +- FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua | 2 +- FS19_AutoDrive/scripts/Manager/InputManager.lua | 10 +++++++++- FS19_AutoDrive/scripts/TipOfTheDayHandler.lua | 9 ++++++++- FS19_AutoDrive/scripts/XML.lua | 2 ++ FS19_AutoDrive/translations/translation_br.xml | 1 + FS19_AutoDrive/translations/translation_cz.xml | 1 + FS19_AutoDrive/translations/translation_de.xml | 3 ++- FS19_AutoDrive/translations/translation_en.xml | 3 ++- FS19_AutoDrive/translations/translation_es.xml | 1 + FS19_AutoDrive/translations/translation_fr.xml | 1 + FS19_AutoDrive/translations/translation_hu.xml | 1 + FS19_AutoDrive/translations/translation_it.xml | 1 + FS19_AutoDrive/translations/translation_nl.xml | 1 + FS19_AutoDrive/translations/translation_pl.xml | 1 + FS19_AutoDrive/translations/translation_pt.xml | 1 + FS19_AutoDrive/translations/translation_ru.xml | 1 + FS19_AutoDrive/translations/translation_tr.xml | 3 ++- 20 files changed, 40 insertions(+), 8 deletions(-) diff --git a/FS19_AutoDrive/modDesc.xml b/FS19_AutoDrive/modDesc.xml index 5c620a29..28691243 100644 --- a/FS19_AutoDrive/modDesc.xml +++ b/FS19_AutoDrive/modDesc.xml @@ -170,6 +170,7 @@ Traduit avec www.DeepL.com/Translator (version gratuite) + diff --git a/FS19_AutoDrive/scripts/AutoDrive.lua b/FS19_AutoDrive/scripts/AutoDrive.lua index 9e9f458d..eb73ccfe 100644 --- a/FS19_AutoDrive/scripts/AutoDrive.lua +++ b/FS19_AutoDrive/scripts/AutoDrive.lua @@ -95,7 +95,8 @@ AutoDrive.actions = { {"AD_open_notification_history", false, 0}, {"AD_continue", false, 3}, {"ADParkVehicle", false, 0}, - {"AD_devAction", false, 0} + {"AD_devAction", false, 0}, + {"AD_open_tipOfTheDay", false, 0} -- {"COURSEPLAY_MOUSEACTION_SECONDARY", true, 1} } diff --git a/FS19_AutoDrive/scripts/Gui.lua b/FS19_AutoDrive/scripts/Gui.lua index 9a142641..f00de2e2 100644 --- a/FS19_AutoDrive/scripts/Gui.lua +++ b/FS19_AutoDrive/scripts/Gui.lua @@ -97,7 +97,7 @@ function AutoDrive.onOpenNotificationsHistory() end end -function AutoDrive.onTipOfTheDay() +function AutoDrive.onOpenTipOfTheDay() if not AutoDrive.gui.ADTipOfTheDayGUI.isOpen then g_gui:showGui("ADTipOfTheDayGui") end diff --git a/FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua b/FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua index b175785d..310e80bd 100644 --- a/FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua +++ b/FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua @@ -55,7 +55,7 @@ end function ADTipOfTheDayGUI:onClickActivate() --ADTipOfTheDayGUI:superClass().onClickActivate(self) - AutoDrive.toggleTipOfTheDay() + AutoDrive.showNextTipOfTheDay() self:refreshItems() end diff --git a/FS19_AutoDrive/scripts/Manager/InputManager.lua b/FS19_AutoDrive/scripts/Manager/InputManager.lua index 4735788b..d21c1c20 100644 --- a/FS19_AutoDrive/scripts/Manager/InputManager.lua +++ b/FS19_AutoDrive/scripts/Manager/InputManager.lua @@ -37,9 +37,11 @@ ADInputManager.actionsToInputs = { AD_open_notification_history = "input_openNotificationHistory", AD_continue = "input_continue", ADParkVehicle = "input_parkVehicle", - AD_devAction = "input_devAction" + AD_devAction = "input_devAction", + AD_open_tipOfTheDay = "input_openTipOfTheDay" } + --[[ tool selection not proper on dedi servers as known! That's why the following event is only taken on clients and send as event in the network @@ -118,6 +120,12 @@ function ADInputManager:input_openNotificationHistory(vehicle) AutoDrive.onOpenNotificationsHistory() end +function ADInputManager:input_openTipOfTheDay(vehicle) + AutoDrive.onOpenTipOfTheDay() +end + + + function ADInputManager:input_editMapMarker(vehicle) if AutoDrive.isEditorModeEnabled() then -- This can be triggered both from 'Edit Target' keyboard shortcut and right click on 'Create Target' hud button diff --git a/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua b/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua index 074eea36..35fdb805 100644 --- a/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua +++ b/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua @@ -29,6 +29,7 @@ AutoDrive.tipOfTheDay.Entries[4].text = "ad_totd_04_text" AutoDrive.tipOfTheDay.Entries[4].titletext = "ad_totd_04_title" AutoDrive.tipOfTheDay.currentTipId = 1 +AutoDrive.tipOfTheDay.highestTipId = 1 AutoDrive.tipOfTheDay.displayedYet = false function AutoDrive.initTipOfTheDay() @@ -36,7 +37,12 @@ function AutoDrive.initTipOfTheDay() end function AutoDrive.handleTipOfTheDay(dt) - if AutoDrive.getSetting("showTipOfTheDay") and not AutoDrive.tipOfTheDay.displayedYet then + if (AutoDrive.getSetting("showTipOfTheDay") or AutoDrive.tipOfTheDay.Entries[AutoDrive.tipOfTheDay.highestTipId + 1] ~= nil) and not AutoDrive.tipOfTheDay.displayedYet then + -- The idea is to still diplay new tips that arrived with a new AutoDrive version + if not AutoDrive.getSetting("showTipOfTheDay") then + AutoDrive.tipOfTheDay.currentTipId = AutoDrive.tipOfTheDay.highestTipId + 1 + end + if not AutoDrive.gui.ADTipOfTheDayGUI.isOpen then g_gui:showGui("ADTipOfTheDayGui") AutoDrive.tipOfTheDay.displayedYet = true @@ -50,6 +56,7 @@ function AutoDrive.showNextTipOfTheDay() AutoDrive.tipOfTheDay.currentTipId = 1 end + AutoDrive.tipOfTheDay.highestTipId = math.max(AutoDrive.tipOfTheDay.highestTipId, AutoDrive.tipOfTheDay.currentTipId) AutoDrive.tipOfTheDay.currentTipOfTheDay = AutoDrive.tipOfTheDay.Entries[AutoDrive.tipOfTheDay.currentTipId] end diff --git a/FS19_AutoDrive/scripts/XML.lua b/FS19_AutoDrive/scripts/XML.lua index 10f9c43b..8eb23816 100644 --- a/FS19_AutoDrive/scripts/XML.lua +++ b/FS19_AutoDrive/scripts/XML.lua @@ -251,6 +251,7 @@ function AutoDrive.readFromXML(xmlFile) ADGraphManager:createDebugMarkers() AutoDrive.tipOfTheDay.currentTipId = getXMLInt(xmlFile, "AutoDrive.lastTipOfTheDay") or 1 + AutoDrive.tipOfTheDay.highestTipId = getXMLInt(xmlFile, "AutoDrive.highestTipOfTheDay") or 1 g_logManager:info("[AD] AutoDrive.readFromXML waypoints: %s", tostring(ADGraphManager:getWayPointsCount())) g_logManager:info("[AD] AutoDrive.readFromXML markers: %s", tostring(#ADGraphManager:getMapMarkers())) @@ -330,6 +331,7 @@ function AutoDrive.saveToXML(xmlFile) end setXMLInt(xmlFile, "AutoDrive.lastTipOfTheDay", AutoDrive.tipOfTheDay.currentTipId) + setXMLInt(xmlFile, "AutoDrive.highestTipOfTheDay", AutoDrive.tipOfTheDay.highestTipId) saveXMLFile(xmlFile) if g_client == nil then diff --git a/FS19_AutoDrive/translations/translation_br.xml b/FS19_AutoDrive/translations/translation_br.xml index 8cefc188..241aa31c 100644 --- a/FS19_AutoDrive/translations/translation_br.xml +++ b/FS19_AutoDrive/translations/translation_br.xml @@ -34,6 +34,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_cz.xml b/FS19_AutoDrive/translations/translation_cz.xml index c8a28fb5..6593e68c 100644 --- a/FS19_AutoDrive/translations/translation_cz.xml +++ b/FS19_AutoDrive/translations/translation_cz.xml @@ -34,6 +34,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_de.xml b/FS19_AutoDrive/translations/translation_de.xml index 25fdeba8..2b02c867 100644 --- a/FS19_AutoDrive/translations/translation_de.xml +++ b/FS19_AutoDrive/translations/translation_de.xml @@ -34,7 +34,8 @@ - + + diff --git a/FS19_AutoDrive/translations/translation_en.xml b/FS19_AutoDrive/translations/translation_en.xml index 05d736e3..8499def6 100644 --- a/FS19_AutoDrive/translations/translation_en.xml +++ b/FS19_AutoDrive/translations/translation_en.xml @@ -34,7 +34,8 @@ - + + diff --git a/FS19_AutoDrive/translations/translation_es.xml b/FS19_AutoDrive/translations/translation_es.xml index 8d560b30..f3f09851 100644 --- a/FS19_AutoDrive/translations/translation_es.xml +++ b/FS19_AutoDrive/translations/translation_es.xml @@ -34,6 +34,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_fr.xml b/FS19_AutoDrive/translations/translation_fr.xml index 758040cf..d9291335 100644 --- a/FS19_AutoDrive/translations/translation_fr.xml +++ b/FS19_AutoDrive/translations/translation_fr.xml @@ -34,6 +34,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_hu.xml b/FS19_AutoDrive/translations/translation_hu.xml index 21ac1c31..d1f18d79 100644 --- a/FS19_AutoDrive/translations/translation_hu.xml +++ b/FS19_AutoDrive/translations/translation_hu.xml @@ -34,6 +34,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_it.xml b/FS19_AutoDrive/translations/translation_it.xml index 56f64095..90ab151d 100644 --- a/FS19_AutoDrive/translations/translation_it.xml +++ b/FS19_AutoDrive/translations/translation_it.xml @@ -34,6 +34,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_nl.xml b/FS19_AutoDrive/translations/translation_nl.xml index bd526734..62c93a24 100644 --- a/FS19_AutoDrive/translations/translation_nl.xml +++ b/FS19_AutoDrive/translations/translation_nl.xml @@ -34,6 +34,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_pl.xml b/FS19_AutoDrive/translations/translation_pl.xml index b0628b88..c0bc590d 100644 --- a/FS19_AutoDrive/translations/translation_pl.xml +++ b/FS19_AutoDrive/translations/translation_pl.xml @@ -34,6 +34,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_pt.xml b/FS19_AutoDrive/translations/translation_pt.xml index 19a44fe5..2c66c2f3 100644 --- a/FS19_AutoDrive/translations/translation_pt.xml +++ b/FS19_AutoDrive/translations/translation_pt.xml @@ -34,6 +34,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_ru.xml b/FS19_AutoDrive/translations/translation_ru.xml index 6bb5c29c..282ae5d2 100644 --- a/FS19_AutoDrive/translations/translation_ru.xml +++ b/FS19_AutoDrive/translations/translation_ru.xml @@ -34,6 +34,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_tr.xml b/FS19_AutoDrive/translations/translation_tr.xml index 234ab414..7789f1c7 100644 --- a/FS19_AutoDrive/translations/translation_tr.xml +++ b/FS19_AutoDrive/translations/translation_tr.xml @@ -34,6 +34,7 @@ + @@ -47,7 +48,7 @@ - + From 67fe88eb3b7275b9e0fb11fddefb6b83439844f4 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Tue, 11 May 2021 22:49:17 +0200 Subject: [PATCH 14/46] Reduced minTurnRadius to a previous value.. This reduces the general turn radius of path driven vehicles drastically. --- FS19_AutoDrive/scripts/Modules/PathFinderModule.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua index 2ec83590..46f3d76c 100644 --- a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua +++ b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua @@ -313,7 +313,7 @@ function PathFinderModule:startPathPlanningTo(targetPoint, targetVector) local angleRad = math.atan2(targetVector.z, targetVector.x) angleRad = AutoDrive.normalizeAngle(angleRad) - self.minTurnRadius = AutoDrive.getDriverRadius(self.vehicle) + self.minTurnRadius = AutoDrive.getDriverRadius(self.vehicle) * 2 / 3 self.vectorX = {x = math.cos(angleRad) * self.minTurnRadius, z = math.sin(angleRad) * self.minTurnRadius} self.vectorZ = {x = - math.sin(angleRad) * self.minTurnRadius, z = math.cos(angleRad) * self.minTurnRadius} From 910abd78dad168218b2383f428013a78aca0db6b Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Tue, 11 May 2021 23:27:30 +0200 Subject: [PATCH 15/46] Increased cornering speed for tight corners on the field. --- .../scripts/Modules/DrivePathModule.lua | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/FS19_AutoDrive/scripts/Modules/DrivePathModule.lua b/FS19_AutoDrive/scripts/Modules/DrivePathModule.lua index d8b0c2c4..edcafc57 100644 --- a/FS19_AutoDrive/scripts/Modules/DrivePathModule.lua +++ b/FS19_AutoDrive/scripts/Modules/DrivePathModule.lua @@ -212,7 +212,7 @@ function ADDrivePathModule:followWaypoints(dt) self.speedLimit = math.min(self.speedLimit, self:getMaxSpeedForAngle(highestAngle)) else -- Let's increase the cornering speed for paths generated with the pathfinder module. There are many 45° angles in there that slow the process down otherwise. - self.speedLimit = math.min(self.speedLimit, self:getMaxSpeedForAngle(highestAngle) * 2) + self.speedLimit = math.min(self.speedLimit, math.max(12, self:getMaxSpeedForAngle(highestAngle) * 2)) end end @@ -225,7 +225,12 @@ function ADDrivePathModule:followWaypoints(dt) end end - self.speedLimit = math.min(self.speedLimit, self:getSpeedLimitBySteeringAngle()) + if self:isOnRoadNetwork() then + self.speedLimit = math.min(self.speedLimit, self:getSpeedLimitBySteeringAngle()) + else + -- Let's increase the cornering speed for paths generated with the pathfinder module. There are many 45° angles in there that slow the process down otherwise. + self.speedLimit = math.min(self.speedLimit, self:getSpeedLimitBySteeringAngle() * 1.5) + end local maxSpeedDiff = ADDrivePathModule.MAX_SPEED_DEVIATION if self.vehicle.ad.trailerModule:isUnloadingToBunkerSilo() then @@ -441,27 +446,8 @@ function ADDrivePathModule:getMaxSpeedForAngle(angle) local maxSpeed = math.huge if angle < 5 then - --[[ - elseif angle < 5 then - maxSpeed = 38 - elseif angle < 8 then - maxSpeed = 27 - elseif angle < 12 then - maxSpeed = 20 - elseif angle < 20 then - maxSpeed = 17 - elseif angle < 25 then - maxSpeed = 16 - elseif angle < 100 then - maxSpeed = 13 - --]] maxSpeed = math.huge elseif angle < 50 then - --elseif angle < 100 then - --maxSpeed = 8 - -- < 5 max - -- > 5 = 60 - -- < 30 = 12 maxSpeed = 12 + 48 * (1 - math.clamp(0, (angle - 5), 25) / (30 - 5)) elseif angle >= 50 then maxSpeed = 3 From 288b86b724ad60eec82e91e28e672c7a24f53717 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Tue, 11 May 2021 23:28:43 +0200 Subject: [PATCH 16/46] If a vehicle is already at the target (< 8m) it will only reveive that target node as waypoints. --- FS19_AutoDrive/scripts/Manager/GraphManager.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/FS19_AutoDrive/scripts/Manager/GraphManager.lua b/FS19_AutoDrive/scripts/Manager/GraphManager.lua index 0f086d36..aa9da59b 100644 --- a/FS19_AutoDrive/scripts/Manager/GraphManager.lua +++ b/FS19_AutoDrive/scripts/Manager/GraphManager.lua @@ -2,6 +2,7 @@ ADGraphManager = {} ADGraphManager.debugGroupName = "AD_Debug" ADGraphManager.SUB_PRIO_FACTOR = 20 +ADGraphManager.MIN_START_DISTANCE = 8 function ADGraphManager:load() self.wayPoints = {} @@ -126,6 +127,18 @@ end function ADGraphManager:getPathTo(vehicle, waypointId) local wp = {} + + local x, _, z = getWorldTranslation(vehicle.components[1].node) + local wp_target = self.wayPoints[waypointId] + + if wp_target ~= nil then + local distanceToTarget = MathUtil.vector2Length(x - wp_target.x, z - wp_target.z) + if distanceToTarget < ADGraphManager.MIN_START_DISTANCE then + table.insert(wp, wp_target) + return wp + end + end + local closestWaypoint = self:findMatchingWayPointForVehicle(vehicle) if closestWaypoint ~= nil then wp = self:pathFromTo(closestWaypoint, waypointId) From 65ee68a3001595eaca92ed07de09909f89328cce Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Wed, 12 May 2021 11:16:34 +0200 Subject: [PATCH 17/46] Fixed my bug in the HUD. Set Park destination was accidentally set as tertiary function. --- FS19_AutoDrive/scripts/Hud.lua | 4 ++-- FS19_AutoDrive/scripts/Utils/AutoDriveUtilFuncs.lua | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/FS19_AutoDrive/scripts/Hud.lua b/FS19_AutoDrive/scripts/Hud.lua index ffe621de..0f6c54d4 100644 --- a/FS19_AutoDrive/scripts/Hud.lua +++ b/FS19_AutoDrive/scripts/Hud.lua @@ -199,8 +199,8 @@ function AutoDriveHud:createHudAt(hudX, hudY) self:AddButton("input_start_stop", nil, nil, "input_ADEnDisable", 1, true) self:AddButton("input_silomode", "input_previousMode", nil, "input_ADSilomode", 1, true) self:AddButton("input_continue", nil, nil, "input_AD_continue", 1, true) - self:AddButton("input_parkVehicle", nil, "input_setParkDestination", "input_ADParkVehicle", 1, true) - self:AddButton("input_incLoopCounter", nil, "input_decLoopCounter", "input_ADIncLoopCounter", 1, true) + self:AddButton("input_parkVehicle", "input_setParkDestination", nil, "input_ADParkVehicle", 1, true) + self:AddButton("input_incLoopCounter", "input_decLoopCounter", nil, "input_ADIncLoopCounter", 1, true) local speedX = self.posX + (self.cols - 1 + self.buttonCollOffset) * self.borderX + (self.cols - 2 + self.buttonCollOffset) * self.buttonWidth local speedY = self.posY + (1) * self.borderY + (0) * self.buttonHeight diff --git a/FS19_AutoDrive/scripts/Utils/AutoDriveUtilFuncs.lua b/FS19_AutoDrive/scripts/Utils/AutoDriveUtilFuncs.lua index 7f8713d3..4b91adcb 100644 --- a/FS19_AutoDrive/scripts/Utils/AutoDriveUtilFuncs.lua +++ b/FS19_AutoDrive/scripts/Utils/AutoDriveUtilFuncs.lua @@ -338,7 +338,6 @@ function AutoDrive.setActualParkDestination(vehicle) -- formatting messageText = string.format(messageText, messageArg) ADMessagesManager:addMessage(ADMessagesManager.messageTypes.INFO, messageText, 5000) - end end end From afadea080bff09721903bba6b89ed384ea94874c Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Wed, 12 May 2021 11:28:35 +0200 Subject: [PATCH 18/46] Version bump --- FS19_AutoDrive/scripts/AutoDrive.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FS19_AutoDrive/scripts/AutoDrive.lua b/FS19_AutoDrive/scripts/AutoDrive.lua index eb73ccfe..ca48dc2b 100644 --- a/FS19_AutoDrive/scripts/AutoDrive.lua +++ b/FS19_AutoDrive/scripts/AutoDrive.lua @@ -1,5 +1,5 @@ AutoDrive = {} -AutoDrive.version = "1.1.1.1-RC1" +AutoDrive.version = "1.1.1.1-RC2" AutoDrive.directory = g_currentModDirectory From 31f15e04f08b3d6f95c4adb96dc537f39e6fd208 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Wed, 12 May 2021 12:33:07 +0200 Subject: [PATCH 19/46] Reverse Driving now always uses the proper reverse driving code to keep the trailers straight. --- .../scripts/Modules/SpecialDrivingModule.lua | 38 ++++++++++++++----- .../scripts/Modules/TrailerModule.lua | 2 +- .../scripts/Tasks/CatchCombinePipeTask.lua | 2 +- .../scripts/Tasks/ClearCropTask.lua | 2 +- .../scripts/Tasks/EmptyHarvesterTask.lua | 2 +- .../scripts/Tasks/FollowCombineTask.lua | 6 +-- 6 files changed, 35 insertions(+), 17 deletions(-) diff --git a/FS19_AutoDrive/scripts/Modules/SpecialDrivingModule.lua b/FS19_AutoDrive/scripts/Modules/SpecialDrivingModule.lua index 683a4e2b..881e0176 100644 --- a/FS19_AutoDrive/scripts/Modules/SpecialDrivingModule.lua +++ b/FS19_AutoDrive/scripts/Modules/SpecialDrivingModule.lua @@ -48,6 +48,11 @@ function ADSpecialDrivingModule:update(dt) dbg.stoppedTimer = self.stoppedTimer.elapsedTime AutoDrive.renderTable(0.6, 0.7, 0.009, dbg) end + + if not self.isReversing then + self.reverseTarget = nil + end + self.isReversing = false end function ADSpecialDrivingModule:isStoppingVehicle() @@ -107,20 +112,29 @@ function ADSpecialDrivingModule:driveForward(dt) AIVehicleUtil.driveInDirection(self.vehicle, dt, 30, acc, 0.2, 20, true, true, lx, lz, speed, 1) end -function ADSpecialDrivingModule:driveReverse(dt, maxSpeed, maxAcceleration) +function ADSpecialDrivingModule:driveReverse(dt, maxSpeed, maxAcceleration, guided) + self.isReversing = true local speed = maxSpeed local acc = maxAcceleration - local targetX, targetY, targetZ = localToWorld(self.vehicle.components[1].node, 0, 0, -20) - local lx, lz = AIVehicleUtil.getDriveDirection(self.vehicle.components[1].node, targetX, targetY, targetZ) if self.vehicle.ad.collisionDetectionModule:checkReverseCollision() then self:stopAndHoldVehicle(dt) else - local storedSmootherDriving = AutoDrive.smootherDriving - AutoDrive.smootherDriving = false - AIVehicleUtil.driveInDirection(self.vehicle, dt, 30, acc, 0.2, 20, true, false, -lx, -lz, speed, 1) - AutoDrive.smootherDriving = storedSmootherDriving + if guided ~= true then + local targetX, targetY, targetZ = localToWorld(self.vehicle.components[1].node, 0, 0, -20) + local lx, lz = AIVehicleUtil.getDriveDirection(self.vehicle.components[1].node, targetX, targetY, targetZ) + local storedSmootherDriving = AutoDrive.smootherDriving + AutoDrive.smootherDriving = false + AIVehicleUtil.driveInDirection(self.vehicle, dt, 30, acc, 0.2, 20, true, false, -lx, -lz, speed, 1) + AutoDrive.smootherDriving = storedSmootherDriving + else + if self.reverseTarget == nil then + local x, y, z = localToWorld(self.vehicle.components[1].node, 0, 0 , -100) + self.reverseTarget = {x=x, y=y, z=z} + end + self.vehicle.ad.specialDrivingModule:reverseToTargetLocation(dt, self.reverseTarget, maxSpeed) + end end end @@ -315,7 +329,10 @@ function ADSpecialDrivingModule:getReverseNode() return reverseNode end -function ADSpecialDrivingModule:reverseToPoint(dt) +function ADSpecialDrivingModule:reverseToPoint(dt, maxSpeed) + if maxSpeed == nil then + maxSpeed = math.huge + end local vehicleIsTruck = self:isTruck(self.vehicle) if self.lastAngleToPoint == nil then @@ -388,13 +405,14 @@ function ADSpecialDrivingModule:reverseToPoint(dt) local storedSmootherDriving = AutoDrive.smootherDriving AutoDrive.smootherDriving = false + speed = math.min(maxSpeed, speed) AIVehicleUtil.driveInDirection(self.vehicle, dt, maxAngle, acc, 0.2, 20, true, false, lx, lz, speed, 1) AutoDrive.smootherDriving = storedSmootherDriving self.lastAngleToPoint = self.angleToPoint end -function ADSpecialDrivingModule:reverseToTargetLocation(dt, location) +function ADSpecialDrivingModule:reverseToTargetLocation(dt, location, maxSpeed) self.reverseNode = self:getReverseNode() if self.reverseNode == nil then return true @@ -413,7 +431,7 @@ function ADSpecialDrivingModule:reverseToTargetLocation(dt, location) if self.vehicle.ad.collisionDetectionModule:checkReverseCollision() then self:stopAndHoldVehicle(dt) else - self:reverseToPoint(dt) + self:reverseToPoint(dt, maxSpeed) end return false diff --git a/FS19_AutoDrive/scripts/Modules/TrailerModule.lua b/FS19_AutoDrive/scripts/Modules/TrailerModule.lua index d51fb29d..a4ad0323 100644 --- a/FS19_AutoDrive/scripts/Modules/TrailerModule.lua +++ b/FS19_AutoDrive/scripts/Modules/TrailerModule.lua @@ -56,7 +56,7 @@ function ADTrailerModule:reset() end function ADTrailerModule:isActiveAtTrigger() - AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_TRAILERINFO, "[AD] ADTrailerModule:isActiveAtTrigger self.isLoading %s self.isUnloading %s", tostring(self.isLoading), tostring(self.isUnloading)) + --AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_TRAILERINFO, "[AD] ADTrailerModule:isActiveAtTrigger self.isLoading %s self.isUnloading %s", tostring(self.isLoading), tostring(self.isUnloading)) return self.isLoading or self.isUnloading end diff --git a/FS19_AutoDrive/scripts/Tasks/CatchCombinePipeTask.lua b/FS19_AutoDrive/scripts/Tasks/CatchCombinePipeTask.lua index 35076112..45829a52 100644 --- a/FS19_AutoDrive/scripts/Tasks/CatchCombinePipeTask.lua +++ b/FS19_AutoDrive/scripts/Tasks/CatchCombinePipeTask.lua @@ -113,7 +113,7 @@ function CatchCombinePipeTask:update(dt) self.reverseTimer:timer(false) self.state = CatchCombinePipeTask.STATE_DELAY_PATHPLANNING else - self.vehicle.ad.specialDrivingModule:driveReverse(dt, 15, 1) + self.vehicle.ad.specialDrivingModule:driveReverse(dt, 15, 1, true) end end end diff --git a/FS19_AutoDrive/scripts/Tasks/ClearCropTask.lua b/FS19_AutoDrive/scripts/Tasks/ClearCropTask.lua index d928e160..190a8b13 100644 --- a/FS19_AutoDrive/scripts/Tasks/ClearCropTask.lua +++ b/FS19_AutoDrive/scripts/Tasks/ClearCropTask.lua @@ -82,7 +82,7 @@ function ClearCropTask:update(dt) elseif distanceToReversStart > 10 then self.state = ClearCropTask.STATE_CLEARING else - self.vehicle.ad.specialDrivingModule:driveReverse(dt, 15, 1) + self.vehicle.ad.specialDrivingModule:driveReverse(dt, 15, 1, true) end end end diff --git a/FS19_AutoDrive/scripts/Tasks/EmptyHarvesterTask.lua b/FS19_AutoDrive/scripts/Tasks/EmptyHarvesterTask.lua index 0b0c6943..957e1571 100644 --- a/FS19_AutoDrive/scripts/Tasks/EmptyHarvesterTask.lua +++ b/FS19_AutoDrive/scripts/Tasks/EmptyHarvesterTask.lua @@ -133,7 +133,7 @@ function EmptyHarvesterTask:update(dt) AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_COMBINEINFO, "EmptyHarvesterTask:update - next: EmptyHarvesterTask.STATE_WAITING") self.state = EmptyHarvesterTask.STATE_WAITING else - self.vehicle.ad.specialDrivingModule:driveReverse(dt, 5, 1) + self.vehicle.ad.specialDrivingModule:driveReverse(dt, 5, 1, true) end elseif self.state == EmptyHarvesterTask.STATE_WAITING then self.waitTimer:timer(true, EmptyHarvesterTask.REVERSE_TIME, dt) diff --git a/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua b/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua index ab429ed7..922fc5c3 100644 --- a/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua +++ b/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua @@ -99,7 +99,7 @@ function FollowCombineTask:update(dt) self.angleWrongTimer:timer(false) --self.stuckTimer:timer(false) elseif ((self.combine.lastSpeedReal * self.combine.movingDirection) <= -0.00005) then - self.vehicle.ad.specialDrivingModule:driveReverse(dt, self.combine.lastSpeedReal * 3600 * 1.3, 1) + self.vehicle.ad.specialDrivingModule:driveReverse(dt, self.combine.lastSpeedReal * 3600 * 1.3, 1, true) else self:followChasePoint(dt) end @@ -166,7 +166,7 @@ function FollowCombineTask:update(dt) AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_COMBINEINFO, "stuck in reversing - set finished") self:finished() else - self.vehicle.ad.specialDrivingModule:driveReverse(dt, 15, 1) + self.vehicle.ad.specialDrivingModule:driveReverse(dt, 15, 1, true) end end end @@ -200,7 +200,7 @@ function FollowCombineTask:updateStates() end function FollowCombineTask:reverse(dt) - self.vehicle.ad.specialDrivingModule:driveReverse(dt, 15, 1) + self.vehicle.ad.specialDrivingModule:driveReverse(dt, 15, 1, true) end function FollowCombineTask:followChasePoint(dt) From 8da82460746bc542a73960d5815c48cd8a6cfc9c Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Wed, 12 May 2021 19:47:46 +0200 Subject: [PATCH 20/46] Decreased stepsPerFrame for path refinement to remove stuttering. Also commented out some of the debug messages for now for performance reasons. --- .../scripts/Modules/PathFinderModule.lua | 57 +++++++++++++------ 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua index 46f3d76c..140f05fc 100644 --- a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua +++ b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua @@ -1555,13 +1555,12 @@ function PathFinderModule:createWayPoints() self.wayPoints[#self.wayPoints + 1] = self.appendWayPoints[i] end self.smoothStep = 3 - PathFinderModule.debugVehicleMsg(self.vehicle, - string.format("[AD] PFM %s createWayPoints appendWayPoints %s", - tostring(self.vehicle:getName()), - tostring(#self.appendWayPoints) - ) - ) - + --PathFinderModule.debugVehicleMsg(self.vehicle, + --string.format("[AD] PFM %s createWayPoints appendWayPoints %s", + --tostring(self.vehicle:getName()), + --tostring(#self.appendWayPoints) + --) + --) end for i = 1, #self.wayPoints, 1 do @@ -1600,12 +1599,12 @@ function PathFinderModule:smoothResultingPPPath() end self.wayPoints = filteredWPs - PathFinderModule.debugVehicleMsg(self.vehicle, - string.format("[AD] PFM %s smoothResultingPPPath self.wayPoints %s", - tostring(self.vehicle:getName()), - tostring(#self.wayPoints) - ) - ) + --PathFinderModule.debugVehicleMsg(self.vehicle, + --string.format("[AD] PFM %s smoothResultingPPPath self.wayPoints %s", + --tostring(self.vehicle:getName()), + --tostring(#self.wayPoints) + --) + --) end @@ -1629,6 +1628,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() if self.smoothStep == 1 then local stepsThisFrame = 0 while self.smoothIndex < #self.wayPoints - unfilteredEndPointCount and stepsThisFrame < ADScheduler:getStepsPerFrame() do + --[[ if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then PathFinderModule.debugVehicleMsg(self.vehicle, string.format("[AD] PFM %s smoothResultingPPPath_Refined self.smoothIndex %d ", @@ -1637,6 +1637,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() ) ) end + --]] stepsThisFrame = stepsThisFrame + 1 local node = self.wayPoints[self.smoothIndex] @@ -1659,9 +1660,10 @@ function PathFinderModule:smoothResultingPPPath_Refined() local y = worldPos.y local foundCollision = false - local stepsOfLookAheadThisFrame = 0 + --local stepsOfLookAheadThisFrame = 0 - while (foundCollision == false or self.totalEagerSteps < 30) and ((self.smoothIndex + self.totalEagerSteps) < (#self.wayPoints - unfilteredEndPointCount)) and stepsOfLookAheadThisFrame < ADScheduler:getStepsPerFrame() do + while (foundCollision == false or self.totalEagerSteps < 30) and ((self.smoothIndex + self.totalEagerSteps) < (#self.wayPoints - unfilteredEndPointCount)) and stepsThisFrame < (ADScheduler:getStepsPerFrame() * 0.4) do + --[[ if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then PathFinderModule.debugVehicleMsg(self.vehicle, string.format("[AD] PFM %s smoothResultingPPPath_Refined self.smoothIndex %d self.totalEagerSteps %d", @@ -1671,8 +1673,9 @@ function PathFinderModule:smoothResultingPPPath_Refined() ) ) end + --]] local hasCollision = false - stepsOfLookAheadThisFrame = stepsOfLookAheadThisFrame + 1 + stepsThisFrame = stepsThisFrame + 1 local nodeAhead = self.wayPoints[self.smoothIndex + self.totalEagerSteps + 1] local nodeTwoAhead = self.wayPoints[self.smoothIndex + self.totalEagerSteps + 2] @@ -1680,6 +1683,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() angle = math.abs(angle) if angle > 60 then hasCollision = true + --[[ if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then PathFinderModule.debugVehicleMsg(self.vehicle, string.format("[AD] PFM %s smoothResultingPPPath_Refined hasCollision %d", @@ -1688,12 +1692,14 @@ function PathFinderModule:smoothResultingPPPath_Refined() ) ) end + --]] end if previousNode ~= nil then angle = AutoDrive.angleBetween({x = node.x - previousNode.x, z = node.z - previousNode.z}, {x = nodeTwoAhead.x - node.x, z = nodeTwoAhead.z - node.z}) angle = math.abs(angle) if angle > 60 then hasCollision = true + --[[ if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then PathFinderModule.debugVehicleMsg(self.vehicle, string.format("[AD] PFM %s smoothResultingPPPath_Refined hasCollision %d", @@ -1702,11 +1708,13 @@ function PathFinderModule:smoothResultingPPPath_Refined() ) ) end + --]] end angle = AutoDrive.angleBetween({x = node.x - previousNode.x, z = node.z - previousNode.z}, {x = nodeAhead.x - node.x, z = nodeAhead.z - node.z}) angle = math.abs(angle) if angle > 60 then hasCollision = true + --[[ if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then PathFinderModule.debugVehicleMsg(self.vehicle, string.format("[AD] PFM %s smoothResultingPPPath_Refined hasCollision %d", @@ -1715,12 +1723,14 @@ function PathFinderModule:smoothResultingPPPath_Refined() ) ) end + --]] end end if not hasCollision then hasCollision = hasCollision or self:checkSlopeAngle(worldPos.x, worldPos.z, nodeAhead.x, nodeAhead.z) if hasCollision then + --[[ if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then PathFinderModule.debugVehicleMsg(self.vehicle, string.format("[AD] PFM %s smoothResultingPPPath_Refined hasCollision %d", @@ -1729,6 +1739,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() ) ) end + --]] end end @@ -1756,6 +1767,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() if not hasCollision then local shapes = overlapBox(worldPos.x + vectorX / 2, y + 3, worldPos.z + vectorZ / 2, 0, angleRad, 0, length / 2 + 2.5, 2.65, sideLength + 1.5, "collisionTestCallbackIgnore", nil, self.mask, true, true, true) hasCollision = hasCollision or (shapes > 0) + --[[ if hasCollision then if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then PathFinderModule.debugVehicleMsg(self.vehicle, @@ -1766,6 +1778,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() ) end end + --]] end if (self.smoothIndex > 1) then @@ -1775,6 +1788,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() if (angleBetween * 1.25) > AITurnStrategy.SLOPE_DETECTION_THRESHOLD then hasCollision = true + --[[ if hasCollision then if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then PathFinderModule.debugVehicleMsg(self.vehicle, @@ -1785,6 +1799,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() ) end end + --]] end end @@ -1812,6 +1827,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() end hasCollision = hasCollision or (fruitValue > 50) if hasCollision then + --[[ if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then PathFinderModule.debugVehicleMsg(self.vehicle, string.format("[AD] PFM %s smoothResultingPPPath_Refined hasCollision %d", @@ -1820,6 +1836,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() ) ) end + --]] break end end @@ -1834,6 +1851,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() fruitValue, _, _, _ = FSDensityMapUtil.getFruitArea(self.fruitToCheck, cornerX, cornerZ, corner2X, corner2Z, corner4X, corner4Z, true, true) end hasCollision = hasCollision or (fruitValue > 50) + --[[ if hasCollision then if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then PathFinderModule.debugVehicleMsg(self.vehicle, @@ -1844,6 +1862,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() ) end end + --]] end end end @@ -1851,6 +1870,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() if not hasCollision then local cellBox = AutoDrive.boundingBoxFromCorners(cornerX, cornerZ, corner2X, corner2Z, corner3X, corner3Z, corner4X, corner4Z) hasCollision = hasCollision or AutoDrive.checkForVehiclePathInBox(cellBox, self.minTurnRadius, self.vehicle) + --[[ if hasCollision then if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then PathFinderModule.debugVehicleMsg(self.vehicle, @@ -1861,6 +1881,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() ) end end + --]] end foundCollision = hasCollision @@ -1872,6 +1893,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() end self.totalEagerSteps = self.totalEagerSteps + 1 + --[[ if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then PathFinderModule.debugVehicleMsg(self.vehicle, string.format("[AD] PFM %s smoothResultingPPPath_Refined self.smoothIndex %d self.totalEagerSteps %d self.filteredIndex %d foundCollision %s", @@ -1883,6 +1905,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() ) ) end + --]] end if self.totalEagerSteps >= 30 or ((self.smoothIndex + self.totalEagerSteps) >= (#self.wayPoints - unfilteredEndPointCount)) then @@ -1908,12 +1931,14 @@ function PathFinderModule:smoothResultingPPPath_Refined() self.wayPoints = self.filteredWPs self.smoothDone = true + --[[ PathFinderModule.debugVehicleMsg(self.vehicle, string.format("[AD] PFM %s smoothResultingPPPath_Refined self.wayPoints %s", tostring(self.vehicle:getName()), tostring(#self.wayPoints) ) ) + --]] end end From 6f41a0e5e90c5e8dfa34d160dd62e2786476c275 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Wed, 12 May 2021 19:48:03 +0200 Subject: [PATCH 21/46] Removed very verbose debug messages. --- .../scripts/Tasks/UnloadAtDestinationTask.lua | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/FS19_AutoDrive/scripts/Tasks/UnloadAtDestinationTask.lua b/FS19_AutoDrive/scripts/Tasks/UnloadAtDestinationTask.lua index 51d56e0d..c54a89c6 100644 --- a/FS19_AutoDrive/scripts/Tasks/UnloadAtDestinationTask.lua +++ b/FS19_AutoDrive/scripts/Tasks/UnloadAtDestinationTask.lua @@ -66,46 +66,46 @@ function UnloadAtDestinationTask:update(dt) self.vehicle.ad.trailerModule:update(dt) end if self.vehicle.ad.drivePathModule:isTargetReached() then - AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isTargetReached") + --AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isTargetReached") if not self.vehicle.ad.trailerModule:isActiveAtTrigger() then - AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isTargetReached isActiveAtTrigger") + --AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isTargetReached isActiveAtTrigger") local trailers, _ = AutoDrive.getTrailersOf(self.vehicle, false) AutoDrive.setTrailerCoverOpen(self.vehicle, trailers, true) local fillLevel, _ = AutoDrive.getFillLevelAndCapacityOfAll(trailers) if fillLevel <= 1 or self.isContinued or (((AutoDrive.getSetting("rotateTargets", self.vehicle) == AutoDrive.RT_ONLYDELIVER or AutoDrive.getSetting("rotateTargets", self.vehicle) == AutoDrive.RT_PICKUPANDDELIVER) and AutoDrive.getSetting("useFolders")) and (not ((self.vehicle.ad.drivePathModule:getIsReversing() and self.vehicle.ad.trailerModule:getBunkerTrigger() ~= nil)))) then - AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_VEHICLEINFO, "[AD] UnloadAtDestinationTask:update fillLevel <= 1") + --AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_VEHICLEINFO, "[AD] UnloadAtDestinationTask:update fillLevel <= 1") AutoDrive.setAugerPipeOpen(trailers, false) self:finished() else - AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update Wait at unload point until unloaded somehow") + -- AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update Wait at unload point until unloaded somehow") -- Wait at unload point until unloaded somehow self.vehicle.ad.specialDrivingModule:stopVehicle() self.vehicle.ad.specialDrivingModule:update(dt) end else - AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isTargetReached NOT isActiveAtTrigger") + --AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isTargetReached NOT isActiveAtTrigger") if self.vehicle.ad.trailerModule:isUnloadingToBunkerSilo() then - AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isTargetReached NOT isActiveAtTrigger isUnloadingToBunkerSilo") + --AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isTargetReached NOT isActiveAtTrigger isUnloadingToBunkerSilo") self.vehicle.ad.drivePathModule:update(dt) else - AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isTargetReached NOT isActiveAtTrigger stopVehicle") + --AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isTargetReached NOT isActiveAtTrigger stopVehicle") self.vehicle.ad.specialDrivingModule:stopVehicle() self.vehicle.ad.specialDrivingModule:update(dt) end end else if self.vehicle.ad.trailerModule:isActiveAtTrigger() then - AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isActiveAtTrigger") + --AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isActiveAtTrigger") if self.vehicle.ad.trailerModule:isUnloadingToBunkerSilo() then - AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isActiveAtTrigger isUnloadingToBunkerSilo") + --AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isActiveAtTrigger isUnloadingToBunkerSilo") self.vehicle.ad.drivePathModule:update(dt) else - AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isActiveAtTrigger stopVehicle") + --AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isActiveAtTrigger stopVehicle") self.vehicle.ad.specialDrivingModule:stopVehicle() self.vehicle.ad.specialDrivingModule:update(dt) end else - AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isActiveAtTrigger drivePathModule:update") + --AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_PATHINFO, "[AD] UnloadAtDestinationTask:update isActiveAtTrigger drivePathModule:update") self.vehicle.ad.drivePathModule:update(dt) end end From 0d0bf81670354e485a46fa221a5bad90ed76dda4 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Wed, 12 May 2021 20:59:26 +0200 Subject: [PATCH 22/46] Removed bug which caused driver to wait a few seconds after emptying a trailer. --- FS19_AutoDrive/scripts/Modules/TrailerModule.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/FS19_AutoDrive/scripts/Modules/TrailerModule.lua b/FS19_AutoDrive/scripts/Modules/TrailerModule.lua index a4ad0323..f59361a7 100644 --- a/FS19_AutoDrive/scripts/Modules/TrailerModule.lua +++ b/FS19_AutoDrive/scripts/Modules/TrailerModule.lua @@ -389,15 +389,16 @@ function ADTrailerModule:updateUnload(dt) AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_TRAILERINFO, "[AD] ADTrailerModule:updateUnload Monitor unloading") --print("Monitor unloading") local _, _, fillUnitEmpty = AutoDrive.getIsEmpty(self.vehicle, self.isUnloadingWithTrailer, self.isUnloadingWithFillUnit) + local allTrailersClosed = self:areAllTrailersClosed(dt) self.unloadDelayTimer:timer(self.isUnloading, 250, dt) if self.unloadDelayTimer:done() then - AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_TRAILERINFO, "[AD] ADTrailerModule:updateUnload Monitor unloading unloadDelayTimer:done areAllTrailersClosed %s", tostring(self:areAllTrailersClosed(dt))) + AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_TRAILERINFO, "[AD] ADTrailerModule:updateUnload Monitor unloading unloadDelayTimer:done areAllTrailersClosed %s", tostring(allTrailersClosed)) self.unloadRetryTimer:timer(self.isUnloading, ADTrailerModule.UNLOAD_RETRY_TIME, dt) - if self:areAllTrailersClosed(dt) and (fillUnitEmpty or ((AutoDrive.getSetting("rotateTargets", self.vehicle) == AutoDrive.RT_ONLYDELIVER or AutoDrive.getSetting("rotateTargets", self.vehicle) == AutoDrive.RT_PICKUPANDDELIVER) and AutoDrive.getSetting("useFolders"))) then + if allTrailersClosed and (fillUnitEmpty or ((AutoDrive.getSetting("rotateTargets", self.vehicle) == AutoDrive.RT_ONLYDELIVER or AutoDrive.getSetting("rotateTargets", self.vehicle) == AutoDrive.RT_PICKUPANDDELIVER) and AutoDrive.getSetting("useFolders"))) then self.unloadDelayTimer:timer(false) -- clear timer self.isUnloading = false self.unloadingToBunkerSilo = false - elseif (self:areAllTrailersClosed(dt) and self.isUnloadingWithTrailer ~= nil and self.isUnloadingWithTrailer.spec_pipe ~= nil) then + elseif allTrailersClosed and self.isUnloadingWithTrailer ~= nil and self.isUnloadingWithTrailer.spec_pipe ~= nil then -- unload auger wagon to another trailer self.unloadDelayTimer:timer(false) -- clear timer self.isUnloading = false From 7863112abfeb5ebe7b553db82a66e56f0c08e4e3 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Wed, 12 May 2021 21:09:57 +0200 Subject: [PATCH 23/46] Added brake hysteresis. --- FS19_AutoDrive/scripts/Modules/DrivePathModule.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/FS19_AutoDrive/scripts/Modules/DrivePathModule.lua b/FS19_AutoDrive/scripts/Modules/DrivePathModule.lua index edcafc57..a9b5b2ad 100644 --- a/FS19_AutoDrive/scripts/Modules/DrivePathModule.lua +++ b/FS19_AutoDrive/scripts/Modules/DrivePathModule.lua @@ -16,6 +16,7 @@ function ADDrivePathModule:new(vehicle) o.minDistanceTimer = AutoDriveTON:new() o.waitTimer = AutoDriveTON:new() o.blinkTimer = AutoDriveTON:new() + o.brakeHysteresisActive = false ADDrivePathModule.reset(o) return o end @@ -267,11 +268,17 @@ function ADDrivePathModule:followWaypoints(dt) self.vehicle.ad.specialDrivingModule:update(dt) else self.vehicle.ad.specialDrivingModule:releaseVehicle() + local speedDiff = (self.vehicle.lastSpeedReal * 3600) - self.speedLimit -- Allow active braking if vehicle is not 'following' targetSpeed precise enough - if (self.vehicle.lastSpeedReal * 3600) > (self.speedLimit + maxSpeedDiff) then - self.acceleration = -0.6 + if speedDiff <= 0.25 then + self.brakeHysteresisActive = false end - + if (speedDiff > maxSpeedDiff) or self.brakeHysteresisActive then + self.brakeHysteresisActive = true + + self.acceleration = -math.min(0.6, speedDiff * 0.05) + end + --print("Speed: " .. (self.vehicle.lastSpeedReal * 3600) .. "/" .. self.speedLimit .. " acc: " .. self.acceleration .. " maxSpeedDiff: " .. maxSpeedDiff) --print("LAD: " .. self.distanceToLookAhead .. " maxAngle: " .. self.maxAngle .. " maxAngleSpeed: " .. self.maxAngleSpeed) --ADDrawingManager:addLineTask(x, y, z, self.targetX, y, self.targetZ, 1, 0, 0) From 4f02ff13ad91d9c940783f87fed598dc2e97e35c Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Thu, 13 May 2021 13:18:10 +0200 Subject: [PATCH 24/46] Added Forward turning manoeuvre. --- FS19_AutoDrive/gui/vehicleSettingsPage.xml | 8 +++ .../scripts/Modules/PathFinderModule.lua | 2 +- .../scripts/Sensors/VirtualSensors.lua | 7 +- FS19_AutoDrive/scripts/Settings.lua | 11 +++ .../scripts/Tasks/FollowCombineTask.lua | 68 ++++++++++++++++++- .../translations/translation_br.xml | 2 + .../translations/translation_cz.xml | 2 + .../translations/translation_de.xml | 2 + .../translations/translation_en.xml | 2 + .../translations/translation_es.xml | 2 + .../translations/translation_fr.xml | 2 + .../translations/translation_hu.xml | 2 + .../translations/translation_it.xml | 2 + .../translations/translation_nl.xml | 2 + .../translations/translation_pl.xml | 2 + .../translations/translation_pt.xml | 2 + .../translations/translation_ru.xml | 2 + .../translations/translation_tr.xml | 2 + 18 files changed, 117 insertions(+), 5 deletions(-) diff --git a/FS19_AutoDrive/gui/vehicleSettingsPage.xml b/FS19_AutoDrive/gui/vehicleSettingsPage.xml index a1c39888..fefd8b73 100644 --- a/FS19_AutoDrive/gui/vehicleSettingsPage.xml +++ b/FS19_AutoDrive/gui/vehicleSettingsPage.xml @@ -146,6 +146,14 @@ + + + + + + + + diff --git a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua index 140f05fc..5ed75954 100644 --- a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua +++ b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua @@ -1475,7 +1475,7 @@ function PathFinderModule:getShapeDefByDirectionType(cell) local increaseCellFactor = 1.15 if cell.isOnField ~= nil and cell.isOnField == true then - increaseCellFactor = 0.65 + increaseCellFactor = 0.8 end shapeDefinition.widthX = shapeDefinition.widthX * increaseCellFactor shapeDefinition.widthZ = shapeDefinition.widthZ * increaseCellFactor diff --git a/FS19_AutoDrive/scripts/Sensors/VirtualSensors.lua b/FS19_AutoDrive/scripts/Sensors/VirtualSensors.lua index 055cf836..919af5fd 100644 --- a/FS19_AutoDrive/scripts/Sensors/VirtualSensors.lua +++ b/FS19_AutoDrive/scripts/Sensors/VirtualSensors.lua @@ -402,13 +402,17 @@ function ADSensor:onDrawDebug(box) end end -function ADSensor:pollInfo(forced, widthFactor) +function ADSensor:pollInfo(forced, widthFactor, lengthFactor) self.executionDelay = self.executionDelay -1 if self.executionDelay <= 0 or forced or AutoDrive.getDebugChannelIsSet(AutoDrive.DC_SENSORINFO) then local storedWidth = self.width if widthFactor ~= nil then self.width = self.width * widthFactor end + local storedLength = self.length + if lengthFactor ~= nil then + self.length = self.length * lengthFactor + end local wasEnabled = self.enabled self:setEnabled(true) if not wasEnabled then @@ -417,6 +421,7 @@ function ADSensor:pollInfo(forced, widthFactor) self.lastTriggered = self:isTriggered() self.executionDelay = ADSensor.EXECUTION_DELAY self.width = storedWidth + self.length = storedLength end return self.lastTriggered diff --git a/FS19_AutoDrive/scripts/Settings.lua b/FS19_AutoDrive/scripts/Settings.lua index 8949f346..60bfb6e3 100644 --- a/FS19_AutoDrive/scripts/Settings.lua +++ b/FS19_AutoDrive/scripts/Settings.lua @@ -949,6 +949,17 @@ AutoDrive.settings.showTipOfTheDay = { isVehicleSpecific = false } +AutoDrive.settings.useForwardTurningManoeuvre = { + values = {false, true}, + texts = {"gui_ad_no", "gui_ad_yes"}, + default = 2, + current = 2, + text = "gui_ad_useForwardTurningManoeuvre", + tooltip = "gui_ad_useForwardTurningManoeuvre_tooltip", + translate = true, + isVehicleSpecific = true +} + function AutoDrive.getSetting(settingName, vehicle) if AutoDrive.settings[settingName] ~= nil then local setting = AutoDrive.settings[settingName] diff --git a/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua b/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua index 922fc5c3..c2a17f37 100644 --- a/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua +++ b/FS19_AutoDrive/scripts/Tasks/FollowCombineTask.lua @@ -4,6 +4,8 @@ FollowCombineTask.STATE_CHASING = 1 FollowCombineTask.STATE_WAIT_FOR_TURN = 2 FollowCombineTask.STATE_REVERSING = 3 FollowCombineTask.STATE_WAIT_FOR_PASS_BY = 4 +FollowCombineTask.STATE_CIRCLING_PATHPLANNING = 5 +FollowCombineTask.STATE_CIRCLING = 6 FollowCombineTask.MAX_REVERSE_DISTANCE = 25 FollowCombineTask.MIN_COMBINE_DISTANCE = 25 @@ -95,9 +97,32 @@ function FollowCombineTask:update(dt) if (AutoDrive.combineIsTurning(self.combine) and (self.angleToCombineHeading > 60 or not self.combine:getIsBufferCombine() or not self.combine.ad.sensors.frontSensorFruit:pollInfo())) or self.angleWrongTimer.elapsedTime > 10000 then --print("Waiting for turn now - 1- t:" .. AutoDrive.boolToString(AutoDrive.combineIsTurning(self.combine)) .. " anglewrongtimer: " .. AutoDrive.boolToString(self.angleWrongTimer.elapsedTime > 10000)) AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_COMBINEINFO, "Detected combine turning: " .. AutoDrive.boolToString(AutoDrive.combineIsTurning(self.combine)) .. " - waiting for turn to be finished next") - self.state = FollowCombineTask.STATE_WAIT_FOR_TURN - self.angleWrongTimer:timer(false) - --self.stuckTimer:timer(false) + + local tryCircling = true + if self.chaseSide ~= nil and self.chaseSide ~= AutoDrive.CHASEPOS_REAR then + if self.chaseSide == AutoDrive.CHASEPOS_LEFT then + if self.vehicle.ad.sensors.frontSensorLong:pollInfo(true, 0.8, 1.5) or self.vehicle.ad.sensors.leftFrontSensor:pollInfo(true, 3, 3) then + tryCircling = false + end + else + if self.vehicle.ad.sensors.frontSensorLong:pollInfo(true, 0.8, 1.5) or self.vehicle.ad.sensors.rightFrontSensor:pollInfo(true, 3, 3) then + tryCircling = false + end + end + else + tryCircling = false + end + + AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_COMBINEINFO, "Circling tests: tryCircling " .. tostring(tryCircling) .. " frontSensor: " .. tostring(self.vehicle.ad.sensors.frontSensorLong:pollInfo(true, 0.8, 1.5)) .. " leftFront: " .. tostring(self.vehicle.ad.sensors.leftFrontSensor:pollInfo(true, 3, 3)) .. " rightFront: " .. tostring(self.vehicle.ad.sensors.rightFrontSensor:pollInfo(true, 3, 3))) + + if tryCircling and AutoDrive.getSetting("useForwardTurningManoeuvre", self.vehicle) and not self.combine:getIsBufferCombine() then + self:startPathPlanningForCircling() + self.state = FollowCombineTask.STATE_CIRCLING_PATHPLANNING + else + self.state = FollowCombineTask.STATE_WAIT_FOR_TURN + self.angleWrongTimer:timer(false) + --self.stuckTimer:timer(false) + end elseif ((self.combine.lastSpeedReal * self.combine.movingDirection) <= -0.00005) then self.vehicle.ad.specialDrivingModule:driveReverse(dt, self.combine.lastSpeedReal * 3600 * 1.3, 1, true) else @@ -168,9 +193,46 @@ function FollowCombineTask:update(dt) else self.vehicle.ad.specialDrivingModule:driveReverse(dt, 15, 1, true) end + elseif self.state == FollowCombineTask.STATE_CIRCLING_PATHPLANNING then + if self.vehicle.ad.pathFinderModule:hasFinished() then + self.wayPoints = self.vehicle.ad.pathFinderModule:getPath() + if self.wayPoints == nil or #self.wayPoints == 0 then + AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_COMBINEINFO, "Could not find a path for circling - reversing next") + local x, y, z = getWorldTranslation(self.vehicle.components[1].node) + self.reverseStartLocation = {x = x, y = y, z = z} + self.state = FollowCombineTask.STATE_REVERSING + else + self.vehicle.ad.drivePathModule:setWayPoints(self.wayPoints) + self.state = FollowCombineTask.STATE_CIRCLING + end + else + self.vehicle.ad.pathFinderModule:update(dt) + self.vehicle.ad.specialDrivingModule:stopVehicle() + self.vehicle.ad.specialDrivingModule:update(dt) + end + elseif self.state == FollowCombineTask.STATE_CIRCLING then + if self.vehicle.ad.drivePathModule:isTargetReached() then + self:finished() + else + self.vehicle.ad.drivePathModule:update(dt) + end end end +function FollowCombineTask:startPathPlanningForCircling() + local sideOffset = 0 + if self.chaseSide ~= nil and self.chaseSide == AutoDrive.CHASEPOS_LEFT then + sideOffset = 8 + elseif self.chaseSide ~= nil and self.chaseSide == AutoDrive.CHASEPOS_RIGHT then + sideOffset = -8 + end + + local targetPos = AutoDrive.createWayPointRelativeToVehicle(self.vehicle, sideOffset, 0) + local directionX, directionY, directionZ = localToWorld(self.vehicle.components[1].node, 0, 0, 0) + local direction = {x = directionX - targetPos.x, z = directionZ - targetPos.z} + self.vehicle.ad.pathFinderModule:startPathPlanningTo(targetPos, direction) +end + function FollowCombineTask:updateStates() local x, y, z = getWorldTranslation(self.vehicle.components[1].node) local cx, cy, cz = getWorldTranslation(self.combine.components[1].node) diff --git a/FS19_AutoDrive/translations/translation_br.xml b/FS19_AutoDrive/translations/translation_br.xml index 241aa31c..674c0e76 100644 --- a/FS19_AutoDrive/translations/translation_br.xml +++ b/FS19_AutoDrive/translations/translation_br.xml @@ -187,6 +187,8 @@ + + diff --git a/FS19_AutoDrive/translations/translation_cz.xml b/FS19_AutoDrive/translations/translation_cz.xml index 6593e68c..d9256955 100644 --- a/FS19_AutoDrive/translations/translation_cz.xml +++ b/FS19_AutoDrive/translations/translation_cz.xml @@ -187,6 +187,8 @@ + + diff --git a/FS19_AutoDrive/translations/translation_de.xml b/FS19_AutoDrive/translations/translation_de.xml index 2b02c867..9fbf207d 100644 --- a/FS19_AutoDrive/translations/translation_de.xml +++ b/FS19_AutoDrive/translations/translation_de.xml @@ -187,6 +187,8 @@ + + diff --git a/FS19_AutoDrive/translations/translation_en.xml b/FS19_AutoDrive/translations/translation_en.xml index 8499def6..ac30021c 100644 --- a/FS19_AutoDrive/translations/translation_en.xml +++ b/FS19_AutoDrive/translations/translation_en.xml @@ -187,6 +187,8 @@ + + diff --git a/FS19_AutoDrive/translations/translation_es.xml b/FS19_AutoDrive/translations/translation_es.xml index f3f09851..86c5e07c 100644 --- a/FS19_AutoDrive/translations/translation_es.xml +++ b/FS19_AutoDrive/translations/translation_es.xml @@ -185,6 +185,8 @@ + + diff --git a/FS19_AutoDrive/translations/translation_fr.xml b/FS19_AutoDrive/translations/translation_fr.xml index d9291335..571d02bd 100644 --- a/FS19_AutoDrive/translations/translation_fr.xml +++ b/FS19_AutoDrive/translations/translation_fr.xml @@ -173,6 +173,8 @@ + + diff --git a/FS19_AutoDrive/translations/translation_hu.xml b/FS19_AutoDrive/translations/translation_hu.xml index d1f18d79..d9780800 100644 --- a/FS19_AutoDrive/translations/translation_hu.xml +++ b/FS19_AutoDrive/translations/translation_hu.xml @@ -185,6 +185,8 @@ + + diff --git a/FS19_AutoDrive/translations/translation_it.xml b/FS19_AutoDrive/translations/translation_it.xml index 90ab151d..0dce46aa 100644 --- a/FS19_AutoDrive/translations/translation_it.xml +++ b/FS19_AutoDrive/translations/translation_it.xml @@ -187,6 +187,8 @@ + + diff --git a/FS19_AutoDrive/translations/translation_nl.xml b/FS19_AutoDrive/translations/translation_nl.xml index 62c93a24..ac215254 100644 --- a/FS19_AutoDrive/translations/translation_nl.xml +++ b/FS19_AutoDrive/translations/translation_nl.xml @@ -187,6 +187,8 @@ + + diff --git a/FS19_AutoDrive/translations/translation_pl.xml b/FS19_AutoDrive/translations/translation_pl.xml index c0bc590d..9e973cae 100644 --- a/FS19_AutoDrive/translations/translation_pl.xml +++ b/FS19_AutoDrive/translations/translation_pl.xml @@ -185,6 +185,8 @@ + + diff --git a/FS19_AutoDrive/translations/translation_pt.xml b/FS19_AutoDrive/translations/translation_pt.xml index 2c66c2f3..43971693 100644 --- a/FS19_AutoDrive/translations/translation_pt.xml +++ b/FS19_AutoDrive/translations/translation_pt.xml @@ -187,6 +187,8 @@ + + diff --git a/FS19_AutoDrive/translations/translation_ru.xml b/FS19_AutoDrive/translations/translation_ru.xml index 282ae5d2..027d4c03 100644 --- a/FS19_AutoDrive/translations/translation_ru.xml +++ b/FS19_AutoDrive/translations/translation_ru.xml @@ -187,6 +187,8 @@ + + diff --git a/FS19_AutoDrive/translations/translation_tr.xml b/FS19_AutoDrive/translations/translation_tr.xml index 7789f1c7..6271dfa8 100644 --- a/FS19_AutoDrive/translations/translation_tr.xml +++ b/FS19_AutoDrive/translations/translation_tr.xml @@ -185,6 +185,8 @@ + + From 4d7e015a968135f471f9775f1bb50d3b7f1f1ba4 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Thu, 13 May 2021 15:47:23 +0200 Subject: [PATCH 25/46] Bugfix. Allow at least one stepPerFrame. --- FS19_AutoDrive/scripts/Modules/PathFinderModule.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua index 5ed75954..631dc3e8 100644 --- a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua +++ b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua @@ -1662,7 +1662,7 @@ function PathFinderModule:smoothResultingPPPath_Refined() --local stepsOfLookAheadThisFrame = 0 - while (foundCollision == false or self.totalEagerSteps < 30) and ((self.smoothIndex + self.totalEagerSteps) < (#self.wayPoints - unfilteredEndPointCount)) and stepsThisFrame < (ADScheduler:getStepsPerFrame() * 0.4) do + while (foundCollision == false or self.totalEagerSteps < 30) and ((self.smoothIndex + self.totalEagerSteps) < (#self.wayPoints - unfilteredEndPointCount)) and stepsThisFrame <= math.max(1, (ADScheduler:getStepsPerFrame() * 0.4)) do --[[ if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then PathFinderModule.debugVehicleMsg(self.vehicle, From f697123abf3f031071581f659d75c8bfb5a15d2c Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Sat, 15 May 2021 13:34:54 +0200 Subject: [PATCH 26/46] Potential fix for dedi servers due to Tip of the day feature. --- FS19_AutoDrive/scripts/TipOfTheDayHandler.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua b/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua index 35fdb805..68800fa2 100644 --- a/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua +++ b/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua @@ -37,6 +37,10 @@ function AutoDrive.initTipOfTheDay() end function AutoDrive.handleTipOfTheDay(dt) + if g_server ~= nil then + return + end + if (AutoDrive.getSetting("showTipOfTheDay") or AutoDrive.tipOfTheDay.Entries[AutoDrive.tipOfTheDay.highestTipId + 1] ~= nil) and not AutoDrive.tipOfTheDay.displayedYet then -- The idea is to still diplay new tips that arrived with a new AutoDrive version if not AutoDrive.getSetting("showTipOfTheDay") then From 116955803b93987775d1ed3ef31905588c4c1c13 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Sat, 15 May 2021 19:48:04 +0200 Subject: [PATCH 27/46] Tip of the day - Dedi fix --- FS19_AutoDrive/modDesc.xml | 2 +- FS19_AutoDrive/scripts/TipOfTheDayHandler.lua | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/FS19_AutoDrive/modDesc.xml b/FS19_AutoDrive/modDesc.xml index 28691243..3ecf1a8b 100644 --- a/FS19_AutoDrive/modDesc.xml +++ b/FS19_AutoDrive/modDesc.xml @@ -130,7 +130,7 @@ Traduit avec www.DeepL.com/Translator (version gratuite) - 1.1.1.0 + 1.1.1.1 icon.dds diff --git a/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua b/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua index 68800fa2..179db621 100644 --- a/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua +++ b/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua @@ -32,12 +32,19 @@ AutoDrive.tipOfTheDay.currentTipId = 1 AutoDrive.tipOfTheDay.highestTipId = 1 AutoDrive.tipOfTheDay.displayedYet = false +AutoDrive.tipOfTheDay.delayTime = 500 + function AutoDrive.initTipOfTheDay() end function AutoDrive.handleTipOfTheDay(dt) - if g_server ~= nil then + if not (g_server ~= nil and g_client ~= nil) then + return + end + + if AutoDrive.tipOfTheDay.delayTime > 0 then + AutoDrive.tipOfTheDay.delayTime = AutoDrive.tipOfTheDay.delayTime - dt return end From d75a7ab5af26f5d8a5b9a824d7b5ac5dfb3351f4 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Sat, 15 May 2021 23:16:49 +0200 Subject: [PATCH 28/46] Added fourth button functionality. LShift + Left mouse / right mouse for 3 and 4. --- FS19_AutoDrive/scripts/Hud.lua | 67 ++++++++++-------- FS19_AutoDrive/scripts/Hud/HudButton.lua | 16 +++-- .../scripts/Manager/InputManager.lua | 18 +++-- .../scripts/Modules/StateModule.lua | 15 +++- FS19_AutoDrive/scripts/Specialization.lua | 10 +-- FS19_AutoDrive/textures/input_record_5.dds | Bin 0 -> 16512 bytes 6 files changed, 84 insertions(+), 42 deletions(-) create mode 100644 FS19_AutoDrive/textures/input_record_5.dds diff --git a/FS19_AutoDrive/scripts/Hud.lua b/FS19_AutoDrive/scripts/Hud.lua index 0f6c54d4..2a9686b2 100644 --- a/FS19_AutoDrive/scripts/Hud.lua +++ b/FS19_AutoDrive/scripts/Hud.lua @@ -169,7 +169,7 @@ function AutoDriveHud:createHudAt(hudX, hudY) local posX = self.posX + self.width - (closeWidth * 1.1) local posY = self.rowHeader -- close crossing - table.insert(self.hudElements, ADHudButton:new(posX, posY, closeWidth, closeHeight, "input_toggleHud", nil, nil, "", 1, true)) + table.insert(self.hudElements, ADHudButton:new(posX, posY, closeWidth, closeHeight, "input_toggleHud", nil, nil, nil, "", 1, true)) -- axel - is this used? table.insert(self.hudElements, ADHudIcon:new(self.posX, self.row4, self.iconWidth, self.iconHeight, AutoDrive.directory .. "textures/destination.dds", 1, "destinationOverlay")) @@ -196,18 +196,18 @@ function AutoDriveHud:createHudAt(hudX, hudY) ) -------- BASE ROW BUTTONS -------------- - self:AddButton("input_start_stop", nil, nil, "input_ADEnDisable", 1, true) - self:AddButton("input_silomode", "input_previousMode", nil, "input_ADSilomode", 1, true) - self:AddButton("input_continue", nil, nil, "input_AD_continue", 1, true) - self:AddButton("input_parkVehicle", "input_setParkDestination", nil, "input_ADParkVehicle", 1, true) - self:AddButton("input_incLoopCounter", "input_decLoopCounter", nil, "input_ADIncLoopCounter", 1, true) + self:AddButton("input_start_stop", nil, nil, nil, "input_ADEnDisable", 1, true) + self:AddButton("input_silomode", "input_previousMode", nil, nil, "input_ADSilomode", 1, true) + self:AddButton("input_continue", nil, nil, nil, "input_AD_continue", 1, true) + self:AddButton("input_parkVehicle", "input_setParkDestination", nil, nil, "input_ADParkVehicle", 1, true) + self:AddButton("input_incLoopCounter", "input_decLoopCounter", nil, nil, "input_ADIncLoopCounter", 1, true) local speedX = self.posX + (self.cols - 1 + self.buttonCollOffset) * self.borderX + (self.cols - 2 + self.buttonCollOffset) * self.buttonWidth local speedY = self.posY + (1) * self.borderY + (0) * self.buttonHeight table.insert(self.hudElements, ADHudSpeedmeter:new(speedX, speedY, self.buttonWidth, self.buttonHeight, false)) self.buttonCounter = self.buttonCounter + 1 - self:AddButton("input_debug", "input_displayMapPoints", nil, "input_ADActivateDebug", 1, true) + self:AddButton("input_debug", "input_displayMapPoints", nil, nil, "input_ADActivateDebug", 1, true) -------------------------------------------------- ---------- SECOND ROW BUTTONS --------------------- @@ -222,10 +222,10 @@ function AutoDriveHud:createHudAt(hudX, hudY) self:AddEditModeButtons() if g_courseplay ~= nil then self.buttonCounter = self.buttonCounter - 1 - self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 1, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, nil, "hud_startCp", 1, true) elseif (vehicle ~= nil and vehicle.acParameters ~= nil) then self.buttonCounter = self.buttonCounter - 1 - self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 3, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, nil, "hud_startCp", 3, true) end end @@ -234,16 +234,16 @@ function AutoDriveHud:createHudAt(hudX, hudY) table.insert(self.hudElements, ADHudSpeedmeter:new(speedX, speedY, self.buttonWidth, self.buttonHeight, true)) self.buttonCounter = self.buttonCounter + 1 - self:AddButton("input_openGUI", nil, nil, "input_ADOpenGUI", 1, true) + self:AddButton("input_openGUI", nil, nil, nil, "input_ADOpenGUI", 1, true) else self:AddEditModeButtons() if AutoDrive.getSetting("addSettingsToHUD") then self.buttonCounter = self.buttonCounter - 5 if g_courseplay ~= nil then - self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 1, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, nil, "hud_startCp", 1, true) elseif (vehicle ~= nil and vehicle.acParameters ~= nil) then - self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 3, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, nil, "hud_startCp", 3, true) else self:AddSettingsButton("enableTrafficDetection", "gui_ad_enableTrafficDetection", 1, true) end @@ -255,10 +255,10 @@ function AutoDriveHud:createHudAt(hudX, hudY) else if g_courseplay ~= nil then self.buttonCounter = self.buttonCounter - 1 - self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 1, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, nil, "hud_startCp", 1, true) elseif (vehicle ~= nil and vehicle.acParameters ~= nil) then self.buttonCounter = self.buttonCounter - 1 - self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 3, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, nil, "hud_startCp", 3, true) end end @@ -267,7 +267,7 @@ function AutoDriveHud:createHudAt(hudX, hudY) table.insert(self.hudElements, ADHudSpeedmeter:new(speedX, speedY, self.buttonWidth, self.buttonHeight, true)) self.buttonCounter = self.buttonCounter + 1 - self:AddButton("input_openGUI", nil, nil, "input_ADOpenGUI", 1, true) + self:AddButton("input_openGUI", nil, nil, nil, "input_ADOpenGUI", 1, true) end -------------------------------------------------- @@ -276,9 +276,9 @@ function AutoDriveHud:createHudAt(hudX, hudY) self:AddEditModeButtons() if g_courseplay ~= nil then - self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 1, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, nil, "hud_startCp", 1, true) elseif (vehicle ~= nil and vehicle.acParameters ~= nil) then - self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, "hud_startCp", 3, true) + self:AddButton("input_startCp", "input_toggleCP_AIVE", nil, nil, "hud_startCp", 3, true) end end @@ -287,17 +287,17 @@ function AutoDriveHud:createHudAt(hudX, hudY) end function AutoDriveHud:AddEditModeButtons() - self:AddButton("input_record", "input_record_dual", "input_record_subPrio", "input_ADRecord", 1, false) - self:AddButton("input_routesManager", nil, nil, "input_AD_routes_manager", 1, false) - self:AddButton("input_createMapMarker", nil, nil, "input_ADDebugCreateMapMarker", 1, false) - self:AddButton("input_removeWaypoint", "input_removeMapMarker", nil, "input_ADDebugDeleteWayPoint", 1, false) - self:AddButton("input_editMapMarker", nil, nil, "input_ADRenameMapMarker", 1, false) + self:AddButton("input_record", "input_record_dual", "input_record_subPrio", "input_record_subPrioDual", "input_ADRecord", 1, false) + self:AddButton("input_routesManager", nil, nil, nil, "input_AD_routes_manager", 1, false) + self:AddButton("input_createMapMarker", nil, nil, nil, "input_ADDebugCreateMapMarker", 1, false) + self:AddButton("input_removeWaypoint", "input_removeMapMarker", nil, nil, "input_ADDebugDeleteWayPoint", 1, false) + self:AddButton("input_editMapMarker", nil, nil, nil, "input_ADRenameMapMarker", 1, false) if AutoDrive.getSetting("wideHUD") and AutoDrive.getSetting("addSettingsToHUD") then - self:AddButton("input_removeMapMarker", nil, nil, "input_ADDebugDeleteDestination", 1, false) + self:AddButton("input_removeMapMarker", nil, nil, nil, "input_ADDebugDeleteDestination", 1, false) end end -function AutoDriveHud:AddButton(primaryAction, secondaryAction, tertiaryAction, toolTip, state, visible) +function AutoDriveHud:AddButton(primaryAction, secondaryAction, tertiaryAction, quatenaryAction, toolTip, state, visible) self.buttonCounter = self.buttonCounter + 1 self.colCurrent = self.buttonCounter % self.cols if self.colCurrent == 0 then @@ -309,7 +309,7 @@ function AutoDriveHud:AddButton(primaryAction, secondaryAction, tertiaryAction, local posX = self.posX + self.colCurrent * self.borderX + (self.colCurrent - 1) * self.buttonWidth local posY = self.posY + (self.rowCurrent) * self.borderY + (self.rowCurrent - 1) * self.buttonHeight --toolTip = string.sub(g_i18n:getText(toolTip), 4, string.len(g_i18n:getText(toolTip))) - table.insert(self.hudElements, ADHudButton:new(posX, posY, self.buttonWidth, self.buttonHeight, primaryAction, secondaryAction, tertiaryAction, toolTip, state, visible)) + table.insert(self.hudElements, ADHudButton:new(posX, posY, self.buttonWidth, self.buttonHeight, primaryAction, secondaryAction, tertiaryAction, quatenaryAction, toolTip, state, visible)) end function AutoDriveHud:AddSettingsButton(setting, toolTip, state, visible) @@ -505,13 +505,12 @@ function AutoDriveHud:mouseEvent(vehicle, posX, posY, isDown, isUp, button) end if button == 1 and isUp and AutoDrive.leftALTmodifierKeyPressed and AutoDrive.leftCTRLmodifierKeyPressed and vehicle.ad.hoveredNodeId ~= nil then - g_logManager:info("[AD]toggling subPrio marker now for " .. vehicle.ad.hoveredNodeId) ADGraphManager:toggleWayPointAsSubPrio(vehicle.ad.hoveredNodeId) end --If no node is hovered / moved - create new node if vehicle.ad.nodeToMoveId == nil and vehicle.ad.hoveredNodeId == nil then - if button == 1 and isUp and not AutoDrive.leftALTmodifierKeyPressed and AutoDrive.leftCTRLmodifierKeyPressed then + if button == 1 and isUp and AutoDrive.leftCTRLmodifierKeyPressed then --For rough depth assertion, we use the closest nodes location as this is roughly in the screen's center local closest = vehicle:getClosestWayPoint() closest = ADGraphManager:getWayPointById(closest) @@ -556,7 +555,19 @@ function AutoDriveHud:mouseEvent(vehicle, posX, posY, isDown, isUp, button) local createdId = ADGraphManager:getWayPointsCount() if vehicle.ad.newcreated ~= nil and vehicle.ad.selectedNodeId == vehicle.ad.newcreated then -- connect only if previous created point is selected and newcreated ~= nil - ADGraphManager:toggleConnectionBetween(ADGraphManager:getWayPointById(vehicle.ad.selectedNodeId), ADGraphManager:getWayPointById(createdId), AutoDrive.leftLSHIFTmodifierKeyPressed) + + -- lalt -> dual + -- lshift -> reverse + -- lcaps -> subPrio + + ADGraphManager:toggleConnectionBetween(ADGraphManager:getWayPointById(vehicle.ad.selectedNodeId), ADGraphManager:getWayPointById(createdId), AutoDrive.leftLSHIFTmodifierKeyPressed) + if AutoDrive.leftALTmodifierKeyPressed then + ADGraphManager:toggleConnectionBetween(ADGraphManager:getWayPointById(createdId), ADGraphManager:getWayPointById(vehicle.ad.selectedNodeId), AutoDrive.leftLSHIFTmodifierKeyPressed) + end + + if AutoDrive.isCAPSKeyActive then + ADGraphManager:toggleWayPointAsSubPrio(vehicle.ad.selectedNodeId) + end end vehicle.ad.newcreated = createdId vehicle.ad.selectedNodeId = vehicle.ad.newcreated diff --git a/FS19_AutoDrive/scripts/Hud/HudButton.lua b/FS19_AutoDrive/scripts/Hud/HudButton.lua index 30a2a9b0..fa80ca08 100644 --- a/FS19_AutoDrive/scripts/Hud/HudButton.lua +++ b/FS19_AutoDrive/scripts/Hud/HudButton.lua @@ -1,11 +1,12 @@ ADHudButton = ADInheritsFrom(ADGenericHudElement) -function ADHudButton:new(posX, posY, width, height, primaryAction, secondaryAction, tertiaryAction, toolTip, state, visible) +function ADHudButton:new(posX, posY, width, height, primaryAction, secondaryAction, tertiaryAction, quatenaryAction, toolTip, state, visible) local o = ADHudButton:create() o:init(posX, posY, width, height) o.primaryAction = primaryAction o.secondaryAction = secondaryAction o.tertiaryAction = tertiaryAction + o.quatenaryAction = quatenaryAction o.toolTip = toolTip o.state = state o.isVisible = visible @@ -69,6 +70,9 @@ function ADHudButton:getNewState(vehicle) if vehicle.ad.stateModule:isInSubPrioCreationMode() then newState = 4 end + if vehicle.ad.stateModule:isInSubPrioDualCreationMode() then + newState = 5 + end else newState = 1 end @@ -195,15 +199,17 @@ function ADHudButton:act(vehicle, posX, posY, isDown, isUp, button) end end - if button == 1 and isUp then + if button == 1 and isUp and not AutoDrive.leftLSHIFTmodifierKeyPressed then ADInputManager:onInputCall(vehicle, self.primaryAction) return true - elseif (button == 3 or button == 2) and isUp then + elseif (button == 3 or button == 2) and isUp and not AutoDrive.leftLSHIFTmodifierKeyPressed then ADInputManager:onInputCall(vehicle, self.secondaryAction) return true - elseif button == 4 and isUp then + elseif button == 1 and isUp and AutoDrive.leftLSHIFTmodifierKeyPressed then ADInputManager:onInputCall(vehicle, self.tertiaryAction) - AutoDrive.mouseWheelActive = true + return true + elseif (button == 3 or button == 2) and isUp and AutoDrive.leftLSHIFTmodifierKeyPressed then + ADInputManager:onInputCall(vehicle, self.quatenaryAction) return true end end diff --git a/FS19_AutoDrive/scripts/Manager/InputManager.lua b/FS19_AutoDrive/scripts/Manager/InputManager.lua index d21c1c20..f33633b8 100644 --- a/FS19_AutoDrive/scripts/Manager/InputManager.lua +++ b/FS19_AutoDrive/scripts/Manager/InputManager.lua @@ -5,6 +5,7 @@ ADInputManager.actionsToInputs = { ADRecord = "input_record", ADRecord_Dual = "input_record_dual", ADRecord_SubPrio = "input_record_subPrio", + ADRecord_SubPrioDual = "input_record_subPrioDual", ADEnDisable = "input_start_stop", ADSelectTarget = "input_nextTarget", ADSelectPreviousTarget = "input_previousTarget", @@ -75,7 +76,8 @@ ADInputManager.inputsToIds = { input_previousTarget = 24, input_startCp = 25, input_toggleCP_AIVE = 26, - input_record_subPrio = 27 + input_record_subPrio = 27, + input_record_subPrioDual = 28 } ADInputManager.idsToInputs = {} @@ -267,7 +269,7 @@ function ADInputManager:input_previousMode(vehicle) end function ADInputManager:input_record(vehicle) - if not vehicle.ad.stateModule:isInCreationMode() and not vehicle.ad.stateModule:isInDualCreationMode() and not vehicle.ad.stateModule:isInSubPrioCreationMode() then + if not vehicle.ad.stateModule:isInCreationMode() and not vehicle.ad.stateModule:isInDualCreationMode() and not vehicle.ad.stateModule:isInSubPrioCreationMode() and not vehicle.ad.stateModule:isInSubPrioDualCreationMode() then vehicle.ad.stateModule:startNormalCreationMode() else vehicle.ad.stateModule:disableCreationMode() @@ -275,7 +277,7 @@ function ADInputManager:input_record(vehicle) end function ADInputManager:input_record_dual(vehicle) - if not vehicle.ad.stateModule:isInCreationMode() and not vehicle.ad.stateModule:isInDualCreationMode() and not vehicle.ad.stateModule:isInSubPrioCreationMode() then + if not vehicle.ad.stateModule:isInCreationMode() and not vehicle.ad.stateModule:isInDualCreationMode() and not vehicle.ad.stateModule:isInSubPrioCreationMode() and not vehicle.ad.stateModule:isInSubPrioDualCreationMode() then vehicle.ad.stateModule:startDualCreationMode() else vehicle.ad.stateModule:disableCreationMode() @@ -283,13 +285,21 @@ function ADInputManager:input_record_dual(vehicle) end function ADInputManager:input_record_subPrio(vehicle) - if not vehicle.ad.stateModule:isInCreationMode() and not vehicle.ad.stateModule:isInDualCreationMode() and not vehicle.ad.stateModule:isInSubPrioCreationMode() then + if not vehicle.ad.stateModule:isInCreationMode() and not vehicle.ad.stateModule:isInDualCreationMode() and not vehicle.ad.stateModule:isInSubPrioCreationMode() and not vehicle.ad.stateModule:isInSubPrioDualCreationMode() then vehicle.ad.stateModule:startSubPrioCreationMode() else vehicle.ad.stateModule:disableCreationMode() end end +function ADInputManager:input_record_subPrioDual(vehicle) + if not vehicle.ad.stateModule:isInCreationMode() and not vehicle.ad.stateModule:isInDualCreationMode() and not vehicle.ad.stateModule:isInSubPrioCreationMode() and not vehicle.ad.stateModule:isInSubPrioDualCreationMode() then + vehicle.ad.stateModule:startSubPrioDualCreationMode() + else + vehicle.ad.stateModule:disableCreationMode() + end +end + function ADInputManager:input_debug(vehicle) AutoDrive.cycleEditMode() end diff --git a/FS19_AutoDrive/scripts/Modules/StateModule.lua b/FS19_AutoDrive/scripts/Modules/StateModule.lua index 834b3d69..e14ebdae 100644 --- a/FS19_AutoDrive/scripts/Modules/StateModule.lua +++ b/FS19_AutoDrive/scripts/Modules/StateModule.lua @@ -4,6 +4,7 @@ ADStateModule.CREATE_OFF = 1 ADStateModule.CREATE_NORMAL = 2 ADStateModule.CREATE_DUAL = 3 ADStateModule.CREATE_SUB_PRIO = 4 +ADStateModule.CREATE_SUB_PRIO_DUAL = 5 ADStateModule.CALCULATE_REMAINING_DRIVETIME_INTERVAL = 1000 @@ -432,7 +433,7 @@ function ADStateModule:setActive(active) end function ADStateModule:isInCreationMode() - return (self.creationMode == ADStateModule.CREATE_NORMAL) or (self.creationMode == ADStateModule.CREATE_DUAL) or (self.creationMode == ADStateModule.CREATE_SUB_PRIO) + return (self.creationMode == ADStateModule.CREATE_NORMAL) or (self.creationMode == ADStateModule.CREATE_DUAL) or (self.creationMode == ADStateModule.CREATE_SUB_PRIO) or (self.creationMode == ADStateModule.CREATE_SUB_PRIO_DUAL) end function ADStateModule:isInNormalCreationMode() @@ -447,6 +448,10 @@ function ADStateModule:isInSubPrioCreationMode() return self.creationMode == ADStateModule.CREATE_SUB_PRIO end +function ADStateModule:isInSubPrioDualCreationMode() + return self.creationMode == ADStateModule.CREATE_SUB_PRIO_DUAL +end + function ADStateModule:disableCreationMode() self.creationMode = ADStateModule.CREATE_OFF self:raiseDirtyFlag() @@ -479,6 +484,14 @@ function ADStateModule:startSubPrioCreationMode() end end +function ADStateModule:startSubPrioDualCreationMode() + self.creationMode = ADStateModule.CREATE_SUB_PRIO_DUAL + self:raiseDirtyFlag() + if self.vehicle.ad.recordingModule ~= nil then + self.vehicle.ad.recordingModule:start(true, true) + end +end + function ADStateModule:getLoopCounter() return self.loopCounter end diff --git a/FS19_AutoDrive/scripts/Specialization.lua b/FS19_AutoDrive/scripts/Specialization.lua index 74d6211a..6b880d6d 100644 --- a/FS19_AutoDrive/scripts/Specialization.lua +++ b/FS19_AutoDrive/scripts/Specialization.lua @@ -593,10 +593,12 @@ function AutoDrive:onDrawEditorMode() local nWp = ADGraphManager:getWayPointById(neighbor) if point.incoming == nil or table.contains(point.incoming, neighbor) then --draw dual way line - if isSubPrio then - DrawingManager:addLineTask(x, y, z, nWp.x, nWp.y, nWp.z, 0.389, 0.177, 0) - else - DrawingManager:addLineTask(x, y, z, nWp.x, nWp.y, nWp.z, 0, 0, 1) + if point.id > nWp.id then + if isSubPrio then + DrawingManager:addLineTask(x, y, z, nWp.x, nWp.y, nWp.z, 0.389, 0.177, 0) + else + DrawingManager:addLineTask(x, y, z, nWp.x, nWp.y, nWp.z, 0, 0, 1) + end end else --draw line with direction markers (arrow) diff --git a/FS19_AutoDrive/textures/input_record_5.dds b/FS19_AutoDrive/textures/input_record_5.dds new file mode 100644 index 0000000000000000000000000000000000000000..92cf879dad06ebe12715c3f3a00fa947443d41ca GIT binary patch literal 16512 zcmeHOZ)jWB6+iFAN@QBcQiGVgY|9hqh4_ODVz?04;6*ruxQr-?o}#&q^W-!Rj>!S4;b_Xpx|fE-d{yq+S(3w z)NkPD7W&e#vJO9OiP+B{+s^mcvj9E_e*A7v*faw-K+__TQ>VTjXFDQ+OU(59O*5A( z6h=#bIsmyEz1H-hLP$Lx`s_I289TvDvH%5M0D*VxAarYQXjda&QvI8!PxpT{bDzyH zR%}1e+s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Xb Date: Sun, 16 May 2021 11:50:42 +0200 Subject: [PATCH 29/46] Adjusted recording and connecting of waypoints. --- FS19_AutoDrive/scripts/AutoDrive.lua | 1 + FS19_AutoDrive/scripts/Hud.lua | 37 ++++++++++++++----- .../scripts/Modules/RecordingModule.lua | 6 ++- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/FS19_AutoDrive/scripts/AutoDrive.lua b/FS19_AutoDrive/scripts/AutoDrive.lua index ca48dc2b..aa6b9d89 100644 --- a/FS19_AutoDrive/scripts/AutoDrive.lua +++ b/FS19_AutoDrive/scripts/AutoDrive.lua @@ -250,6 +250,7 @@ function AutoDrive:keyEvent(unicode, sym, modifier, isDown) AutoDrive.leftLSHIFTmodifierKeyPressed = bitAND(modifier, Input.MOD_LSHIFT) > 0 AutoDrive.isCAPSKeyActive = bitAND(modifier, Input.MOD_CAPS) > 0 AutoDrive.rightCTRLmodifierKeyPressed = bitAND(modifier, Input.MOD_RCTRL) > 0 + AutoDrive.rightSHIFTmodifierKeyPressed = bitAND(modifier, Input.MOD_RSHIFT) > 0 if AutoDrive.isInExtendedEditorMode() then if (AutoDrive.rightCTRLmodifierKeyPressed and AutoDrive.toggleSphrere == true) then diff --git a/FS19_AutoDrive/scripts/Hud.lua b/FS19_AutoDrive/scripts/Hud.lua index 2a9686b2..e539d946 100644 --- a/FS19_AutoDrive/scripts/Hud.lua +++ b/FS19_AutoDrive/scripts/Hud.lua @@ -445,6 +445,7 @@ function AutoDriveHud:mouseEvent(vehicle, posX, posY, isDown, isUp, button) end vehicle.ad.hoveredNodeId = nil + local adjustedPaths = false if (not mouseEventHandled) and AutoDrive.isInExtendedEditorMode() then if not AutoDrive.leftCTRLmodifierKeyPressed and vehicle.ad.newcreated ~= nil and vehicle.ad.selectedNodeId == vehicle.ad.newcreated then -- if LCTRL is not pressed - no auto-connect to previous created new point, disable selected point @@ -466,15 +467,33 @@ function AutoDriveHud:mouseEvent(vehicle, posX, posY, isDown, isUp, button) end if vehicle.ad.hoveredNodeId ~= nil then -- waypoint at mouse position - if button == 1 and isUp and not AutoDrive.leftALTmodifierKeyPressed and not AutoDrive.leftCTRLmodifierKeyPressed then + if button == 1 and isUp and not AutoDrive.leftCTRLmodifierKeyPressed then -- left mouse button to select point / connect to already selected point if vehicle.ad.selectedNodeId ~= nil then if vehicle.ad.selectedNodeId ~= vehicle.ad.hoveredNodeId then -- connect selected point with hovered point - ADGraphManager:toggleConnectionBetween(ADGraphManager:getWayPointById(vehicle.ad.selectedNodeId), ADGraphManager:getWayPointById(vehicle.ad.hoveredNodeId), AutoDrive.leftLSHIFTmodifierKeyPressed) + --ADGraphManager:toggleConnectionBetween(ADGraphManager:getWayPointById(vehicle.ad.selectedNodeId), ADGraphManager:getWayPointById(vehicle.ad.hoveredNodeId), AutoDrive.leftLSHIFTmodifierKeyPressed) + -- lalt -> dual + -- lshift -> subPrio + -- rshift -> reverse + + ADGraphManager:toggleConnectionBetween(ADGraphManager:getWayPointById(vehicle.ad.selectedNodeId), ADGraphManager:getWayPointById(vehicle.ad.hoveredNodeId), AutoDrive.rightSHIFTmodifierKeyPressed and not AutoDrive.leftALTmodifierKeyPressed) + if AutoDrive.leftALTmodifierKeyPressed then + ADGraphManager:toggleConnectionBetween(ADGraphManager:getWayPointById(vehicle.ad.hoveredNodeId), ADGraphManager:getWayPointById(vehicle.ad.selectedNodeId), AutoDrive.rightSHIFTmodifierKeyPressed and not AutoDrive.leftALTmodifierKeyPressed) + end + + if AutoDrive.leftLSHIFTmodifierKeyPressed then + --local isSubPrioMarker = ADGraphManager:getIsPointSubPrioMarker(vehicle.ad.selectedNodeId) + --if not isSubPrioMarker then + -- ADGraphManager:toggleWayPointAsSubPrio(vehicle.ad.selectedNodeId) + --end + ADGraphManager:toggleWayPointAsSubPrio(vehicle.ad.hoveredNodeId) + end end + -- unselect point vehicle.ad.selectedNodeId = nil + adjustedPaths = true else -- select point -- no selectedNodeId: hoveredNodeId is now selectedNodeId @@ -504,7 +523,7 @@ function AutoDriveHud:mouseEvent(vehicle, posX, posY, isDown, isUp, button) vehicle.ad.selectedNodeId = vehicle.ad.newcreated end - if button == 1 and isUp and AutoDrive.leftALTmodifierKeyPressed and AutoDrive.leftCTRLmodifierKeyPressed and vehicle.ad.hoveredNodeId ~= nil then + if button == 1 and isUp and AutoDrive.leftLSHIFTmodifierKeyPressed and AutoDrive.leftCTRLmodifierKeyPressed and vehicle.ad.hoveredNodeId ~= nil then ADGraphManager:toggleWayPointAsSubPrio(vehicle.ad.hoveredNodeId) end @@ -557,15 +576,15 @@ function AutoDriveHud:mouseEvent(vehicle, posX, posY, isDown, isUp, button) -- connect only if previous created point is selected and newcreated ~= nil -- lalt -> dual - -- lshift -> reverse - -- lcaps -> subPrio + -- lshift -> subPrio + -- rshift -> reverse - ADGraphManager:toggleConnectionBetween(ADGraphManager:getWayPointById(vehicle.ad.selectedNodeId), ADGraphManager:getWayPointById(createdId), AutoDrive.leftLSHIFTmodifierKeyPressed) + ADGraphManager:toggleConnectionBetween(ADGraphManager:getWayPointById(vehicle.ad.selectedNodeId), ADGraphManager:getWayPointById(createdId), AutoDrive.rightSHIFTmodifierKeyPressed and not AutoDrive.leftALTmodifierKeyPressed) if AutoDrive.leftALTmodifierKeyPressed then - ADGraphManager:toggleConnectionBetween(ADGraphManager:getWayPointById(createdId), ADGraphManager:getWayPointById(vehicle.ad.selectedNodeId), AutoDrive.leftLSHIFTmodifierKeyPressed) + ADGraphManager:toggleConnectionBetween(ADGraphManager:getWayPointById(createdId), ADGraphManager:getWayPointById(vehicle.ad.selectedNodeId), AutoDrive.rightSHIFTmodifierKeyPressed and not AutoDrive.leftALTmodifierKeyPressed) end - if AutoDrive.isCAPSKeyActive then + if AutoDrive.leftLSHIFTmodifierKeyPressed then ADGraphManager:toggleWayPointAsSubPrio(vehicle.ad.selectedNodeId) end end @@ -576,7 +595,7 @@ function AutoDriveHud:mouseEvent(vehicle, posX, posY, isDown, isUp, button) end end - if vehicle.ad.hoveredNodeId ~= nil and vehicle.ad.nodeToMoveId == nil then + if vehicle.ad.hoveredNodeId ~= nil and vehicle.ad.nodeToMoveId == nil and vehicle.ad.selectedNodeId == nil and not adjustedPaths then if button == 1 and isUp and AutoDrive.leftALTmodifierKeyPressed and not AutoDrive.leftCTRLmodifierKeyPressed then -- Left alt for deleting the currently hovered node ADGraphManager:removeWayPoint(vehicle.ad.hoveredNodeId) diff --git a/FS19_AutoDrive/scripts/Modules/RecordingModule.lua b/FS19_AutoDrive/scripts/Modules/RecordingModule.lua index fe49dce1..9307c1bb 100644 --- a/FS19_AutoDrive/scripts/Modules/RecordingModule.lua +++ b/FS19_AutoDrive/scripts/Modules/RecordingModule.lua @@ -104,7 +104,11 @@ function ADRecordingModule:updateTick(dt, isActiveForInput, isActiveForInputIgno if self.isRecordingReverse then minDistanceToLastWayPoint = (MathUtil.vector2Length(reverseX - self.lastWp.x, reverseZ - self.lastWp.z) > 1) else - minDistanceToLastWayPoint = (MathUtil.vector2Length(vehicleX - self.lastWp.x, vehicleZ - self.lastWp.z) > 1) + if not self.isDual and not self.isSubPrio then + minDistanceToLastWayPoint = (MathUtil.vector2Length(vehicleX - self.lastWp.x, vehicleZ - self.lastWp.z) > 1) + else + minDistanceToLastWayPoint = false + end end end From 91aaaedc23840e3248a78eee203f08ddd8ac1986 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Sun, 16 May 2021 12:05:33 +0200 Subject: [PATCH 30/46] Fix --- FS19_AutoDrive/scripts/Hud.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/FS19_AutoDrive/scripts/Hud.lua b/FS19_AutoDrive/scripts/Hud.lua index e539d946..71be0257 100644 --- a/FS19_AutoDrive/scripts/Hud.lua +++ b/FS19_AutoDrive/scripts/Hud.lua @@ -497,7 +497,9 @@ function AutoDriveHud:mouseEvent(vehicle, posX, posY, isDown, isUp, button) else -- select point -- no selectedNodeId: hoveredNodeId is now selectedNodeId - vehicle.ad.selectedNodeId = vehicle.ad.hoveredNodeId + if not AutoDrive.leftALTmodifierKeyPressed then + vehicle.ad.selectedNodeId = vehicle.ad.hoveredNodeId + end end end From b2a3bb970499c6b2570169a892b8408324ef8920 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Tue, 18 May 2021 21:14:28 +0200 Subject: [PATCH 31/46] Reverted strange refactoring bug in group creation. --- FS19_AutoDrive/scripts/Gui/EnterGroupNameGUI.lua | 7 ++++++- FS19_AutoDrive/scripts/Manager/GraphManager.lua | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/FS19_AutoDrive/scripts/Gui/EnterGroupNameGUI.lua b/FS19_AutoDrive/scripts/Gui/EnterGroupNameGUI.lua index d8c5006e..5ac0bbf0 100644 --- a/FS19_AutoDrive/scripts/Gui/EnterGroupNameGUI.lua +++ b/FS19_AutoDrive/scripts/Gui/EnterGroupNameGUI.lua @@ -27,7 +27,12 @@ end function ADEnterGroupNameGui:onClickOk() ADEnterGroupNameGui:superClass().onClickOk(self) - ADGraphManager:addGroup(self.textInputElement.text) + + if self.textInputElement.text ~= ADGraphManager.debugGroupName then + -- do not allow user to create debug group + ADGraphManager:addGroup(self.textInputElement.text) + end + self:onClickBack() end diff --git a/FS19_AutoDrive/scripts/Manager/GraphManager.lua b/FS19_AutoDrive/scripts/Manager/GraphManager.lua index aa9da59b..80384f75 100644 --- a/FS19_AutoDrive/scripts/Manager/GraphManager.lua +++ b/FS19_AutoDrive/scripts/Manager/GraphManager.lua @@ -350,7 +350,7 @@ function ADGraphManager:createMapMarker(markerId, markerName, sendEvent) end function ADGraphManager:addGroup(groupName, sendEvent) - if groupName:len() > 1 and self.groups[groupName] == nil and groupName ~= ADGraphManager.debugGroupName then + if groupName:len() > 1 and self.groups[groupName] == nil then if sendEvent == nil or sendEvent == true then -- Propagating group creation all over the network AutoDriveGroupsEvent.sendEvent(groupName, AutoDriveGroupsEvent.TYPE_ADD) From 25b49803443a06215aa1794403746351dc3748f8 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Fri, 21 May 2021 10:57:41 +0200 Subject: [PATCH 32/46] Reenabled new pathcaluclation after one year. To be tested! --- FS19_AutoDrive/scripts/Manager/GraphManager.lua | 12 ++++++------ FS19_AutoDrive/scripts/PathCalculation.lua | 12 ++++++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/FS19_AutoDrive/scripts/Manager/GraphManager.lua b/FS19_AutoDrive/scripts/Manager/GraphManager.lua index 80384f75..0125c776 100644 --- a/FS19_AutoDrive/scripts/Manager/GraphManager.lua +++ b/FS19_AutoDrive/scripts/Manager/GraphManager.lua @@ -153,8 +153,8 @@ function ADGraphManager:pathFromTo(startWaypointId, targetWaypointId) if startWaypointId == targetWaypointId then table.insert(wp, self.wayPoints[targetWaypointId]) else - -- wp = ADPathCalculator:GetPath(startWaypointId, targetWaypointId) - wp = AutoDrive:dijkstraLiveShortestPath(startWaypointId, targetWaypointId) + wp = ADPathCalculator:GetPath(startWaypointId, targetWaypointId) + --wp = AutoDrive:dijkstraLiveShortestPath(startWaypointId, targetWaypointId) end end return wp @@ -168,8 +168,8 @@ function ADGraphManager:pathFromToMarker(startWaypointId, markerId) table.insert(wp, 1, self.wayPoints[targetId]) return wp else - -- wp = ADPathCalculator:GetPath(startWaypointId, targetId) - wp = AutoDrive:dijkstraLiveShortestPath(startWaypointId, targetId) + wp = ADPathCalculator:GetPath(startWaypointId, targetId) + --wp = AutoDrive:dijkstraLiveShortestPath(startWaypointId, targetId) end end return wp @@ -200,8 +200,8 @@ function ADGraphManager:FastShortestPath(start, markerName, markerId) return wp end - -- wp = ADPathCalculator:GetPath(start_id, target_id) - wp = AutoDrive:dijkstraLiveShortestPath(start_id, target_id) + wp = ADPathCalculator:GetPath(start_id, target_id) + --wp = AutoDrive:dijkstraLiveShortestPath(start_id, target_id) return wp end diff --git a/FS19_AutoDrive/scripts/PathCalculation.lua b/FS19_AutoDrive/scripts/PathCalculation.lua index ba12a3a0..d5a45c64 100644 --- a/FS19_AutoDrive/scripts/PathCalculation.lua +++ b/FS19_AutoDrive/scripts/PathCalculation.lua @@ -4,9 +4,13 @@ function ADPathCalculator:GetPath(startID, targetID) local count = 0 if not ADGraphManager:areWayPointsPrepared() then + print("ADPathCalculator - preparing waypoints - 1") AutoDrive.checkWaypointsLinkedtothemselve(true) -- find WP linked to themselve, with parameter true issues will be fixed + print("ADPathCalculator - preparing waypoints - 2") AutoDrive.checkWaypointsMultipleSameOut(true) -- find WP with multiple same out ID, with parameter true issues will be fixed + print("ADPathCalculator - preparing waypoints - 3") ADGraphManager:prepareWayPoints() + print("ADPathCalculator - preparing waypoints - 4") end local network = ADGraphManager:getWayPoints() @@ -54,8 +58,8 @@ function ADPathCalculator:GetPath(startID, targetID) for _, outId in pairs(outMap) do local outPoint = network[outId] --- axel TODO implement automatic network check for such issue: waypoint linked to itself -> DONE with AutoDrive.checkWaypointsLinkedtothemselve(true) - if point.id ~= outPoint.id then + -- axel TODO implement automatic network check for such issue: waypoint linked to itself -> DONE with AutoDrive.checkWaypointsLinkedtothemselve(true) + --if point.id ~= outPoint.id then -- First check if this point needs to be added to the candidate list or if it has already been tested local toBeAdded = true if results[outId] ~= nil then @@ -69,7 +73,7 @@ function ADPathCalculator:GetPath(startID, targetID) toBeAdded = false end end - if toBeAdded or (#point.incoming > 1) then + if toBeAdded then --or (#point.incoming > 1) candidates:enqueue({p=outPoint, distance=(distance + distanceFunc(outPoint.x - point.x, outPoint.z - point.z) + (addedWeights[outPoint.id] or 0)), pre=point.id}) end @@ -80,7 +84,7 @@ function ADPathCalculator:GetPath(startID, targetID) results[point.id][outId] = {distance=distance, pre=previousPoint} end end - end + --end end point = nil else From 36508e9baf5caa7cfd0f62f15a55534e644d64f9 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Fri, 21 May 2021 13:06:22 +0200 Subject: [PATCH 33/46] Adjusted dynamic front collision box to be just in front of vehicle or front attached implement. --- .../scripts/Sensors/VirtualSensors.lua | 15 ++++---- .../scripts/Utils/AutoDriveUtilFuncs.lua | 35 +++++++++++++++++++ 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/FS19_AutoDrive/scripts/Sensors/VirtualSensors.lua b/FS19_AutoDrive/scripts/Sensors/VirtualSensors.lua index 919af5fd..f8572d03 100644 --- a/FS19_AutoDrive/scripts/Sensors/VirtualSensors.lua +++ b/FS19_AutoDrive/scripts/Sensors/VirtualSensors.lua @@ -225,7 +225,8 @@ function ADSensor:getLocationByPosition() if location == nil then location = {x = 0, z = vehicle.sizeLength / 2} end - location.z = location.z + 2 + --location.z = location.z + AutoDrive.getVehicleLeadingEdge(vehicle) + --location.z = location.z + 2 elseif self.position == ADSensor.POS_REAR then location.z = - vehicle.sizeLength / 2 self.frontFactor = -1 @@ -455,7 +456,7 @@ function ADSensor:isTriggered() end function ADSensor:getRotatedFront() - if self.frontAxle == nil then + --if self.frontAxle == nil then local frontWheel = nil local pairWheel = nil local frontDistance = math.huge @@ -481,17 +482,17 @@ function ADSensor:getRotatedFront() local axleCenterZ = frontWheelZ + 0.5 * (pairWheelZ - frontWheelZ) local _, _, diffZ = worldToLocal(self.vehicle.components[1].node, axleCenterX, axleCenterY, axleCenterZ) local wheelBaseToFront = self.vehicle.sizeLength / 2 - diffZ - - self.frontAxleLength = wheelBaseToFront + local leadingEdge = AutoDrive.getVehicleLeadingEdge(self.vehicle) + self.frontAxleLength = wheelBaseToFront + leadingEdge self.frontAxle = {} self.frontAxle.x, self.frontAxle.y, self.frontAxle.z = worldToLocal(self.vehicle.components[1].node, axleCenterX, axleCenterY, axleCenterZ) end - else + --else local rx, _, rz = localDirectionToWorld(self.vehicle.components[1].node, math.sin(self.vehicle.rotatedTime), 0, math.cos(self.vehicle.rotatedTime)) local frontPoint = {x = self.frontAxle.x + self.frontAxleLength * math.sin(self.vehicle.rotatedTime), y = self.frontAxle.y, z = self.frontAxle.z + self.frontAxleLength * math.cos(self.vehicle.rotatedTime)} return frontPoint - end + --end - return nil + --return nil end diff --git a/FS19_AutoDrive/scripts/Utils/AutoDriveUtilFuncs.lua b/FS19_AutoDrive/scripts/Utils/AutoDriveUtilFuncs.lua index 4b91adcb..dcdf8029 100644 --- a/FS19_AutoDrive/scripts/Utils/AutoDriveUtilFuncs.lua +++ b/FS19_AutoDrive/scripts/Utils/AutoDriveUtilFuncs.lua @@ -290,6 +290,41 @@ function AutoDrive.getSelectedWorkTool(vehicle) return selectedWorkTool end +function AutoDrive.getVehicleLeadingEdge(vehicle) + local leadingEdge = 0 + local implements = AutoDrive.getAllImplements(vehicle) + if implements ~= nil then + for i = 1, #implements do + local implement = implements[i] + if implement ~= nil and implement.object ~= nil then + local implementX, implementY, implementZ = getWorldTranslation(implement.object.components[1].node) + local _, _, diffZ = worldToLocal(vehicle.components[1].node, implementX, implementY, implementZ) + if diffZ > 0 and implement.object.sizeLength ~= nil then + leadingEdge = math.max(leadingEdge, diffZ + (implement.object.sizeLength / 2) - (vehicle.sizeLength / 2)) + end + end + end + end + return leadingEdge +end + +function AutoDrive.getAllImplements(vehicle) + if vehicle ~= nil and vehicle.getAttachedImplements and #vehicle:getAttachedImplements() > 0 then + local allImp = {} + -- Credits to Tardis from FS17 + local function addAllAttached(obj) + for _, imp in pairs(obj:getAttachedImplements()) do + addAllAttached(imp.object) + table.insert(allImp, imp) + end + end + + addAllAttached(vehicle) + + return allImp + end +end + -- set or delete park destination for selected vehicle, tool from user input action, client mode! function AutoDrive.setActualParkDestination(vehicle) local actualParkDestination = -1 From 553e782c63086d1e30fcbcc7770273c8ecd72676 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Fri, 21 May 2021 13:38:38 +0200 Subject: [PATCH 34/46] Readded required frontAxle check again --- FS19_AutoDrive/scripts/Sensors/VirtualSensors.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/FS19_AutoDrive/scripts/Sensors/VirtualSensors.lua b/FS19_AutoDrive/scripts/Sensors/VirtualSensors.lua index f8572d03..00bf922e 100644 --- a/FS19_AutoDrive/scripts/Sensors/VirtualSensors.lua +++ b/FS19_AutoDrive/scripts/Sensors/VirtualSensors.lua @@ -487,12 +487,13 @@ function ADSensor:getRotatedFront() self.frontAxle = {} self.frontAxle.x, self.frontAxle.y, self.frontAxle.z = worldToLocal(self.vehicle.components[1].node, axleCenterX, axleCenterY, axleCenterZ) end - --else - local rx, _, rz = localDirectionToWorld(self.vehicle.components[1].node, math.sin(self.vehicle.rotatedTime), 0, math.cos(self.vehicle.rotatedTime)) - local frontPoint = {x = self.frontAxle.x + self.frontAxleLength * math.sin(self.vehicle.rotatedTime), y = self.frontAxle.y, z = self.frontAxle.z + self.frontAxleLength * math.cos(self.vehicle.rotatedTime)} - return frontPoint - --end + if self.frontAxle ~= nil then + local rx, _, rz = localDirectionToWorld(self.vehicle.components[1].node, math.sin(self.vehicle.rotatedTime), 0, math.cos(self.vehicle.rotatedTime)) + local frontPoint = {x = self.frontAxle.x + self.frontAxleLength * math.sin(self.vehicle.rotatedTime), y = self.frontAxle.y, z = self.frontAxle.z + self.frontAxleLength * math.cos(self.vehicle.rotatedTime)} - --return nil + return frontPoint + end + + return nil end From 86079f01d44b1793bc7c319615d3c22abc623da2 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Sat, 22 May 2021 19:27:05 +0200 Subject: [PATCH 35/46] Adjusted sugarcane check to not fire for attached harvesters. --- FS19_AutoDrive/scripts/Utils/CombineUtil.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FS19_AutoDrive/scripts/Utils/CombineUtil.lua b/FS19_AutoDrive/scripts/Utils/CombineUtil.lua index b0db77db..31d10edf 100644 --- a/FS19_AutoDrive/scripts/Utils/CombineUtil.lua +++ b/FS19_AutoDrive/scripts/Utils/CombineUtil.lua @@ -126,7 +126,7 @@ function AutoDrive.isPipeOut(combine) end function AutoDrive.isSugarcaneHarvester(combine) - local isSugarCaneHarvester = true + local isSugarCaneHarvester = combine.typeName == "combineCutterFruitPreparer" if combine.getAttachedImplements ~= nil then for _, implement in pairs(combine:getAttachedImplements()) do if implement ~= nil and implement ~= combine and (implement.object == nil or implement.object ~= combine) then From 07566c49ae5741cdb9cb275472c08d59f072f6e2 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Sat, 22 May 2021 19:27:40 +0200 Subject: [PATCH 36/46] Bugfix which prevented blue line traffic detection. --- .../scripts/Modules/PathFinderModule.lua | 16 +++++++++++++--- FS19_AutoDrive/scripts/PathCalculation.lua | 5 ++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua index 631dc3e8..b0e480cb 100644 --- a/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua +++ b/FS19_AutoDrive/scripts/Modules/PathFinderModule.lua @@ -1550,6 +1550,13 @@ function PathFinderModule:createWayPoints() self:smoothResultingPPPath_Refined() if self.smoothStep == 2 then + -- When going to network, dont turn actual road network nodes into pathFinderPoints + if self.goingToNetwork then + for i = 1, #self.wayPoints, 1 do + self.wayPoints[i].isPathFinderPoint = true + end + end + if self.appendWayPoints ~= nil then for i = 1, #self.appendWayPoints, 1 do self.wayPoints[#self.wayPoints + 1] = self.appendWayPoints[i] @@ -1562,9 +1569,12 @@ function PathFinderModule:createWayPoints() --) --) end - - for i = 1, #self.wayPoints, 1 do - self.wayPoints[i].isPathFinderPoint = true + + -- See comment above + if not self.goingToNetwork then + for i = 1, #self.wayPoints, 1 do + self.wayPoints[i].isPathFinderPoint = true + end end end end diff --git a/FS19_AutoDrive/scripts/PathCalculation.lua b/FS19_AutoDrive/scripts/PathCalculation.lua index d5a45c64..24b73ce1 100644 --- a/FS19_AutoDrive/scripts/PathCalculation.lua +++ b/FS19_AutoDrive/scripts/PathCalculation.lua @@ -37,7 +37,7 @@ function ADPathCalculator:GetPath(startID, targetID) end local lastPredecessor = nil - while not candidates:empty() and not foundTarget and count < 200000 do + while not candidates:empty() and not foundTarget do local next = candidates:dequeue() local point, distance, previousPoint = next.p, next.distance, next.pre while point ~= nil do @@ -106,8 +106,7 @@ function ADPathCalculator:GetPath(startID, targetID) end end end - count = count + 1 -end + end if not foundTarget then return {} From aebf940c5dab0d75dab4d1e38c8c82a87a8cdffa Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Sat, 22 May 2021 19:28:05 +0200 Subject: [PATCH 37/46] Added line break --- FS19_AutoDrive/scripts/Modules/CollisionDetectionModule.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FS19_AutoDrive/scripts/Modules/CollisionDetectionModule.lua b/FS19_AutoDrive/scripts/Modules/CollisionDetectionModule.lua index 5f03f774..a02b8cc9 100644 --- a/FS19_AutoDrive/scripts/Modules/CollisionDetectionModule.lua +++ b/FS19_AutoDrive/scripts/Modules/CollisionDetectionModule.lua @@ -79,7 +79,8 @@ function ADCollisionDetectionModule:detectAdTrafficOnRoute() self.trafficVehicle = nil if #dualRoutePoints > 0 then for _, other in pairs(g_currentMission.vehicles) do - if other ~= self.vehicle and other.ad ~= nil and other.ad.stateModule ~= nil and other.ad.stateModule:isActive() and other.ad.drivePathModule:isOnRoadNetwork() then local onSameRoute = false + if other ~= self.vehicle and other.ad ~= nil and other.ad.stateModule ~= nil and other.ad.stateModule:isActive() and other.ad.drivePathModule:isOnRoadNetwork() then + local onSameRoute = false local sameDirection = false local window = 4 local i = -window From c01d215816ecfb3f958ba6032099d47bfd444099 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Sat, 22 May 2021 19:28:30 +0200 Subject: [PATCH 38/46] Reenabled start all active helpers button again.. --- .../scripts/Manager/InputManager.lua | 19 +++++++++++++++++++ .../scripts/Modules/StateModule.lua | 14 ++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/FS19_AutoDrive/scripts/Manager/InputManager.lua b/FS19_AutoDrive/scripts/Manager/InputManager.lua index f33633b8..71dc3ade 100644 --- a/FS19_AutoDrive/scripts/Manager/InputManager.lua +++ b/FS19_AutoDrive/scripts/Manager/InputManager.lua @@ -245,6 +245,25 @@ function ADInputManager:input_start_stop(vehicle) vehicle:stopAutoDrive() else vehicle.ad.stateModule:getCurrentMode():start() + + if AutoDrive.rightSHIFTmodifierKeyPressed then + for _, otherVehicle in pairs(g_currentMission.vehicles) do + if otherVehicle ~= nil and otherVehicle ~= vehicle and otherVehicle.ad ~= nil and otherVehicle.ad.stateModule ~= nil then + --Doesn't work yet, if vehicle hasn't been entered before apparently. So we need to check what to call before, to setup all required variables. + + if otherVehicle.ad.stateModule.activeBeforeSave then + g_currentMission:requestToEnterVehicle(otherVehicle) + otherVehicle.ad.stateModule:getCurrentMode():start() + end + if otherVehicle.ad.stateModule.AIVEActiveBeforeSave and otherVehicle.acParameters ~= nil then + g_currentMission:requestToEnterVehicle(otherVehicle) + otherVehicle.acParameters.enabled = true + otherVehicle:startAIVehicle(nil, false, g_currentMission.player.farmId) + end + end + end + g_currentMission:requestToEnterVehicle(vehicle) + end end end diff --git a/FS19_AutoDrive/scripts/Modules/StateModule.lua b/FS19_AutoDrive/scripts/Modules/StateModule.lua index e14ebdae..51507fa8 100644 --- a/FS19_AutoDrive/scripts/Modules/StateModule.lua +++ b/FS19_AutoDrive/scripts/Modules/StateModule.lua @@ -57,6 +57,8 @@ function ADStateModule:reset() self.remainingDriveTime = 0 self.calculateRemainingDriveTimeInterval = 0 self.refuelFillType = 0 + self.activeBeforeSave = false + self.AIVEActiveBeforeSave = false end function ADStateModule:readFromXMLFile(xmlFile, key) @@ -111,6 +113,16 @@ function ADStateModule:readFromXMLFile(xmlFile, key) if driverName ~= nil then self.driverName = driverName end + + local lastActive = getXMLBool(xmlFile, key .. "#lastActive") + if lastActive ~= nil then + self.activeBeforeSave = lastActive + end + + local AIVElastActive = getXMLBool(xmlFile, key .. "#AIVElastActive") + if AIVElastActive ~= nil then + self.AIVEActiveBeforeSave = AIVElastActive + end end function ADStateModule:saveToXMLFile(xmlFile, key) @@ -126,6 +138,8 @@ function ADStateModule:saveToXMLFile(xmlFile, key) setXMLInt(xmlFile, key .. "#speedLimit", self.speedLimit) setXMLInt(xmlFile, key .. "#fieldSpeedLimit", self.fieldSpeedLimit) setXMLString(xmlFile, key .. "#driverName", self.driverName) + setXMLBool(xmlFile, key .. "#lastActive", self.active) + setXMLBool(xmlFile, key .. "#AIVElastActive", (self.vehicle.acParameters ~= nil and self.vehicle.acParameters.enabled and self.vehicle.spec_aiVehicle.isActive)) end function ADStateModule:writeStream(streamId) From 13577449ca7265ac9c5f6dea71d2acf7ee773178 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Mon, 24 May 2021 10:35:20 +0200 Subject: [PATCH 39/46] Prevent vehicle from starting in wrong direction on blue lines. --- .../scripts/Manager/GraphManager.lua | 34 ++++++++++++++--- FS19_AutoDrive/scripts/PathCalculation.lua | 37 +++++++++++++++---- 2 files changed, 59 insertions(+), 12 deletions(-) diff --git a/FS19_AutoDrive/scripts/Manager/GraphManager.lua b/FS19_AutoDrive/scripts/Manager/GraphManager.lua index 0125c776..34db3d7c 100644 --- a/FS19_AutoDrive/scripts/Manager/GraphManager.lua +++ b/FS19_AutoDrive/scripts/Manager/GraphManager.lua @@ -141,19 +141,23 @@ function ADGraphManager:getPathTo(vehicle, waypointId) local closestWaypoint = self:findMatchingWayPointForVehicle(vehicle) if closestWaypoint ~= nil then - wp = self:pathFromTo(closestWaypoint, waypointId) + local outCandidates = self:getBestOutPoints(vehicle, closestWaypoint) + wp = self:pathFromTo(closestWaypoint, waypointId, outCandidates) end return wp end -function ADGraphManager:pathFromTo(startWaypointId, targetWaypointId) +function ADGraphManager:pathFromTo(startWaypointId, targetWaypointId, preferredNeighbors) local wp = {} if startWaypointId ~= nil and self.wayPoints[startWaypointId] ~= nil and targetWaypointId ~= nil and self.wayPoints[targetWaypointId] ~= nil then if startWaypointId == targetWaypointId then table.insert(wp, self.wayPoints[targetWaypointId]) else - wp = ADPathCalculator:GetPath(startWaypointId, targetWaypointId) + if preferredNeighbors == nil then + preferredNeighbors = {} + end + wp = ADPathCalculator:GetPath(startWaypointId, targetWaypointId, preferredNeighbors) --wp = AutoDrive:dijkstraLiveShortestPath(startWaypointId, targetWaypointId) end end @@ -168,7 +172,7 @@ function ADGraphManager:pathFromToMarker(startWaypointId, markerId) table.insert(wp, 1, self.wayPoints[targetId]) return wp else - wp = ADPathCalculator:GetPath(startWaypointId, targetId) + wp = ADPathCalculator:GetPath(startWaypointId, targetId, {}) --wp = AutoDrive:dijkstraLiveShortestPath(startWaypointId, targetId) end end @@ -200,7 +204,7 @@ function ADGraphManager:FastShortestPath(start, markerName, markerId) return wp end - wp = ADPathCalculator:GetPath(start_id, target_id) + wp = ADPathCalculator:GetPath(start_id, target_id, {}) --wp = AutoDrive:dijkstraLiveShortestPath(start_id, target_id) return wp end @@ -1078,3 +1082,23 @@ function ADGraphManager:getIsPointSubPrioMarker(wayPointId) return false end + +function ADGraphManager:getBestOutPoints(vehicle, nodeId) + local neighbors = {} + + local x, y, z = getWorldTranslation(vehicle.components[1].node) + local toCheck = self.wayPoints[nodeId] + local baseDistance = MathUtil.vector2Length(toCheck.x - x, toCheck.z - z) + + if toCheck.out ~= nil then + for _, outId in pairs(toCheck.out) do + local out = self.wayPoints[outId] + local _, _, offsetZ = worldToLocal(vehicle.components[1].node, out.x, y, out.z) + if out ~= nil and baseDistance < MathUtil.vector2Length(out.x - x, out.z - z) and offsetZ > 0 then + table.insert(neighbors, out.id) + end + end + end + + return neighbors +end diff --git a/FS19_AutoDrive/scripts/PathCalculation.lua b/FS19_AutoDrive/scripts/PathCalculation.lua index 24b73ce1..ed6a21e8 100644 --- a/FS19_AutoDrive/scripts/PathCalculation.lua +++ b/FS19_AutoDrive/scripts/PathCalculation.lua @@ -1,21 +1,18 @@ ADPathCalculator = {} -function ADPathCalculator:GetPath(startID, targetID) +function ADPathCalculator:GetPath(startID, targetID, preferredStartIds) local count = 0 if not ADGraphManager:areWayPointsPrepared() then - print("ADPathCalculator - preparing waypoints - 1") + print("ADPathCalculator - preparing waypoints") AutoDrive.checkWaypointsLinkedtothemselve(true) -- find WP linked to themselve, with parameter true issues will be fixed - print("ADPathCalculator - preparing waypoints - 2") AutoDrive.checkWaypointsMultipleSameOut(true) -- find WP with multiple same out ID, with parameter true issues will be fixed - print("ADPathCalculator - preparing waypoints - 3") ADGraphManager:prepareWayPoints() - print("ADPathCalculator - preparing waypoints - 4") end local network = ADGraphManager:getWayPoints() local addedWeights = self:getDetourWeights() - + local subPrioNode = ADGraphManager:getSubPrioMarkerNode() if startID == nil or targetID == nil or network[startID] == nil or network[targetID] == nil then return {} @@ -36,6 +33,22 @@ function ADPathCalculator:GetPath(startID, targetID) return sqrt(a * a + b * b) end + local isSubPrio = function(pointToTest) + if subPrioNode == nil then + return false + end + for _, neighborId in pairs(pointToTest.out) do + local neighbor = network[neighborId] + if neighbor ~= nil then + if neighbor.id == subPrioNode.id then + return true + end + end + end + + return false + end + local lastPredecessor = nil while not candidates:empty() and not foundTarget do local next = candidates:dequeue() @@ -74,7 +87,17 @@ function ADPathCalculator:GetPath(startID, targetID) end end if toBeAdded then --or (#point.incoming > 1) - candidates:enqueue({p=outPoint, distance=(distance + distanceFunc(outPoint.x - point.x, outPoint.z - point.z) + (addedWeights[outPoint.id] or 0)), pre=point.id}) + local factor = 1 + if isSubPrio(outPoint) then + factor = 20 + end + local preventTurnaroundWeight = 0 + if point.id == startID then + if not table.contains(preferredStartIds, outPoint.id) then + preventTurnaroundWeight = 5000 + end + end + candidates:enqueue({p=outPoint, distance=(distance + distanceFunc(outPoint.x - point.x, outPoint.z - point.z) * factor + (addedWeights[outPoint.id] or 0) + preventTurnaroundWeight), pre=point.id}) end if results[point.id][outId] == nil then From 8524242a8cd3b51ae27319bd2ed4b2ecf266c310 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Mon, 24 May 2021 12:46:02 +0200 Subject: [PATCH 40/46] Added bunker unload mode again. --- FS19_AutoDrive/gui/debugSettingsPage.xml | 8 + FS19_AutoDrive/gui/vehicleSettingsPage.xml | 32 +-- FS19_AutoDrive/scripts/AutoDrive.lua | 1 + FS19_AutoDrive/scripts/Hud.lua | 6 +- FS19_AutoDrive/scripts/Hud/HudButton.lua | 8 + .../scripts/Manager/InputManager.lua | 7 +- .../scripts/Manager/TriggerManager.lua | 30 ++- .../scripts/Modules/StateModule.lua | 48 ++++- FS19_AutoDrive/scripts/Settings.lua | 9 +- .../scripts/Tasks/UnloadBGATask.lua | 184 ++++++++++++++---- .../textures/input_bunkerUnloadType_1.dds | Bin 0 -> 16512 bytes .../textures/input_bunkerUnloadType_2.dds | Bin 0 -> 16512 bytes .../translations/translation_br.xml | 2 + .../translations/translation_cz.xml | 2 + .../translations/translation_de.xml | 2 + .../translations/translation_en.xml | 2 + .../translations/translation_es.xml | 2 + .../translations/translation_fr.xml | 2 + .../translations/translation_hu.xml | 2 + .../translations/translation_it.xml | 2 + .../translations/translation_nl.xml | 2 + .../translations/translation_pl.xml | 2 + .../translations/translation_pt.xml | 2 + .../translations/translation_ru.xml | 2 + .../translations/translation_tr.xml | 2 + 25 files changed, 290 insertions(+), 69 deletions(-) create mode 100644 FS19_AutoDrive/textures/input_bunkerUnloadType_1.dds create mode 100644 FS19_AutoDrive/textures/input_bunkerUnloadType_2.dds diff --git a/FS19_AutoDrive/gui/debugSettingsPage.xml b/FS19_AutoDrive/gui/debugSettingsPage.xml index 7ef5814e..963a5dd9 100644 --- a/FS19_AutoDrive/gui/debugSettingsPage.xml +++ b/FS19_AutoDrive/gui/debugSettingsPage.xml @@ -89,6 +89,14 @@ + + + + + + + + diff --git a/FS19_AutoDrive/gui/vehicleSettingsPage.xml b/FS19_AutoDrive/gui/vehicleSettingsPage.xml index fefd8b73..184e7e87 100644 --- a/FS19_AutoDrive/gui/vehicleSettingsPage.xml +++ b/FS19_AutoDrive/gui/vehicleSettingsPage.xml @@ -90,22 +90,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/FS19_AutoDrive/scripts/AutoDrive.lua b/FS19_AutoDrive/scripts/AutoDrive.lua index aa6b9d89..16624c12 100644 --- a/FS19_AutoDrive/scripts/AutoDrive.lua +++ b/FS19_AutoDrive/scripts/AutoDrive.lua @@ -46,6 +46,7 @@ AutoDrive.DC_NETWORKINFO = 64 AutoDrive.DC_EXTERNALINTERFACEINFO = 128 AutoDrive.DC_RENDERINFO = 256 AutoDrive.DC_ROADNETWORKINFO = 512 +AutoDrive.DC_BGA_MODE = 1024 AutoDrive.DC_ALL = 65535 AutoDrive.currentDebugChannelMask = AutoDrive.DC_NONE diff --git a/FS19_AutoDrive/scripts/Hud.lua b/FS19_AutoDrive/scripts/Hud.lua index 71be0257..b803ec83 100644 --- a/FS19_AutoDrive/scripts/Hud.lua +++ b/FS19_AutoDrive/scripts/Hud.lua @@ -200,7 +200,11 @@ function AutoDriveHud:createHudAt(hudX, hudY) self:AddButton("input_silomode", "input_previousMode", nil, nil, "input_ADSilomode", 1, true) self:AddButton("input_continue", nil, nil, nil, "input_AD_continue", 1, true) self:AddButton("input_parkVehicle", "input_setParkDestination", nil, nil, "input_ADParkVehicle", 1, true) - self:AddButton("input_incLoopCounter", "input_decLoopCounter", nil, nil, "input_ADIncLoopCounter", 1, true) + if vehicle == nil or vehicle.ad.stateModule:getMode() ~= AutoDrive.MODE_BGA then + self:AddButton("input_incLoopCounter", "input_decLoopCounter", nil, nil, "input_ADIncLoopCounter", 1, true) + else + self:AddButton("input_bunkerUnloadType", nil, nil, nil, "input_ADbunkerUnloadType", 1, true) + end local speedX = self.posX + (self.cols - 1 + self.buttonCollOffset) * self.borderX + (self.cols - 2 + self.buttonCollOffset) * self.buttonWidth local speedY = self.posY + (1) * self.borderY + (0) * self.buttonHeight diff --git a/FS19_AutoDrive/scripts/Hud/HudButton.lua b/FS19_AutoDrive/scripts/Hud/HudButton.lua index fa80ca08..3e8dcda8 100644 --- a/FS19_AutoDrive/scripts/Hud/HudButton.lua +++ b/FS19_AutoDrive/scripts/Hud/HudButton.lua @@ -171,6 +171,14 @@ function ADHudButton:getNewState(vehicle) end end self.isVisible = (not AutoDrive.isEditorModeEnabled()) or (AutoDrive.getSetting("wideHUD") and AutoDrive.getSetting("addSettingsToHUD")) + end + + if self.primaryAction == "input_bunkerUnloadType" then + if vehicle.ad.stateModule:getBunkerUnloadTypeIsTrigger() then + newState = 1 + else + newState = 2 + end end return newState diff --git a/FS19_AutoDrive/scripts/Manager/InputManager.lua b/FS19_AutoDrive/scripts/Manager/InputManager.lua index 71dc3ade..7ca508da 100644 --- a/FS19_AutoDrive/scripts/Manager/InputManager.lua +++ b/FS19_AutoDrive/scripts/Manager/InputManager.lua @@ -77,7 +77,8 @@ ADInputManager.inputsToIds = { input_startCp = 25, input_toggleCP_AIVE = 26, input_record_subPrio = 27, - input_record_subPrioDual = 28 + input_record_subPrioDual = 28, + input_bunkerUnloadType = 29 } ADInputManager.idsToInputs = {} @@ -455,3 +456,7 @@ function ADInputManager:input_devAction(vehicle) AutoDrive.devAction(vehicle) end end + +function ADInputManager:input_bunkerUnloadType(vehicle) + vehicle.ad.stateModule:nextBunkerUnloadType() +end diff --git a/FS19_AutoDrive/scripts/Manager/TriggerManager.lua b/FS19_AutoDrive/scripts/Manager/TriggerManager.lua index 8fda55cd..4ddbeeb5 100644 --- a/FS19_AutoDrive/scripts/Manager/TriggerManager.lua +++ b/FS19_AutoDrive/scripts/Manager/TriggerManager.lua @@ -184,6 +184,10 @@ function ADTriggerManager.loadAllTriggers() table.insert(ADTriggerManager.siloTriggers, object) end end + + if object.exactFillRootNode ~= nil then + table.insert(ADTriggerManager.tipTriggers, object) + end end end @@ -214,6 +218,7 @@ function ADTriggerManager.loadAllTriggers() end end end + for _, trigger in pairs(ADTriggerManager.siloTriggers) do if trigger.stoppedTimer == nil then trigger.stoppedTimer = AutoDriveTON:new() @@ -345,13 +350,11 @@ end function ADTriggerManager.getTriggerPos(trigger) local x, y, z = 0, 0, 0 - if trigger.triggerNode ~= nil and g_currentMission.nodeToObject[trigger.triggerNode] ~= nil and entityExists(trigger.triggerNode) then + if trigger.triggerNode ~= nil and g_currentMission.nodeToObject[trigger.triggerNode] ~= nil and entityExists(trigger.triggerNode) then x, y, z = getWorldTranslation(trigger.triggerNode) - --g_logManager:devInfo("Got triggerpos: " .. x .. "/" .. y .. "/" .. z); end if trigger.exactFillRootNode ~= nil and g_currentMission.nodeToObject[trigger.exactFillRootNode] ~= nil and entityExists(trigger.exactFillRootNode) then x, y, z = getWorldTranslation(trigger.exactFillRootNode) - --g_logManager:devInfo("Got triggerpos: " .. x .. "/" .. y .. "/" .. z); end return x, y, z end @@ -378,3 +381,24 @@ end function ADTriggerManager:onPlaceableBuy() ADTriggerManager.searchedForTriggers = false end + +function ADTriggerManager.triggerSupportsFillType(trigger, fillType) + if fillType > 0 then + if trigger ~= nil and trigger.getIsFillTypeSupported then + return trigger:getIsFillTypeSupported(fillType) + end + end + return false +end + +function ADTriggerManager.getAllTriggersForFillType(fillType) + local triggers = {} + + for _, trigger in pairs(ADTriggerManager.getUnloadTriggers()) do + if ADTriggerManager.triggerSupportsFillType(trigger, fillType) then + table.insert(triggers, trigger) + end + end + + return triggers +end diff --git a/FS19_AutoDrive/scripts/Modules/StateModule.lua b/FS19_AutoDrive/scripts/Modules/StateModule.lua index 51507fa8..dd651099 100644 --- a/FS19_AutoDrive/scripts/Modules/StateModule.lua +++ b/FS19_AutoDrive/scripts/Modules/StateModule.lua @@ -8,6 +8,11 @@ ADStateModule.CREATE_SUB_PRIO_DUAL = 5 ADStateModule.CALCULATE_REMAINING_DRIVETIME_INTERVAL = 1000 +ADStateModule.HIGHEST_MODE = 6 + +ADStateModule.BUNKER_UNLOAD_TRIGGER = 1 +ADStateModule.BUNKER_UNLOAD_TRAILER = 2 + function ADStateModule:new(vehicle) local o = {} setmetatable(o, self) @@ -59,14 +64,15 @@ function ADStateModule:reset() self.refuelFillType = 0 self.activeBeforeSave = false self.AIVEActiveBeforeSave = false + self.bunkerUnloadType = ADStateModule.BUNKER_UNLOAD_TRIGGER end function ADStateModule:readFromXMLFile(xmlFile, key) local mode = getXMLInt(xmlFile, key .. "#mode") if mode ~= nil then - if mode == AutoDrive.MODE_BGA then - mode = AutoDrive.MODE_DRIVETO - end + --if mode == AutoDrive.MODE_BGA then + --mode = AutoDrive.MODE_DRIVETO + --end self.mode = mode end @@ -123,6 +129,11 @@ function ADStateModule:readFromXMLFile(xmlFile, key) if AIVElastActive ~= nil then self.AIVEActiveBeforeSave = AIVElastActive end + + local bunkerUnloadType = getXMLInt(xmlFile, key .. "#bunkerUnloadType") + if bunkerUnloadType ~= nil then + self.bunkerUnloadType = bunkerUnloadType + end end function ADStateModule:saveToXMLFile(xmlFile, key) @@ -140,6 +151,7 @@ function ADStateModule:saveToXMLFile(xmlFile, key) setXMLString(xmlFile, key .. "#driverName", self.driverName) setXMLBool(xmlFile, key .. "#lastActive", self.active) setXMLBool(xmlFile, key .. "#AIVElastActive", (self.vehicle.acParameters ~= nil and self.vehicle.acParameters.enabled and self.vehicle.spec_aiVehicle.isActive)) + setXMLInt(xmlFile, key .. "#bunkerUnloadType", self.bunkerUnloadType) end function ADStateModule:writeStream(streamId) @@ -164,6 +176,7 @@ function ADStateModule:writeStream(streamId) streamWriteString(streamId, self.driverName) streamWriteUInt16(streamId, self.remainingDriveTime) streamWriteUIntN(streamId, self.refuelFillType, 8) + streamWriteUIntN(streamId, self.bunkerUnloadType, 3) end function ADStateModule:readStream(streamId) @@ -188,6 +201,7 @@ function ADStateModule:readStream(streamId) self.driverName = streamReadString(streamId) self.remainingDriveTime = streamReadUInt16(streamId) self.refuelFillType = streamReadUIntN(streamId, 8) + self.bunkerUnloadType = streamReadUIntN(streamId, 3) self.currentLocalizedTaskInfo = AutoDrive.localize(self.currentTaskInfo) end @@ -214,6 +228,7 @@ function ADStateModule:writeUpdateStream(streamId) streamWriteString(streamId, self.driverName) streamWriteUInt16(streamId, self.remainingDriveTime) streamWriteUIntN(streamId, self.refuelFillType, 8) + streamWriteUIntN(streamId, self.bunkerUnloadType, 3) end function ADStateModule:readUpdateStream(streamId) @@ -238,6 +253,7 @@ function ADStateModule:readUpdateStream(streamId) self.driverName = streamReadString(streamId) self.remainingDriveTime = streamReadUInt16(streamId) self.refuelFillType = streamReadUIntN(streamId, 8) + self.bunkerUnloadType = streamReadUIntN(streamId, 3) self.currentLocalizedTaskInfo = AutoDrive.localize(self.currentTaskInfo) end @@ -405,11 +421,12 @@ function ADStateModule:getCurrentMode() end function ADStateModule:nextMode() - if self.mode < AutoDrive.MODE_UNLOAD then + if self.mode < ADStateModule.HIGHEST_MODE then self.mode = self.mode + 1 else self.mode = AutoDrive.MODE_DRIVETO end + AutoDrive.Hud.lastUIScale = 0 self:raiseDirtyFlag() end @@ -417,14 +434,16 @@ function ADStateModule:previousMode() if self.mode > AutoDrive.MODE_DRIVETO then self.mode = self.mode - 1 else - self.mode = AutoDrive.MODE_UNLOAD + self.mode = ADStateModule.HIGHEST_MODE end + AutoDrive.Hud.lastUIScale = 0 self:raiseDirtyFlag() end function ADStateModule:setMode(newMode) - if newMode >= AutoDrive.MODE_DRIVETO and newMode <= AutoDrive.MODE_UNLOAD and newMode ~= self.mode then + if newMode >= AutoDrive.MODE_DRIVETO and newMode <= ADStateModule.HIGHEST_MODE and newMode ~= self.mode then self.mode = newMode + AutoDrive.Hud.lastUIScale = 0 self:raiseDirtyFlag() end end @@ -875,3 +894,20 @@ function ADStateModule:setRefuelFillType(refuelFillType) self.refuelFillType = refuelFillType self:raiseDirtyFlag() end + +function ADStateModule:nextBunkerUnloadType() + if self.bunkerUnloadType < ADStateModule.BUNKER_UNLOAD_TRAILER then + self.bunkerUnloadType = self.bunkerUnloadType + 1 + else + self.bunkerUnloadType = ADStateModule.BUNKER_UNLOAD_TRIGGER + end + self:raiseDirtyFlag() +end + +function ADStateModule:getBunkerUnloadType() + return self.bunkerUnloadType +end + +function ADStateModule:getBunkerUnloadTypeIsTrigger() + return self.bunkerUnloadType == ADStateModule.BUNKER_UNLOAD_TRIGGER +end diff --git a/FS19_AutoDrive/scripts/Settings.lua b/FS19_AutoDrive/scripts/Settings.lua index 60bfb6e3..bfa23cd3 100644 --- a/FS19_AutoDrive/scripts/Settings.lua +++ b/FS19_AutoDrive/scripts/Settings.lua @@ -569,10 +569,9 @@ AutoDrive.settings.enableTrafficDetection = { isVehicleSpecific = false } ---[[ AutoDrive.settings.shovelWidth = { - values = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0}, - texts = {"0m", "0.1m", "0.2m", "0.3m", "0.4m", "0.5m", "0.6m", "0.7m", "0.8m", "0.9m", "1.0m", "1.1m", "1.2m", "1.3m", "1.4m", "1.5m", "1.6m", "1.7m", "1.8m", "1.9m", "2.0m"}, + values = {0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0}, + texts = {"0m", "0.2m", "0.4m", "0.6m", "0.8m", "1.0m", "1.2m", "1.4m", "1.6m", "1.8m", "2.0m", "2.2m", "2.4m", "2.6m", "2.8m", "3.0m", "3.2m", "3.4m", "3.6m", "3.8m", "4.0m"}, default = 1, current = 1, text = "gui_ad_shovelWidth", @@ -580,9 +579,8 @@ AutoDrive.settings.shovelWidth = { translate = false, isVehicleSpecific = true } -]] ---[[ + AutoDrive.settings.shovelHeight = { values = { -0.5, @@ -697,7 +695,6 @@ AutoDrive.settings.shovelHeight = { translate = false, isVehicleSpecific = true } -]] AutoDrive.settings.useFolders = { values = {false, true}, diff --git a/FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua b/FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua index 1d2103c0..0f8d2370 100644 --- a/FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua +++ b/FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua @@ -65,6 +65,10 @@ function UnloadBGATask:update(dt) self.isActive = true end + if self.targetUnloadTrigger == nil then + self.targetUnloadTrigger = self:getTargetUnloadPoint() + end + self:getCurrentStates() if self.state == self.STATE_INIT then @@ -117,6 +121,10 @@ function UnloadBGATask:update(dt) self.lastState = self.state self.lastAction = self.action + + if AutoDrive.getDebugChannelIsSet(AutoDrive.DC_BGA_MODE) then + self:drawDebug() + end end function UnloadBGATask:abort() @@ -131,6 +139,15 @@ function UnloadBGATask:getCurrentStates() self.trailerFillLevel, self.trailerLeftCapacity = AutoDrive.getFillLevelAndCapacityOf(self.targetTrailer) self.bunkerFillLevel = 10000 --self:getBunkerFillLevel(); + self.targetUnloadTriggerFree = false + if self.targetUnloadTrigger ~= nil then + local fillType = self.shovel:getFillUnitFillType(1) + if fillType > 0 then + self.targetUnloadTriggerFree = self.targetUnloadTrigger:getFillUnitFreeCapacity(1, fillType) >= self.shovelFilledCapacity + --print("targetUnloadTriggerFree: " .. tostring(targetUnloadTriggerFree) .. " capacity: " .. self.targetUnloadTrigger:getFillUnitFreeCapacity(1, fillType)) + end + end + if not self:checkCurrentTrailerStillValid() then self.targetTrailer = nil self.targetDriver = nil @@ -145,8 +162,11 @@ function UnloadBGATask:checkIfPossibleToRestart() if self.targetBunker == nil then self.targetBunker = self:getTargetBunker() end + if self.targetUnloadTrigger == nil then + self.targetUnloadTrigger = self:getTargetUnloadPoint() + end - if self.targetTrailer ~= nil and self.trailerLeftCapacity >= 1 and self.targetBunker ~= nil and self.bunkerFillLevel > 0 then + if (self.targetUnloadTrigger and self.targetUnloadTriggerFree) or (not self.targetUnloadTrigger and self.targetTrailer ~= nil and self.trailerLeftCapacity >= 1 and self.targetBunker ~= nil and self.bunkerFillLevel > 0) then return true end end @@ -160,6 +180,7 @@ function UnloadBGATask:getShovelFillLevel() fillLevel = fillLevel + self.shovel:getFillUnitFillLevel(shovelNode.fillUnitIndex) capacity = capacity + self.shovel:getFillUnitCapacity(shovelNode.fillUnitIndex) fillUnitCount = fillUnitCount + 1 + --print("Detected shovelNode width: " .. shovelNode.width) if self.shovelWidthTool == nil or self.shovelWidthTool < shovelNode.width then self.shovelWidthTool = shovelNode.width end @@ -173,6 +194,7 @@ function UnloadBGATask:getShovelFillLevel() if self.targetBunker ~= nil then self:determineHighestShovelOffset() end + self.shovelFilledCapacity = fillLevel return fillLevel / capacity end @@ -186,6 +208,8 @@ function UnloadBGATask:initializeBGA() self.shovelTarget = self.SHOVELSTATE_LOW self.targetTrailer, self.targetDriver = self:findCloseTrailer() self.targetBunker = self:getTargetBunker() + self.targetUnloadTrigger = self:getTargetUnloadPoint() + self.unloadToTrigger = self.vehicle.ad.stateModule:getBunkerUnloadTypeIsTrigger() self.inShovelRangeTimer = AutoDriveTON:new() self.strategyActiveTimer = AutoDriveTON:new() @@ -196,6 +220,7 @@ function UnloadBGATask:initializeBGA() self.shovelOffsetCounter = 0 self.highestShovelOffsetCounter = 0 self.reachedPreTargetLoadPoint = false + self.shovelInBunkerArea = false if self.shovel == nil then self:getVehicleShovel() @@ -263,7 +288,7 @@ function UnloadBGATask:handleInitAxis(dt) self.initAxisStartTranslation = translationObject.curTrans[translationObject.translationAxis] translationTarget = (translationObject.transMax - translationObject.transMin) / 2 + translationObject.transMin if math.abs(translationTarget - translationObject.curTrans[translationObject.translationAxis]) <= 0.1 then - translationTarget = translationTarget.transMin + translationTarget = translationObject.transMin end self.armExtender.translationTarget = translationTarget self.initAxisState = self.INITAXIS_STATE_EXTENDER_STEER @@ -413,9 +438,9 @@ end function UnloadBGATask:checkForUnloadCondition() --can unload if shovel is filled and trailer available if self.action == self.ACTION_DRIVETOSILO_COMMON_POINT then - return self.shovelFillLevel > 0 and self.targetTrailer ~= nil and self.trailerLeftCapacity > 1 + return self.shovelFillLevel > 0 and ((self.targetTrailer ~= nil and self.trailerLeftCapacity > 1) or (self.unloadToTrigger and self.targetUnloadTriggerFree)) elseif self.action == self.ACTION_LOAD then - return self.shovelFillLevel >= 0.98 and self.targetTrailer ~= nil and self.trailerLeftCapacity > 1 + return self.shovelFillLevel >= 0.98 and ((self.targetTrailer ~= nil and self.trailerLeftCapacity > 1) or (self.unloadToTrigger and self.targetUnloadTriggerFree)) end return false end @@ -425,7 +450,7 @@ function UnloadBGATask:checkForStopLoading() --stop loading when shovel is fille end function UnloadBGATask:checkForIdleCondition() --idle if shovel filled and no trailer available to fill; - if self.shovelFillLevel >= 0.98 and (self.targetTrailer ~= nil or self.trailerLeftCapacity <= 1) or self.targetTrailer == nil then + if self.shovelFillLevel >= 0.98 and ((((self.targetTrailer ~= nil or self.trailerLeftCapacity <= 1) or self.targetTrailer == nil) and not self.self.unloadToTrigger) or (self.unloadToTrigger and not self.targetUnloadTriggerFree)) then return true end return false @@ -447,6 +472,9 @@ function UnloadBGATask:handleShovel(dt) self.shovelState = self.shovelTarget end else + if self.shovelState == self.shovelTarget and self.shovelInBunkerArea ~= self:isShovelInBunkerArea() then + self.shovelState = self.SHOVELSTATE_UNKNOWN + end if self.shovelState ~= self.shovelTarget then if not self.shovelActiveTimer:done() then self:moveShovelToTarget(self.shovelTarget, dt) @@ -465,12 +493,20 @@ function UnloadBGATask:handleShovel(dt) end end end + + if self.shovel ~= nil then + self.shovelInBunkerArea = self:isShovelInBunkerArea() + end end function UnloadBGATask:moveShovelToTarget(_, dt) if self.shovelTarget == self.SHOVELSTATE_LOADING then - self.shovelTargetHeight = -0.20 + AutoDrive.getSetting("shovelHeight", self.vehicle) - self.shovelTargetAngle = self.shovelRotator.horizontalPosition + self.shovelRotator.moveUpSign * 0.07 + if self:isShovelInBunkerArea() then + self.shovelTargetHeight = -0.25 + AutoDrive.getSetting("shovelHeight", self.vehicle) + else + self.shovelTargetHeight = -0.20 + AutoDrive.getSetting("shovelHeight", self.vehicle) + end + self.shovelTargetAngle = self.shovelRotator.horizontalPosition + self.shovelRotator.moveUpSign * 0.11 if self.armExtender ~= nil then self.shovelTargetExtension = self.armExtender.transMin end @@ -560,9 +596,9 @@ function UnloadBGATask:moveShovelToTarget(_, dt) end function UnloadBGATask:checkIfAllWheelsOnGround() - local spec = self.vehicle.spec_wheels + local spec = self.vehicle.spec_wheels for _, wheel in pairs(spec.wheels) do - if wheel.contact ~= Wheels.WHEEL_GROUND_CONTACT then + if not wheel.hasGroundContact then return false end end @@ -624,12 +660,11 @@ function UnloadBGATask:findCloseTrailer() local closest = nil local closestTrailer = nil for _, vehicle in pairs(g_currentMission.vehicles) do - if vehicle ~= self.vehicle and self:vehicleHasTrailersAttached(self.vehicle) and vehicle.ad ~= nil then - if AutoDrive.getDistanceBetween(vehicle, self.vehicle) < closestDistance and vehicle.ad.noMovementTimer:done() and (not vehicle.ad.trailerModule:isActiveAtTrigger()) then + if vehicle ~= self.vehicle and self:vehicleHasTrailersAttached(vehicle) and vehicle.ad ~= nil then + if AutoDrive.getDistanceBetween(vehicle, self.vehicle) < closestDistance and vehicle.ad.noMovementTimer:timer(vehicle.lastSpeedReal < 0.0004, 3000, 16) and (not vehicle.ad.trailerModule:isActiveAtTrigger()) then local _, trailers = self:vehicleHasTrailersAttached(vehicle) for _, trailer in pairs(trailers) do if trailer ~= nil then - --local trailerFillLevel = 0 local trailerLeftCapacity = 0 _, trailerLeftCapacity = AutoDrive.getFillLevelAndCapacityOf(trailer) if trailerLeftCapacity >= 10 then @@ -648,15 +683,8 @@ function UnloadBGATask:findCloseTrailer() return end -function UnloadBGATask:getDistanceBetween(vehicleOne, vehicleTwo) - local x1, _, z1 = getWorldTranslation(vehicleOne.components[1].node) - local x2, _, z2 = getWorldTranslation(vehicleTwo.components[1].node) - - return math.sqrt(math.pow(x2 - x1, 2) + math.pow(z2 - z1, 2)) -end - -function UnloadBGATask:vehicleHasTrailersAttached() - local trailers, _ = AutoDrive.getTrailersOf(self.vehicle) +function UnloadBGATask:vehicleHasTrailersAttached(vehicle) + local trailers, _ = AutoDrive.getTrailersOf(vehicle) local tipTrailers = {} if trailers ~= nil then for _, trailer in pairs(trailers) do @@ -705,6 +733,28 @@ function UnloadBGATask:getTargetBunker() return closest end +function UnloadBGATask:getTargetUnloadPoint() + local x, _, z = getWorldTranslation(self.vehicle.components[1].node) + local closestDistance = math.huge + local closest = nil + if self.shovel ~= nil and self.shovel.getFillUnitFillType ~= nil then + local fillType = self.shovel:getFillUnitFillType(1) + if fillType ~= nil then + for _, trigger in pairs(ADTriggerManager.getAllTriggersForFillType(fillType)) do + local triggerX, _, triggerZ = ADTriggerManager.getTriggerPos(trigger) + local distance = math.sqrt(math.pow(triggerX - x, 2) + math.pow(triggerZ - z, 2)) + if distance < closestDistance and distance < 1000 then + closest = trigger + closestDistance = distance + end + end + end + --print("Found closest trigger with distance: " .. closestDistance) + end + + return closest +end + function UnloadBGATask:getTargetBunkerLoadingSide() if self.targetBunker == nil then self:getTargetBunker() @@ -804,6 +854,24 @@ function UnloadBGATask:isAlmostInBunkerSiloArea(distanceToCheck) return AutoDrive.boxesIntersect(boundingBox, otherBoundingBox) end +function UnloadBGATask:isShovelInBunkerArea() + if self.shovel ~= nil and self.targetBunker ~= nil then + local x, y, z = getWorldTranslation(self.shovel.spec_shovel.shovelDischargeInfo.node) + local tx, _, tz = localToWorld(self.shovel.spec_shovel.shovelDischargeInfo.node, 0, 0, -1) + --local tx, _, tz = x, y, z + 1 + if self.targetBunker ~= nil and self.targetBunker.bunkerSiloArea ~= nil then + local x1, z1 = self.targetBunker.bunkerSiloArea.sx, self.targetBunker.bunkerSiloArea.sz + local x2, z2 = self.targetBunker.bunkerSiloArea.wx, self.targetBunker.bunkerSiloArea.wz + local x3, z3 = self.targetBunker.bunkerSiloArea.hx, self.targetBunker.bunkerSiloArea.hz + if MathUtil.hasRectangleLineIntersection2D(x1, z1, x2 - x1, z2 - z1, x3 - x1, z3 - z1, x, z, tx - x, tz - z) then + return true + end + end + end + + return false +end + function UnloadBGATask:driveToSiloCommonPoint(dt) if (self.checkedCurrentRow == nil or self.checkedCurrentRow == false) then self:setShovelOffsetToNonEmptyRow() @@ -976,6 +1044,13 @@ function UnloadBGATask:getDriveStrategyToTrailerInit(dt) return self:getDriveStrategyByAngle(angleToTrailer, true, dt) end +function UnloadBGATask:getDriveStrategyToTrigger(dt) + local triggerX, _, triggerZ = ADTriggerManager.getTriggerPos(self.targetUnloadTrigger) + self.targetPoint = {x = triggerX, z = triggerZ} + + return self:getDriveStrategyByAngle(self:getAngleToTarget(), true, dt) +end + function UnloadBGATask:getDriveStrategyToTrailer(dt) local xT, _, zT = getWorldTranslation(self.targetTrailer.components[1].node) @@ -1133,7 +1208,7 @@ function UnloadBGATask:reverseFromBGALoad(dt) end function UnloadBGATask:driveToBGAUnloadInit(dt) - if self.targetTrailer == nil then + if self.targetTrailer == nil and not self.unloadToTrigger then self:getVehicleToPause() self.vehicle.ad.specialDrivingModule:stopVehicle() self.vehicle.ad.specialDrivingModule:update(dt) @@ -1142,8 +1217,11 @@ function UnloadBGATask:driveToBGAUnloadInit(dt) self.shovelTarget = self.SHOVELSTATE_BEFORE_UNLOAD - self.driveStrategy = self:getDriveStrategyToTrailerInit(dt) - + if not self.unloadToTrigger then + self.driveStrategy = self:getDriveStrategyToTrailerInit(dt) + else + self.driveStrategy = self:getDriveStrategyToTrigger(dt) + end self:handleDriveStrategy(dt) local x, _, z = getWorldTranslation(self.vehicle.components[1].node) @@ -1151,7 +1229,7 @@ function UnloadBGATask:driveToBGAUnloadInit(dt) if math.sqrt(math.pow(self.targetPoint.x - x, 2) + math.pow(self.targetPoint.z - z, 2)) <= 4 then self.action = self.ACTION_DRIVETOUNLOAD end - if self.targetTrailer == nil or (self.trailerLeftCapacity <= 0.001) then + if ((self.targetTrailer == nil or (self.trailerLeftCapacity <= 0.001)) and not self.unloadToTrigger) or ((self.unloadToTrigger and not self.targetUnloadTriggerFree)) then self.action = self.ACTION_REVERSEFROMUNLOAD self.shovelTarget = self.SHOVELSTATE_BEFORE_UNLOAD self.shovel:setDischargeState(Dischargeable.DISCHARGE_STATE_OFF, true) @@ -1159,14 +1237,14 @@ function UnloadBGATask:driveToBGAUnloadInit(dt) end function UnloadBGATask:driveToBGAUnload(dt) - if self.targetTrailer == nil then + if self.targetTrailer == nil and not self.unloadToTrigger then AutoDriveMessageEvent.sendMessageOrNotification(self.vehicle, ADMessagesManager.messageTypes.ERROR, "$l10n_AD_Driver_of; %s $l10n_AD_No_Trailer;", 5000, self.vehicle.stateModule:getName()) self:getVehicleToPause() self.vehicle.ad.specialDrivingModule:stopVehicle() self.vehicle.ad.specialDrivingModule:update(dt) return end - if AutoDrive.getDistanceBetween(self.vehicle, self.targetTrailer) <= 10 then + if self.unloadToTrigger or (AutoDrive.getDistanceBetween(self.vehicle, self.targetTrailer) <= 10) then self.shovelTarget = self.SHOVELSTATE_BEFORE_UNLOAD elseif AutoDrive.getDistanceBetween(self.vehicle, self.targetTrailer) > 20 then self.shovelTarget = self.SHOVELSTATE_TRANSPORT @@ -1177,14 +1255,18 @@ function UnloadBGATask:driveToBGAUnload(dt) return end - self.driveStrategy = self:getDriveStrategyToTrailer(dt) + if not self.unloadToTrigger then + self.driveStrategy = self:getDriveStrategyToTrailer(dt) + else + self.driveStrategy = self:getDriveStrategyToTrigger(dt) + end self:handleDriveStrategy(dt) if self.inShovelRangeTimer:timer(self:getShovelInTrailerRange(), 350, dt) then self.action = self.ACTION_UNLOAD end - if self.targetTrailer == nil or (self.trailerLeftCapacity <= 0.1) then + if (not self.unloadToTrigger and (self.targetTrailer == nil or (self.trailerLeftCapacity <= 0.1))) or (self.unloadToTrigger and not self.targetUnloadTriggerFree) then self.action = self.ACTION_REVERSEFROMUNLOAD self.shovelTarget = self.SHOVELSTATE_BEFORE_UNLOAD self.shovel:setDischargeState(Dischargeable.DISCHARGE_STATE_OFF, true) @@ -1204,7 +1286,7 @@ function UnloadBGATask:handleBGAUnload(dt) self.action = self.ACTION_REVERSEFROMUNLOAD self.shovel:setDischargeState(Dischargeable.DISCHARGE_STATE_OFF, true) end - if self.targetTrailer == nil or (self.trailerLeftCapacity <= 0.1) then + if (not self.unloadToTrigger and (self.targetTrailer == nil or (self.trailerLeftCapacity <= 0.1))) or (self.unloadToTrigger and not self.targetUnloadTriggerFree) then self.action = self.ACTION_REVERSEFROMUNLOAD self.shovelState = self.SHOVELSTATE_UNLOAD self.shovelTarget = self.SHOVELSTATE_BEFORE_UNLOAD @@ -1244,12 +1326,12 @@ function UnloadBGATask:reverseFromBGAUnload(dt) else self.shovelTarget = self.SHOVELSTATE_BEFORE_UNLOAD end - end - if MathUtil.vector2Length(x - self.shovelUnloadPosition.x, z - self.shovelUnloadPosition.z) >= 8 then - self.shovel:setDischargeState(Dischargeable.DISCHARGE_STATE_OFF, true) - self.action = self.ACTION_DRIVETOSILO_COMMON_POINT - end + if MathUtil.vector2Length(x - self.shovelUnloadPosition.x, z - self.shovelUnloadPosition.z) >= 8 then + self.shovel:setDischargeState(Dischargeable.DISCHARGE_STATE_OFF, true) + self.action = self.ACTION_DRIVETOSILO_COMMON_POINT + end + end end function UnloadBGATask:getVehicleToPause() @@ -1261,7 +1343,7 @@ function UnloadBGATask:getShovelInTrailerRange() if dischargeNode ~= nil then local dischargeTarget = dischargeNode.dischargeObject if dischargeTarget ~= nil then - local result = self.shovel:getDischargeState() == Dischargeable.DISCHARGE_STATE_OBJECT and dischargeTarget == self.targetTrailer + local result = self.shovel:getDischargeState() == Dischargeable.DISCHARGE_STATE_OBJECT --and dischargeTarget == self.targetTrailer return result end end @@ -1378,4 +1460,34 @@ function UnloadBGATask:driveInDirection(dt, steeringAngleLimit, acceleration, sl AIVehicleUtil.driveInDirection(self.vehicle, dt, steeringAngleLimit, acceleration, slowAcceleration, slowAngleLimit, allowedToDrive, moveForwards, lx, lz, maxSpeed, slowDownFactor) end +end + +function UnloadBGATask:drawDebug() + local node = self.vehicle.components[1].node + local x, y, z = getWorldTranslation(node) + + -- line to trailer or trigger + if self.targetUnloadTrigger ~= nil then + local triggerX, triggerY, triggerZ = ADTriggerManager.getTriggerPos(self.targetUnloadTrigger) + ADDrawingManager:addLineTask(x, y, z, triggerX, triggerY, triggerZ, 0, 1, 0) + end + -- line to current target + if self.targetPoint ~= nil then + ADDrawingManager:addLineTask(x, y, z, self.targetPoint.x, y, self.targetPoint.z, 1, 0, 0) + end + + -- Bunker size + if self.targetBunker ~= nil then + local trigger = self.targetBunker + local x1, z1 = trigger.bunkerSiloArea.sx, trigger.bunkerSiloArea.sz + local x2, z2 = trigger.bunkerSiloArea.wx, trigger.bunkerSiloArea.wz + local x3, z3 = trigger.bunkerSiloArea.hx, trigger.bunkerSiloArea.hz + + local corners = {{x = x1, z = z1}, {x = x2, z = z2}, {x = x3, z = z3}, {x = x2 + (x3 - x1), z = z2 + (z3 - z1)}} + + ADDrawingManager:addLineTask(corners[1].x, y, corners[1].z, corners[2].x, y, corners[2].z, 1, 0, 0) + ADDrawingManager:addLineTask(corners[2].x, y, corners[2].z, corners[3].x, y, corners[3].z, 1, 0, 0) + ADDrawingManager:addLineTask(corners[3].x, y, corners[3].z, corners[4].x, y, corners[4].z, 1, 0, 0) + ADDrawingManager:addLineTask(corners[4].x, y, corners[4].z, corners[1].x, y, corners[1].z, 1, 0, 0) + end end \ No newline at end of file diff --git a/FS19_AutoDrive/textures/input_bunkerUnloadType_1.dds b/FS19_AutoDrive/textures/input_bunkerUnloadType_1.dds new file mode 100644 index 0000000000000000000000000000000000000000..e2d29d0ad56c4a286d099c945b03d222f9a7ffd9 GIT binary patch literal 16512 zcmeHOO^6)F6@ESP5F0~wMq>h7tjQ|+G;(N`Le(s}&zk2-uJ3h+CA;(Os!Q&Xp&ee8hT zTkq6Ha@pK6Nop*9l8)C-*IpTCzUO9U9zXes z9z4EZMli8iOim|rHvPh(r-MV#n1yL5PABX(n>vRGjv~wl`!U1 zG8p0Bws07RM0Fa&Vau0`>{Ow=QIFME>Yq;&r@w77WC9}%sIWfiK_%twHUGkX8UMy` z|8o8}jPGe4qA=`qo@4pr@c5DI%5eX@=_jj>Z^PEG1o%hwfXs6+rZSA>Q1rw$pc4LU zVff!td85aFqVilrAC_&by2aqWZpJDde|@@5eXBoQn-a|HXT5G~=l@K9W4*`v7a=i=qnb(L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^Z3U58N6gkV2p4-F7of$KM&IXFMIrGjejP;)IZ4hxAAT; zsJ?7sfB(y-55j+U)Arw7a@s7K*gpRc=ny>}EF4(8IFM$;UD|hm{%LzA=a<5_*?g-AIx9G zgY|6(U%psu|2+E3?SX&6&HW{yPCAN7gvBhWN>&WiDAJng3_pu!x!zPaxSFZEpD90D}yAyLO zxoq3}%J}Kp@!FHbd_O)jGl$XDfLh4+z^`FH<=h98=h~Ch=6KT!TKaV>kC)eHBh#aO g%wIo`jy&F-pC2Eu)r4=;>vRvQS0#MU;(6o$0UY8J=Kufz literal 0 HcmV?d00001 diff --git a/FS19_AutoDrive/textures/input_bunkerUnloadType_2.dds b/FS19_AutoDrive/textures/input_bunkerUnloadType_2.dds new file mode 100644 index 0000000000000000000000000000000000000000..5a3deb25272e05e12a56d5f99bbaa890effa8a50 GIT binary patch literal 16512 zcmeHOe{36f6@TYqW~d-{iHs_csFS%Bo3uelGmwDcWbUe_VskrRQdZWknMw%}Qp&2b zA*#8RiqM2qin>8NH5q?w+KfgKQX)iYQZ#AOB%uGWR#RD=AjS~YeBNL)rOQ3u`+o0x zclOSSn_e1w%J&rKKKFh1{qa8Uz3-2^OQ-Kk`~U!M(qoXL|NI9j{sGYFZ`048@PbZGzSaRAedAAv-oxA(w-OD8WRAg<-nFibO_ zFBT`uk8guKnk%@u^bvt%WN-59Ugk5K$|GBV2CX3Z&TfOj#QwxY??ujkeRg){Rr^h} z5v{&$LwzVyv3O>(-^0aXK5v>USm~$X^nquJdoC+}tW!9RmW>LphfR^;$iXD@y<^Lk z)m#515BBdzC}9yNtzm12k{@cjLu(_88R{d$NoBHzA!CTZrb+Q&1+xYkMIW6{>JLFD z=%PJZG+xBZIAM?5iqBug<-vU4MyZ;A>wbACd5yT|gUicOl5ET0Jf#)vX`mtWq0?wi z2lExD^o%VJ#pey+KV8C-7-ytD(rF$>SWAn!~pi1W~JDTgJi?DCB~8y1PyM^O!M7fq%dOv9nD z6V-rF_)~?^|3#J8eEeHd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lR3*lf>?)i*PB;VbEPjd$SR+y|B)J8^G%ts!^F#r;1@Z}69QcWakn&>lde^RN2D z|5f7tsB`|m6nGB*i+{rrWPgu#KjHdg0r&lws(fDYIa*G(6Mj%)3%_FRj&1nF&s=$| zlIQa1>&-`q`!C@ar`Amp&JLKS{CdXYpM>00SO4CEr|BIhH?=^_eR>dh|Ml+w?68J$ z5{v5jzXok^hc+bQ3B6z8w8IeN3vGWk4c^>G<1e@OAMiQdFpPipNR0T~zjkEXyN=NQ z9OXZU_}Wu@zS-6F;u@KM>S}+syY=RdABz2Ylg9U#|JZp~N7qXdQ+)W-<7PU&!O6dM zIC*zlQoGr3>ieiv&<)g=4xRc#olgq?rvY``p0F>|M}3OV>hFJgFD51u`(cp32b`Im zeVxA*d=p=FzZaYAFP@>>-TUR&uOB?j?>p@zhf@7xOdmd1;1{a!Lh{f1 + @@ -222,6 +223,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_cz.xml b/FS19_AutoDrive/translations/translation_cz.xml index d9256955..62bc0ac1 100644 --- a/FS19_AutoDrive/translations/translation_cz.xml +++ b/FS19_AutoDrive/translations/translation_cz.xml @@ -32,6 +32,7 @@ + @@ -222,6 +223,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_de.xml b/FS19_AutoDrive/translations/translation_de.xml index 9fbf207d..ee3eac37 100644 --- a/FS19_AutoDrive/translations/translation_de.xml +++ b/FS19_AutoDrive/translations/translation_de.xml @@ -32,6 +32,7 @@ + @@ -222,6 +223,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_en.xml b/FS19_AutoDrive/translations/translation_en.xml index ac30021c..2b545376 100644 --- a/FS19_AutoDrive/translations/translation_en.xml +++ b/FS19_AutoDrive/translations/translation_en.xml @@ -32,6 +32,7 @@ + @@ -222,6 +223,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_es.xml b/FS19_AutoDrive/translations/translation_es.xml index 86c5e07c..5937a7d5 100644 --- a/FS19_AutoDrive/translations/translation_es.xml +++ b/FS19_AutoDrive/translations/translation_es.xml @@ -32,6 +32,7 @@ + @@ -220,6 +221,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_fr.xml b/FS19_AutoDrive/translations/translation_fr.xml index 571d02bd..5d50b56b 100644 --- a/FS19_AutoDrive/translations/translation_fr.xml +++ b/FS19_AutoDrive/translations/translation_fr.xml @@ -32,6 +32,7 @@ + @@ -224,6 +225,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_hu.xml b/FS19_AutoDrive/translations/translation_hu.xml index d9780800..253fc460 100644 --- a/FS19_AutoDrive/translations/translation_hu.xml +++ b/FS19_AutoDrive/translations/translation_hu.xml @@ -33,6 +33,7 @@ + @@ -216,6 +217,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_it.xml b/FS19_AutoDrive/translations/translation_it.xml index 0dce46aa..2395300b 100644 --- a/FS19_AutoDrive/translations/translation_it.xml +++ b/FS19_AutoDrive/translations/translation_it.xml @@ -32,6 +32,7 @@ + @@ -222,6 +223,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_nl.xml b/FS19_AutoDrive/translations/translation_nl.xml index ac215254..c664a627 100644 --- a/FS19_AutoDrive/translations/translation_nl.xml +++ b/FS19_AutoDrive/translations/translation_nl.xml @@ -32,6 +32,7 @@ + @@ -222,6 +223,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_pl.xml b/FS19_AutoDrive/translations/translation_pl.xml index 9e973cae..e8e32fec 100644 --- a/FS19_AutoDrive/translations/translation_pl.xml +++ b/FS19_AutoDrive/translations/translation_pl.xml @@ -32,6 +32,7 @@ + @@ -222,6 +223,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_pt.xml b/FS19_AutoDrive/translations/translation_pt.xml index 43971693..d4ed819b 100644 --- a/FS19_AutoDrive/translations/translation_pt.xml +++ b/FS19_AutoDrive/translations/translation_pt.xml @@ -32,6 +32,7 @@ + @@ -226,6 +227,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_ru.xml b/FS19_AutoDrive/translations/translation_ru.xml index 027d4c03..d4cf2579 100644 --- a/FS19_AutoDrive/translations/translation_ru.xml +++ b/FS19_AutoDrive/translations/translation_ru.xml @@ -32,6 +32,7 @@ + @@ -222,6 +223,7 @@ + diff --git a/FS19_AutoDrive/translations/translation_tr.xml b/FS19_AutoDrive/translations/translation_tr.xml index 6271dfa8..30facc1f 100644 --- a/FS19_AutoDrive/translations/translation_tr.xml +++ b/FS19_AutoDrive/translations/translation_tr.xml @@ -32,6 +32,7 @@ + @@ -220,6 +221,7 @@ + From 85b6b501101f581069009b72b12e05e906dbb504 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Mon, 24 May 2021 16:59:27 +0200 Subject: [PATCH 41/46] Fixed silo length calculation. --- FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua b/FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua index 0f8d2370..19e4ead1 100644 --- a/FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua +++ b/FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua @@ -768,11 +768,11 @@ function UnloadBGATask:getTargetBunkerLoadingSide() end local trigger = self.targetBunker - -- vecW + -- vecW local x1, z1 = trigger.bunkerSiloArea.sx, trigger.bunkerSiloArea.sz -- 1 ---- 2 local x2, z2 = trigger.bunkerSiloArea.wx, trigger.bunkerSiloArea.wz -- vecH | ---- | local x3, z3 = trigger.bunkerSiloArea.hx, trigger.bunkerSiloArea.hz -- | ---- | - local x4, z4 = x2 + (x3 - x1), z2 + (z3 - z1) -- 3 ---- 4 4 = 2 + vecH + local x4, z4 = x2 + (x3 - x1), z2 + (z3 - z1) -- 3 ---- 4 4 = 2 + vecH local x, _, z = getWorldTranslation(self.vehicle.components[1].node) @@ -1139,6 +1139,7 @@ function UnloadBGATask:loadFromBGA(dt) end function UnloadBGATask:getTargetForShovelOffset(inFront) + print("Getting target for shovel in front: " .. inFront) local offsetToUse = self.shovelOffsetCounter local fromOtherSide = false if self.shovelOffsetCounter > self.highestShovelOffsetCounter then @@ -1157,6 +1158,10 @@ function UnloadBGATask:getPointXInFrontAndYOffsetFromBunker(inFront, offset, fro local normalizedVec = {x = (p2.x - p1.x) / (math.abs(p2.x - p1.x) + math.abs(p2.z - p1.z)), z = (p2.z - p1.z) / (math.abs(p2.x - p1.x) + math.abs(p2.z - p1.z))} --get ortho for 'inFront' parameter local ortho = {x = -normalizedVec.z, z = normalizedVec.x} + local factor = math.sqrt(math.pow(ortho.x, 2) + math.pow(ortho.z, 2)) + ortho.x = ortho.x / factor + ortho.z = ortho.z / factor + --get shovel offset correct position on silo line local targetPoint = {x = p1.x + normalizedVec.x * offset, z = p1.z + normalizedVec.z * offset} From a55b377adfad25dc4295efb543760d6744c3eac4 Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Mon, 24 May 2021 21:48:04 +0200 Subject: [PATCH 42/46] Adjusted bga target distances to vehicle length --- FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua b/FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua index 19e4ead1..bf85810c 100644 --- a/FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua +++ b/FS19_AutoDrive/scripts/Tasks/UnloadBGATask.lua @@ -878,7 +878,8 @@ function UnloadBGATask:driveToSiloCommonPoint(dt) self.checkedCurrentRow = true end - self.targetPoint = self:getTargetForShovelOffset(14) + --self.targetPoint = self:getTargetForShovelOffset(14) + self.targetPoint = self:getTargetForShovelOffset(AutoDrive.getVehicleLeadingEdge(vehicle) + 6) local angleToSilo = self:getAngleToTarget() -- in +/- 180° if self.storedDirection == nil then @@ -912,7 +913,8 @@ function UnloadBGATask:driveToSiloClosePoint(dt) end function UnloadBGATask:driveToSiloReversePoint(dt) - self.targetPoint = self:getTargetForShovelOffset(18) + --self.targetPoint = self:getTargetForShovelOffset(18) + self.targetPoint = self:getTargetForShovelOffset(AutoDrive.getVehicleLeadingEdge(vehicle) + 6) self.driveStrategy = self:getDriveStrategyToTarget(false, dt) self.shovelTarget = self.SHOVELSTATE_LOW @@ -1139,7 +1141,6 @@ function UnloadBGATask:loadFromBGA(dt) end function UnloadBGATask:getTargetForShovelOffset(inFront) - print("Getting target for shovel in front: " .. inFront) local offsetToUse = self.shovelOffsetCounter local fromOtherSide = false if self.shovelOffsetCounter > self.highestShovelOffsetCounter then @@ -1188,7 +1189,8 @@ function UnloadBGATask:reverseFromBGALoad(dt) self.shovelTarget = self.SHOVELSTATE_LOW self.targetPoint = self:getTargetForShovelOffset(200) - self.targetPointClose = self:getTargetForShovelOffset(16) + --self.targetPointClose = self:getTargetForShovelOffset(16) + self.targetPointClose = self:getTargetForShovelOffset(AutoDrive.getVehicleLeadingEdge(vehicle) + 10) local finalSpeed = 30 local acc = 1 From 1344312c4f1cfa63b97a83ff6350a8abcbd5407e Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Sun, 30 May 2021 11:58:29 +0200 Subject: [PATCH 43/46] Do not draw the subPrio Marker node. --- FS19_AutoDrive/scripts/Specialization.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/FS19_AutoDrive/scripts/Specialization.lua b/FS19_AutoDrive/scripts/Specialization.lua index 6b880d6d..9658b7bb 100644 --- a/FS19_AutoDrive/scripts/Specialization.lua +++ b/FS19_AutoDrive/scripts/Specialization.lua @@ -533,8 +533,9 @@ function AutoDrive:onDrawEditorMode() local y = point.y local z = point.z local isSubPrio = ADGraphManager:getIsPointSubPrio(point.id) + local isSubPrioMarker = ADGraphManager:getIsPointSubPrioMarker(point.id) - if AutoDrive.isInExtendedEditorMode() then + if AutoDrive.isInExtendedEditorMode() and not isSubPrioMarker then arrowPosition = DrawingManager.arrows.position.middle if AutoDrive.enableSphrere == true then if AutoDrive.mouseIsAtPos(point, 0.01) then @@ -623,7 +624,7 @@ function AutoDrive:onDrawEditorMode() end --just a quick way to highlight single (forgotten) points with no connections - if (#point.out == 0) and (#point.incoming == 0) and not table.contains(outPointsSeen, point.id) then + if (#point.out == 0) and (#point.incoming == 0) and not table.contains(outPointsSeen, point.id) and not isSubPrioMarker then y = getTerrainHeightAtWorldPos(g_currentMission.terrainRootNode, x, 1, z) + 0.5 DrawingManager:addCrossTask(x, y, z) end From 53e6554f806b1a3069db034ad06194318070880e Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Sun, 30 May 2021 14:43:22 +0200 Subject: [PATCH 44/46] Adjusted weight for preferred start correction. --- FS19_AutoDrive/scripts/PathCalculation.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FS19_AutoDrive/scripts/PathCalculation.lua b/FS19_AutoDrive/scripts/PathCalculation.lua index ed6a21e8..84409bc9 100644 --- a/FS19_AutoDrive/scripts/PathCalculation.lua +++ b/FS19_AutoDrive/scripts/PathCalculation.lua @@ -94,7 +94,7 @@ function ADPathCalculator:GetPath(startID, targetID, preferredStartIds) local preventTurnaroundWeight = 0 if point.id == startID then if not table.contains(preferredStartIds, outPoint.id) then - preventTurnaroundWeight = 5000 + preventTurnaroundWeight = 5000000 end end candidates:enqueue({p=outPoint, distance=(distance + distanceFunc(outPoint.x - point.x, outPoint.z - point.z) * factor + (addedWeights[outPoint.id] or 0) + preventTurnaroundWeight), pre=point.id}) From 8f231e73e09f6acc878e7aa267432a3e47afb0de Mon Sep 17 00:00:00 2001 From: Stephan Schlosser Date: Sun, 30 May 2021 15:17:35 +0200 Subject: [PATCH 45/46] Dont force show tip of the day for now. Increased RC number. --- FS19_AutoDrive/scripts/AutoDrive.lua | 2 +- FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua | 2 +- FS19_AutoDrive/scripts/TipOfTheDayHandler.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FS19_AutoDrive/scripts/AutoDrive.lua b/FS19_AutoDrive/scripts/AutoDrive.lua index 16624c12..d17efa1f 100644 --- a/FS19_AutoDrive/scripts/AutoDrive.lua +++ b/FS19_AutoDrive/scripts/AutoDrive.lua @@ -1,5 +1,5 @@ AutoDrive = {} -AutoDrive.version = "1.1.1.1-RC2" +AutoDrive.version = "1.1.1.1-RC3" AutoDrive.directory = g_currentModDirectory diff --git a/FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua b/FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua index 310e80bd..c3074879 100644 --- a/FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua +++ b/FS19_AutoDrive/scripts/Gui/TipOfTheDayGUI.lua @@ -55,7 +55,7 @@ end function ADTipOfTheDayGUI:onClickActivate() --ADTipOfTheDayGUI:superClass().onClickActivate(self) - AutoDrive.showNextTipOfTheDay() + --AutoDrive.showNextTipOfTheDay() self:refreshItems() end diff --git a/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua b/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua index 179db621..3e5c4931 100644 --- a/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua +++ b/FS19_AutoDrive/scripts/TipOfTheDayHandler.lua @@ -30,7 +30,7 @@ AutoDrive.tipOfTheDay.Entries[4].titletext = "ad_totd_04_title" AutoDrive.tipOfTheDay.currentTipId = 1 AutoDrive.tipOfTheDay.highestTipId = 1 -AutoDrive.tipOfTheDay.displayedYet = false +AutoDrive.tipOfTheDay.displayedYet = true AutoDrive.tipOfTheDay.delayTime = 500 From 8ae86cc0f8aa6dbeb8e26728c9ad9351e8aef2c3 Mon Sep 17 00:00:00 2001 From: Dueesberch Date: Fri, 11 Jun 2021 22:01:52 +0200 Subject: [PATCH 46/46] rollback combine CP AD Hud control --- FS19_AutoDrive/gui/userSettingsPage.xml | 8 --- FS19_AutoDrive/scripts/AutoDrive.lua | 39 +----------- FS19_AutoDrive/scripts/Hud.lua | 60 ++----------------- .../scripts/Manager/InputManager.lua | 5 +- .../translations/translation_de.xml | 7 --- .../translations/translation_it.xml | 6 -- .../translations/translation_nl.xml | 6 -- .../translations/translation_pl.xml | 6 -- .../translations/translation_pt.xml | 6 -- .../translations/translation_ru.xml | 6 -- 10 files changed, 8 insertions(+), 141 deletions(-) diff --git a/FS19_AutoDrive/gui/userSettingsPage.xml b/FS19_AutoDrive/gui/userSettingsPage.xml index 1632c289..ea80c9c2 100644 --- a/FS19_AutoDrive/gui/userSettingsPage.xml +++ b/FS19_AutoDrive/gui/userSettingsPage.xml @@ -105,14 +105,6 @@ - - - - - - - - diff --git a/FS19_AutoDrive/scripts/AutoDrive.lua b/FS19_AutoDrive/scripts/AutoDrive.lua index d456f410..8c2b2aae 100644 --- a/FS19_AutoDrive/scripts/AutoDrive.lua +++ b/FS19_AutoDrive/scripts/AutoDrive.lua @@ -68,7 +68,7 @@ AutoDrive.toggleSphrere = true AutoDrive.enableSphrere = true AutoDrive.actions = { - {"ADToggleMouse", true, 1}, -- can be changed by AutoDrive:enableCPaction() + {"ADToggleMouse", true, 1}, {"ADToggleHud", true, 1}, {"ADEnDisable", true, 1}, {"ADSelectTarget", false, 0}, @@ -97,7 +97,6 @@ AutoDrive.actions = { {"AD_continue", false, 3}, {"ADParkVehicle", false, 0}, {"AD_devAction", false, 0}, - {"COURSEPLAY_MOUSEACTION_SECONDARY", true, 1}, -- can be changed by AutoDrive:enableCPaction() {"AD_open_tipOfTheDay", false, 0} } @@ -379,40 +378,4 @@ function AutoDrive:FarmStats_getStatisticData(superFunc) return Utils.getNoNil(self.statisticData, {}) end --- disable / enable ADToggleMouse to get only one button to hanlde mouse -function AutoDrive:enableCPaction(enableCPaction) - local found = false - if enableCPaction then - ADInputManager.actionsToInputs["ADToggleMouse"] = nil - ADInputManager.actionsToInputs["COURSEPLAY_MOUSEACTION_SECONDARY"] = "input_toggleMouse" - - for key, val in pairs(AutoDrive.actions) do - if val[1] == "ADToggleMouse" then - table.remove(AutoDrive.actions, key) - end - if val[1] == "COURSEPLAY_MOUSEACTION_SECONDARY" then - found = true - end - end - if not found then - table.insert(AutoDrive.actions, {"COURSEPLAY_MOUSEACTION_SECONDARY", true, 1}) - end - else - ADInputManager.actionsToInputs["ADToggleMouse"] = "input_toggleMouse" - ADInputManager.actionsToInputs["COURSEPLAY_MOUSEACTION_SECONDARY"] = nil - - for key, val in pairs(AutoDrive.actions) do - if val[1] == "ADToggleMouse" then - found = true - end - if val[1] == "COURSEPLAY_MOUSEACTION_SECONDARY" then - table.remove(AutoDrive.actions, key) - end - end - if not found then - table.insert(AutoDrive.actions, {"ADToggleMouse", true, 1}) - end - end -end - addModEventListener(AutoDrive) diff --git a/FS19_AutoDrive/scripts/Hud.lua b/FS19_AutoDrive/scripts/Hud.lua index 8a0d1afe..a73a6341 100644 --- a/FS19_AutoDrive/scripts/Hud.lua +++ b/FS19_AutoDrive/scripts/Hud.lua @@ -138,20 +138,6 @@ function AutoDriveHud:createHudAt(hudX, hudY) self.Speed = "50" self.Target = "Not Ready" self.showHud = false - self.stateHud = 0 - self.statesHud = 0 - - if AutoDrive.getSetting("combineCPADHudMouse") > 1.0 and g_courseplay ~= nil then - AutoDrive:enableCPaction(true) - if AutoDrive.getSetting("combineCPADHudMouse") == 2.0 then - self.statesHud = 1 - elseif AutoDrive.getSetting("combineCPADHudMouse") == 3.0 then - self.statesHud = 2 - end - else - AutoDrive:enableCPaction(false) - self.statesHud = 0 - end if ADGraphManager:getMapMarkerById(1) ~= nil then self.Target = ADGraphManager:getMapMarkerById(1).name @@ -375,47 +361,13 @@ function AutoDriveHud:update(dt) end function AutoDriveHud:toggleHud(vehicle) - if self.statesHud > 0 then - if self.stateHud == 0 then - -- show both - self.showHud = true - vehicle.ad.showingHud = true - g_courseplay.courseplay:openCloseHud(vehicle, true) - if self.statesHud == 2 then - self.stateHud = 1 - else - self.stateHud = 3 - end - elseif self.stateHud == 1 then - -- show AD hud - self.showHud = true - vehicle.ad.showingHud = true - g_courseplay.courseplay:openCloseHud(vehicle, false) - g_inputBinding:setShowMouseCursor(true) - self.stateHud = 2 - elseif self.stateHud == 2 then - -- show CP hud - self.showHud = false - vehicle.ad.showingHud = false - g_courseplay.courseplay:openCloseHud(vehicle, true) - self.stateHud = 3 - elseif self.stateHud == 3 then - -- close both - self.showHud = false - vehicle.ad.showingHud = false - g_inputBinding:setShowMouseCursor(false) - g_courseplay.courseplay:openCloseHud(vehicle, false) - self.stateHud = 0 - end + if self.showHud == false then + self.showHud = true + vehicle.ad.showingHud = true else - if self.showHud == false then - self.showHud = true - vehicle.ad.showingHud = true - else - self.showHud = false - vehicle.ad.showingHud = false - g_inputBinding:setShowMouseCursor(false) - end + self.showHud = false + vehicle.ad.showingHud = false + g_inputBinding:setShowMouseCursor(false) end AutoDrive.showingHud = self.showHud diff --git a/FS19_AutoDrive/scripts/Manager/InputManager.lua b/FS19_AutoDrive/scripts/Manager/InputManager.lua index 95795336..c9624a83 100644 --- a/FS19_AutoDrive/scripts/Manager/InputManager.lua +++ b/FS19_AutoDrive/scripts/Manager/InputManager.lua @@ -24,8 +24,7 @@ ADInputManager.actionsToInputs = { AD_FieldSpeed_up = "input_increaseFieldSpeed", AD_FieldSpeed_down = "input_decreaseFieldSpeed", ADToggleHud = "input_toggleHud", - ADToggleMouse = "input_toggleMouse", -- can be changed by AutoDrive:enableCPaction() - COURSEPLAY_MOUSEACTION_SECONDARY = "input_toggleMouse", -- can be changed by AutoDrive:enableCPaction() + ADToggleMouse = "input_toggleMouse", ADDebugDeleteWayPoint = "input_removeWaypoint", AD_routes_manager = "input_routesManager", ADSelectNextFillType = "input_nextFillType", @@ -127,8 +126,6 @@ function ADInputManager:input_openTipOfTheDay(vehicle) AutoDrive.onOpenTipOfTheDay() end - - function ADInputManager:input_editMapMarker(vehicle) if AutoDrive.isEditorModeEnabled() then -- This can be triggered both from 'Edit Target' keyboard shortcut and right click on 'Create Target' hud button diff --git a/FS19_AutoDrive/translations/translation_de.xml b/FS19_AutoDrive/translations/translation_de.xml index 8c114ffa..63936b5d 100644 --- a/FS19_AutoDrive/translations/translation_de.xml +++ b/FS19_AutoDrive/translations/translation_de.xml @@ -325,13 +325,6 @@ - - - - - - - diff --git a/FS19_AutoDrive/translations/translation_it.xml b/FS19_AutoDrive/translations/translation_it.xml index 91c2d86b..3c1cd8bb 100644 --- a/FS19_AutoDrive/translations/translation_it.xml +++ b/FS19_AutoDrive/translations/translation_it.xml @@ -326,12 +326,6 @@ - - - - - - diff --git a/FS19_AutoDrive/translations/translation_nl.xml b/FS19_AutoDrive/translations/translation_nl.xml index 9629a48e..cf77e324 100644 --- a/FS19_AutoDrive/translations/translation_nl.xml +++ b/FS19_AutoDrive/translations/translation_nl.xml @@ -326,12 +326,6 @@ - - - - - - diff --git a/FS19_AutoDrive/translations/translation_pl.xml b/FS19_AutoDrive/translations/translation_pl.xml index 2c066512..96c3b883 100644 --- a/FS19_AutoDrive/translations/translation_pl.xml +++ b/FS19_AutoDrive/translations/translation_pl.xml @@ -325,12 +325,6 @@ - - - - - - diff --git a/FS19_AutoDrive/translations/translation_pt.xml b/FS19_AutoDrive/translations/translation_pt.xml index 9c5572b6..88a4b514 100644 --- a/FS19_AutoDrive/translations/translation_pt.xml +++ b/FS19_AutoDrive/translations/translation_pt.xml @@ -329,12 +329,6 @@ - - - - - - diff --git a/FS19_AutoDrive/translations/translation_ru.xml b/FS19_AutoDrive/translations/translation_ru.xml index 6fb6cc06..8704ea5e 100644 --- a/FS19_AutoDrive/translations/translation_ru.xml +++ b/FS19_AutoDrive/translations/translation_ru.xml @@ -326,12 +326,6 @@ - - - - - -