diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml
index 012636f3d..767048df2 100644
--- a/.github/workflows/unit-test.yml
+++ b/.github/workflows/unit-test.yml
@@ -35,7 +35,7 @@ jobs:
lua LoggerTest.lua
- name: Run course generator unit tests
run: |
- cd scripts/courseGenerator/test
+ pushd scripts/courseGenerator/test
lua BlockSequencerTest.lua
lua CacheMapTest.lua
lua CenterTest.lua
@@ -53,3 +53,6 @@ jobs:
lua TransformTest.lua
lua VertexTest.lua
lua WrapAroundIndexTest.lua
+ popd
+ pushd scripts/pathfinder/test
+ lua GraphPathfinderTest.lua
\ No newline at end of file
diff --git a/Courseplay.lua b/Courseplay.lua
index a3e239124..931177478 100644
--- a/Courseplay.lua
+++ b/Courseplay.lua
@@ -32,6 +32,7 @@ function Courseplay:registerXmlSchema()
CpBaseHud.registerXmlSchema(self.xmlSchema, self.xmlKey)
CpHudInfoTexts.registerXmlSchema(self.xmlSchema, self.xmlKey)
CpInGameMenu.registerXmlSchema(self.xmlSchema, self.xmlKey)
+ Graph.registerXmlSchema(self.xmlSchema, self.xmlKey)
end
--- Loads data not tied to a savegame.
@@ -115,6 +116,7 @@ function Courseplay:loadMap(filename)
self.xmlFile = XMLFile.load("cpXml", filePath , self.xmlSchema)
if self.xmlFile == nil then return end
self.globalSettings:loadFromXMLFile(self.xmlFile, g_Courseplay.xmlKey)
+ g_graph:loadFromXMLFile(self.xmlFile, g_Courseplay.xmlKey)
self.xmlFile:delete()
end
@@ -128,15 +130,18 @@ function Courseplay:deleteMap()
self:saveUserSettings()
end
g_courseEditor:delete()
+ g_graphEditor:delete()
BufferedCourseDisplay.deleteBuffer()
g_signPrototypes:delete()
g_consoleCommands:delete()
+ g_graph:delete()
end
function Courseplay:setupGui()
CpInGameMenu.setupGui(self.courseStorage)
self.infoTextsHud = CpHudInfoTexts()
-
+ TargetPointSelectionDialog.register()
+ FilltypeSelectionDialog.register()
--- Adding Player input bindings
local function addPlayerActionEvents(self, superFunc, ...)
superFunc(self, ...)
@@ -144,6 +149,11 @@ function Courseplay:setupGui()
g_messageCenter:publishDelayed(MessageType.GUI_CP_INGAME_OPEN)
end, false, true, false, true)
g_inputBinding:setActionEventTextVisibility(id, false)
+
+ local _, id = g_inputBinding:registerActionEvent(InputAction.CP_OPEN_GRAPH_EDITOR, self, function ()
+ g_graphEditor:open()
+ end, false, true, false, true)
+ g_inputBinding:setActionEventTextVisibility(id, false)
-- CpDebug.registerEvents()
end
PlayerInputComponent.registerGlobalPlayerActionEvents = Utils.overwrittenFunction(
@@ -166,16 +176,19 @@ end
--- Saves all global data, for example global settings.
function Courseplay.saveToXMLFile(missionInfo)
if missionInfo.isValid then
- local saveGamePath = missionInfo.savegameDirectory .."/"
- local xmlFile = XMLFile.create("cpXml", saveGamePath.. "Courseplay.xml",
- "Courseplay", g_Courseplay.xmlSchema)
- if xmlFile then
- g_Courseplay.globalSettings:saveToXMLFile(xmlFile, g_Courseplay.xmlKey)
- xmlFile:save()
- xmlFile:delete()
- end
- g_Courseplay:saveUserSettings()
- g_assignedCoursesManager:saveAssignedCourses(saveGamePath)
+ CpUtil.try(function ()
+ local saveGamePath = missionInfo.savegameDirectory .."/"
+ local xmlFile = XMLFile.create("cpXml", saveGamePath.. "Courseplay.xml",
+ "Courseplay", g_Courseplay.xmlSchema)
+ if xmlFile then
+ g_Courseplay.globalSettings:saveToXMLFile(xmlFile, g_Courseplay.xmlKey)
+ g_graph:saveToXMLFile(xmlFile, g_Courseplay.xmlKey)
+ xmlFile:save()
+ xmlFile:delete()
+ end
+ g_Courseplay:saveUserSettings()
+ g_assignedCoursesManager:saveAssignedCourses(saveGamePath)
+ end)
end
end
FSCareerMissionInfo.saveToXMLFile = Utils.prependedFunction(FSCareerMissionInfo.saveToXMLFile, Courseplay.saveToXMLFile)
@@ -186,6 +199,8 @@ function Courseplay:update(dt)
g_triggerManager:update(dt)
g_baleToCollectManager:update(dt)
g_courseEditor:update(dt)
+ g_graphEditor:update(dt)
+ g_graph:update(dt)
if not self.postInit then
-- Doubles the map zoom for 4x Maps. Mainly to make it easier to set targets for unload triggers.
self.postInit = true
@@ -206,6 +221,7 @@ function Courseplay:draw()
g_triggerManager:draw()
g_baleToCollectManager:draw()
end
+ g_graph:draw()
g_devHelper:draw()
CpDebug:draw()
if not g_gui:getIsGuiVisible() and not g_noHudModeEnabled then
@@ -261,6 +277,7 @@ function Courseplay:load()
--- Register additional AI messages.
CpAIMessages.register()
g_vineScanner:setup()
+ g_graph:setup()
end
--- Registers all cp specializations.
@@ -280,6 +297,7 @@ function Courseplay.register(typeManager)
CpAICombineUnloader.register(typeManager, typeName, typeEntry.specializations)
CpAISiloLoaderWorker.register(typeManager, typeName, typeEntry.specializations)
CpAIBunkerSiloWorker.register(typeManager, typeName, typeEntry.specializations)
+ CpAIStreetWorker.register(typeManager, typeName, typeEntry.specializations)
-- TODO 25 CpGamePadHud.register(typeManager, typeName,typeEntry.specializations)
CpHud.register(typeManager, typeName, typeEntry.specializations)
CpInfoTexts.register(typeManager, typeName, typeEntry.specializations)
diff --git a/config/GraphEditorCategories.xml b/config/GraphEditorCategories.xml
new file mode 100644
index 000000000..bdcdb8c16
--- /dev/null
+++ b/config/GraphEditorCategories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/HudSettingsSetup.xml b/config/HudSettingsSetup.xml
index db6293fd6..d3678b831 100644
--- a/config/HudSettingsSetup.xml
+++ b/config/HudSettingsSetup.xml
@@ -20,9 +20,7 @@
5
-
CP_job_fieldWork
@@ -30,7 +28,7 @@
CP_job_bunkerSilo
CP_job_siloLoader
CP_job_combineUnload
-
+ CP_job_street
diff --git a/config/MasterTranslations.xml b/config/MasterTranslations.xml
index 6c3ce8357..92263a7f5 100644
--- a/config/MasterTranslations.xml
+++ b/config/MasterTranslations.xml
@@ -91,8 +91,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -207,6 +219,14 @@
+
+
+
+
+
+
+
+
@@ -225,26 +245,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -253,6 +257,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -326,6 +354,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -347,6 +446,10 @@
+
+
+
+
@@ -1694,6 +1797,180 @@ The course is saved automatically on closing of the editor and overrides the sel
-->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1868,6 +2145,10 @@ The course is saved automatically on closing of the editor and overrides the sel
+
+
+
+
@@ -3200,6 +3481,10 @@ TPS extension
+
+
+
+
+
+
diff --git a/config/gui/dialog/FilltypeSelectionDialog.xml b/config/gui/dialog/FilltypeSelectionDialog.xml
new file mode 100644
index 000000000..d981f3e0c
--- /dev/null
+++ b/config/gui/dialog/FilltypeSelectionDialog.xml
@@ -0,0 +1,208 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config/gui/dialog/TargetPointSelectionDialog.xml b/config/gui/dialog/TargetPointSelectionDialog.xml
new file mode 100644
index 000000000..754ffee56
--- /dev/null
+++ b/config/gui/dialog/TargetPointSelectionDialog.xml
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config/gui/pages/CourseGeneratorFrame.xml b/config/gui/pages/CourseGeneratorFrame.xml
index da191c2f0..6a04a684a 100644
--- a/config/gui/pages/CourseGeneratorFrame.xml
+++ b/config/gui/pages/CourseGeneratorFrame.xml
@@ -72,13 +72,14 @@
-
+
-