Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
4cee69e
WIP
schwiti6190 Mar 26, 2025
5b8b393
Updated translations
schwiti6190 Mar 26, 2025
c93e957
Kleine Anpassung und Keybind hinzugefügt
schwiti6190 Mar 26, 2025
346a2eb
Updated translations
schwiti6190 Mar 26, 2025
f71d4b2
Line Brush improvements
schwiti6190 Mar 27, 2025
e0d1015
Updated translations
schwiti6190 Mar 27, 2025
261e175
feat: Graph pathfinder
Feb 28, 2025
83083e1
fix: goal node heading threshold
Mar 28, 2025
9e42bb3
Added simple drawing on the ingame map
schwiti6190 Mar 28, 2025
4fdd28c
WIP add mirror brush function
schwiti6190 Mar 28, 2025
8fb6afd
Updated translations
schwiti6190 Mar 28, 2025
af9a90f
Translation fixes
schwiti6190 Mar 28, 2025
198522f
Updated translations
schwiti6190 Mar 28, 2025
56fd9cc
feat: graph pathfinder
Mar 29, 2025
35fdceb
test: pipeline and mocks
Mar 29, 2025
4160f75
chore: pipeline fix
Mar 29, 2025
7b8efd2
feat: entry/exit graph mid-edge
Mar 29, 2025
46bd119
WIP Graphpathfinder find path to target console command
schwiti6190 Mar 29, 2025
cb55f60
The complete Segment is translated into a graph edge
schwiti6190 Mar 29, 2025
98d5f5c
Added nil checkt
schwiti6190 Mar 29, 2025
7e8e422
Target creation bug fix
schwiti6190 Mar 29, 2025
3782ec8
test: edges with two points only
Mar 29, 2025
8a04c79
Target adjustments and line brush improvements
schwiti6190 Mar 29, 2025
b94680c
feat: more debugs
Mar 29, 2025
fa32112
Changed insert waypoint brush
schwiti6190 Mar 30, 2025
1b15156
feat: start/goal can be at any distance
Mar 30, 2025
c07d0d3
refactor: big scary pathfinder refactoring
Mar 30, 2025
3e2e5a7
feat: return goalNodeInvalid if entry too close to exit
Mar 30, 2025
31544a6
fix: pathfinder call I broke
Mar 30, 2025
b8aeff7
WIP parse giants splines to graph
schwiti6190 Mar 30, 2025
4850aa1
Split brush fix and hit box improvement
schwiti6190 Mar 30, 2025
d95dc82
Fixes save to xml bug
schwiti6190 Mar 31, 2025
1dc3c1d
feat: can make left turns to two-lane roads
Apr 2, 2025
d26e4ca
Started adding street boiler plate ...
schwiti6190 Mar 28, 2025
5e9be39
WIP Some more boiler plate and fixes
schwiti6190 Mar 28, 2025
c83d7f0
WIP Some more boilerplate
schwiti6190 Mar 30, 2025
ccd03f0
Add street translations
schwiti6190 Mar 30, 2025
6cb19bb
Updated translations
schwiti6190 Mar 30, 2025
b1bb386
WIP adding more boilerplate
schwiti6190 Mar 30, 2025
7bac917
Multiple bug fixes ..
schwiti6190 Mar 30, 2025
d39cb67
Updated translations
schwiti6190 Mar 30, 2025
be7515b
WIP some more gui boiler plate
schwiti6190 Apr 1, 2025
0e92cfe
Updated translations
schwiti6190 Apr 1, 2025
3fd613e
WIP some more ingame menu gui improvements
schwiti6190 Apr 2, 2025
39f8890
max iteration and radius increase
Tensuko Apr 2, 2025
5a973e1
Same as in Graph.lua
Tensuko Apr 3, 2025
2ee21ec
Added target point selection dialog
schwiti6190 Apr 5, 2025
1bc02f7
Small adjustment
schwiti6190 Apr 5, 2025
4f6813b
Some more adjustments and bug fixes
schwiti6190 Apr 5, 2025
858a042
feat: transition between edges
Apr 5, 2025
a142482
doc: GrapPathfinder comments
Apr 5, 2025
6782293
Target dialog bug fix ..
schwiti6190 Apr 5, 2025
cd14e07
fix: skip edges with less than 2 vertices
Apr 5, 2025
a35a66f
test: include path
Apr 5, 2025
8fa0817
test: proper setup/teardown
Apr 5, 2025
6f71c6a
feat: use vehicle turn radius for street pathfinding
Apr 5, 2025
89366ff
Save the map id, for which the graph was created.
schwiti6190 Apr 5, 2025
46547a3
Add Copy to target point setting
schwiti6190 Apr 5, 2025
73aad46
feat: slow down in turns
Apr 5, 2025
d1d52f6
feat: tight turn and proximity sensor bridge workaround
Apr 5, 2025
4ba5f23
fix: log speed limit less
Apr 5, 2025
40a5560
Filltype menu and diff gui fixes
schwiti6190 Apr 6, 2025
7171168
WIP load unload
schwiti6190 Apr 6, 2025
48bbd95
Updated translations
schwiti6190 Apr 6, 2025
828a5fb
Typo ..
schwiti6190 Apr 6, 2025
d7bbdbc
Some more typos
schwiti6190 Apr 6, 2025
e1cc52f
Some more load/unload adjustments
schwiti6190 Apr 6, 2025
30010f4
fix: speed limiter callstack
Apr 6, 2025
c372d53
Added filltypes to hud
schwiti6190 Apr 6, 2025
5e38932
Some more gui adjustments
schwiti6190 Apr 10, 2025
2fdcc07
Some more gui/task updates
schwiti6190 Apr 11, 2025
8106662
WIP added mp graph events
schwiti6190 Apr 11, 2025
e03b462
WIP baleloader unload
schwiti6190 Apr 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -53,3 +53,6 @@ jobs:
lua TransformTest.lua
lua VertexTest.lua
lua WrapAroundIndexTest.lua
popd
pushd scripts/pathfinder/test
lua GraphPathfinderTest.lua
40 changes: 29 additions & 11 deletions Courseplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand All @@ -128,22 +130,30 @@ 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, ...)
local _, id = g_inputBinding:registerActionEvent(InputAction.CP_OPEN_INGAME_MENU, self, function ()
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(
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -261,6 +277,7 @@ function Courseplay:load()
--- Register additional AI messages.
CpAIMessages.register()
g_vineScanner:setup()
g_graph:setup()
end

--- Registers all cp specializations.
Expand All @@ -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)
Expand Down
20 changes: 20 additions & 0 deletions config/GraphEditorCategories.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<Category>
<Tab name="points" iconSliceId="cpIconSprite.circle">
<Brush name="insertPoint" class="InsertPointBrush" iconSliceId="cpUi.editorInsert"/>
<Brush name="deletePoint" class="DeletePointBrush" iconSliceId="cpUi.trashcan"/>
<Brush name="movePoint" class="MovePointBrush" iconSliceId="cpUi.editorMove"/>
<Brush name="linePoint" class="LinePointBrush" iconSliceId="cpUi.editorMove"/>
</Tab>
<Tab name="segments" iconSliceId="cpIconSprite.circle">
<!-- <Brush name="createSegment" class="CreateSegmentBrush" iconSliceId="cpUi.editorInsert"/> -->
<Brush name="mergeSplitSegment" class="MergeSplitSegmentBrush" iconSliceId="cpUi.trashcan"/>
<Brush name="deleteSegment" class="DeleteSegmentBrush" iconSliceId="cpUi.trashcan"/>
<Brush name="changeSegmentType" class="ChangeSegmentTypBrush" iconSliceId="cpUi.trashcan"/>
</Tab>
<Tab name="targets" iconSliceId="cpIconSprite.circle">
<Brush name="createTarget" class="CreateTargetBrush" iconSliceId="cpUi.editorInsert"/>
<Brush name="deleteTarget" class="DeleteTargetBrush" iconSliceId="cpUi.trashcan"/>
<Brush name="renameTarget" class="RenameTargetBrush" iconSliceId="cpUi.editorMove"/>
</Tab>
</Category>
4 changes: 1 addition & 3 deletions config/HudSettingsSetup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@
<!-- Combine Unloader -->
<Value name="COMBINE_UNLOADER_SELECTED" isDisabled="isUnloaderModeDisabled">5</Value>
<!-- Street Driver -->
<!--
<Value name="STREET_DRIVER_SELECTED" isDisabled="isStreetModeDisabled">6</Value>
-->
</Values>
<Texts>
<Text prefix="false">CP_job_fieldWork</Text>
<Text prefix="false">CP_job_baleCollect</Text>
<Text prefix="false">CP_job_bunkerSilo</Text>
<Text prefix="false">CP_job_siloLoader</Text>
<Text prefix="false">CP_job_combineUnload</Text>
<!-- <Text prefix="false">CP_job_street</Text> -->
<Text prefix="false">CP_job_street</Text>
</Texts>
</Setting>
</SettingSubTitle>
Expand Down
Loading
Loading