Skip to content

Commit 2f93029

Browse files
authored
Merge pull request #1 from Courseplay/fs25
Fs25
2 parents d15485c + 61e73e9 commit 2f93029

189 files changed

Lines changed: 11998 additions & 8705 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/BUG_REPORT_DE.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ body:
99
attributes:
1010
value: 'Danke, dass du dir Zeit nimmst, diesen Bugreport auszufüllen.
1111
12-
Lese dir bitte zuerst unsere [Wiki Seite](https://github.com/Courseplay/Courseplay_FS22/wiki)
12+
Lies dir bitte zuerst unsere [Wiki Seite](https://github.com/Courseplay/Courseplay_FS25/wiki)
1313
durch, bevor du ein neues Issue erstellst!
1414
1515
'

.github/ISSUE_TEMPLATE/BUG_REPORT_EN.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ body:
99
attributes:
1010
value: 'Thanks for taking the time to fill out this bug report!
1111
12-
Please make sure to read our [Wiki Page](https://github.com/Courseplay/Courseplay_FS22/wiki)
12+
Please make sure to read our [Wiki Page](https://github.com/Courseplay/Courseplay_FS25/wiki)
1313
before creating a new issue!
1414
1515
'

.github/ISSUE_TEMPLATE/QUESTION_DE.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ body:
99
attributes:
1010
value: 'Bitte benutze diese Vorlage, um deine Frage zu stellen!
1111
12-
Lese dir bitte zuerst unsere [Wiki Seite](https://github.com/Courseplay/Courseplay_FS22/wiki)
12+
Lese dir bitte zuerst unsere [Wiki Seite](https://github.com/Courseplay/Courseplay_FS25/wiki)
1313
durch, bevor du ein neues Issue erstellst!
1414
1515
Unsere Hilfe aus dem Spiel, gibt es auch unter [Courseplay.dev]!(https://courseplay.github.io/Courseplay_FS22.github.io/),

.github/ISSUE_TEMPLATE/QUESTION_EN.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ body:
99
attributes:
1010
value: 'Please use this template to ask your question!
1111
12-
Please make sure to read our [Wiki Page](https://github.com/Courseplay/Courseplay_FS22/wiki)
12+
Please make sure to read our [Wiki Page](https://github.com/Courseplay/Courseplay_FS25/wiki)
1313
before creating a new issue!
1414
1515
Our help pages from the game can also be found at [Courseplay.dev]!(https://courseplay.github.io/Courseplay_FS22.github.io/),

.github/ISSUE_TEMPLATE/REQUEST_DE.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ body:
99
attributes:
1010
value: 'Danke, dass du dir Zeit nimmst, diesen Report auszufüllen.
1111
12-
Lese dir bitte zuerst unsere [Wiki Seite](https://github.com/Courseplay/Courseplay_FS22/wiki)
12+
Lese dir bitte zuerst unsere [Wiki Seite](https://github.com/Courseplay/Courseplay_FS25/wiki)
1313
durch, bevor du ein neues Issue erstellst!
1414
1515
'

.github/ISSUE_TEMPLATE/REQUEST_EN.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ body:
99
attributes:
1010
value: 'Thanks for taking the time to fill out this report!
1111
12-
Please make sure to read our [Wiki Page](https://github.com/Courseplay/Courseplay_FS22/wiki)
12+
Please make sure to read our [Wiki Page](https://github.com/Courseplay/Courseplay_FS25/wiki)
1313
before creating a new issue!
1414
1515
'

Courseplay.lua

Lines changed: 28 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ Courseplay.baseXmlKey = "Courseplay"
99
Courseplay.xmlKey = Courseplay.baseXmlKey.."."
1010

1111
function Courseplay:init()
12-
g_gui:loadProfiles( Utils.getFilename("config/gui/GUIProfiles.xml", Courseplay.BASE_DIRECTORY) )
12+
---TODO_25
13+
-- g_gui:loadProfiles( Utils.getFilename("config/gui/GUIProfiles.xml", Courseplay.BASE_DIRECTORY) )
1314

1415
--- Base cp folder
1516
self.baseDir = getUserProfileAppPath() .. "modSettings/" .. Courseplay.MOD_NAME .. "/"
1617
createFolder(self.baseDir)
1718
--- Base cp folder
1819
self.cpFilePath = self.baseDir.."courseplay.xml"
20+
21+
g_overlayManager:addTextureConfigFile(Utils.getFilename("img/iconSprite.xml", self.BASE_DIRECTORY), "cpIconSprite")
22+
g_overlayManager:addTextureConfigFile(Utils.getFilename("img/ui_courseplay.xml", self.BASE_DIRECTORY), "cpUi")
1923
end
2024

2125
function Courseplay:registerXmlSchema()
@@ -24,6 +28,7 @@ function Courseplay:registerXmlSchema()
2428
self.globalSettings:registerXmlSchema(self.xmlSchema, self.xmlKey)
2529
CpBaseHud.registerXmlSchema(self.xmlSchema, self.xmlKey)
2630
CpHudInfoTexts.registerXmlSchema(self.xmlSchema, self.xmlKey)
31+
CpInGameMenu.registerXmlSchema(self.xmlSchema, self.xmlKey)
2732
end
2833

2934
--- Loads data not tied to a savegame.
@@ -32,8 +37,9 @@ function Courseplay:loadUserSettings()
3237
if xmlFile then
3338
self:showUserInformation(xmlFile, self.baseXmlKey)
3439
self.globalSettings:loadFromXMLFile(xmlFile, self.xmlKey)
40+
g_cpInGameMenu:loadFromXMLFile(xmlFile, self.xmlKey)
3541
CpBaseHud.loadFromXmlFile(xmlFile, self.xmlKey)
36-
CpHudInfoTexts.loadFromXmlFile(xmlFile, self.xmlKey)
42+
self.infoTextsHud:loadFromXmlFile(xmlFile, self.xmlKey)
3743
xmlFile:save()
3844
xmlFile:delete()
3945
else
@@ -47,10 +53,11 @@ function Courseplay:saveUserSettings()
4753
if xmlFile then
4854
self.globalSettings:saveUserSettingsToXmlFile(xmlFile, self.xmlKey)
4955
CpBaseHud.saveToXmlFile(xmlFile, self.xmlKey)
50-
CpHudInfoTexts.saveToXmlFile(xmlFile, self.xmlKey)
56+
self.infoTextsHud:saveToXmlFile(xmlFile, self.xmlKey)
5157
if self.currentVersion then
52-
xmlFile:setValue(self.baseXmlKey.."#lastVersion", self.currentVersion)
58+
xmlFile:setValue(self.baseXmlKey .. "#lastVersion", self.currentVersion)
5359
end
60+
g_cpInGameMenu:saveToXMLFile(xmlFile, self.xmlKey)
5461
xmlFile:save()
5562
xmlFile:delete()
5663
end
@@ -74,9 +81,7 @@ function Courseplay:showUserInformation(xmlFile, key)
7481
self.MOD_NAME, self.currentVersion, lastLoadedVersion)
7582

7683
if showInfoDialog then
77-
g_gui:showInfoDialog({
78-
text = string.format(g_i18n:getText("CP_infoText"), self.currentVersion)
79-
})
84+
InfoDialog.show(string.format(g_i18n:getText("CP_infoText"), self.currentVersion))
8085
if xmlFile then
8186
xmlFile:setValue(key.."#lastVersion", self.currentVersion)
8287
end
@@ -92,27 +97,25 @@ end
9297
function Courseplay:loadMap(filename)
9398
self.globalSettings = CpGlobalSettings()
9499
self:registerXmlSchema()
95-
self:loadUserSettings()
96100
--- Savegame infos here
97101
CpUtil.info("Map loaded: %s, Savegame name: %s(%d)",
98102
g_currentMission.missionInfo.mapId,
99103
g_currentMission.missionInfo.savegameName,
100104
g_currentMission.missionInfo.savegameIndex)
101105
self:load()
102106
self:setupGui()
107+
self:loadUserSettings()
103108
if g_currentMission.missionInfo.savegameDirectory ~= nil then
104109
local saveGamePath = g_currentMission.missionInfo.savegameDirectory .."/"
105110
local filePath = saveGamePath .. "Courseplay.xml"
106111
self.xmlFile = XMLFile.load("cpXml", filePath , self.xmlSchema)
107112
if self.xmlFile == nil then return end
108113
self.globalSettings:loadFromXMLFile(self.xmlFile, g_Courseplay.xmlKey)
109114
self.xmlFile:delete()
110-
111-
g_assignedCoursesManager:loadAssignedCourses(saveGamePath)
112115
end
113116

114117
--- Ugly hack to get access to the global AutoDrive table, as this global is dependent on the auto drive folder name.
115-
self.autoDrive = FS22_AutoDrive and FS22_AutoDrive.AutoDrive
118+
self.autoDrive = FS25_AutoDrive and FS25_AutoDrive.AutoDrive
116119
CpUtil.info("Auto drive found: %s", tostring(self.autoDrive~=nil))
117120

118121
g_courseEditor:load()
@@ -122,62 +125,32 @@ function Courseplay:deleteMap()
122125
g_courseEditor:delete()
123126
BufferedCourseDisplay.deleteBuffer()
124127
g_signPrototypes:delete()
125-
g_devHelper:delete()
128+
g_consoleCommands:delete()
126129
end
127130

128131
function Courseplay:setupGui()
129-
local vehicleSettingsFrame = CpVehicleSettingsFrame.new()
130-
local globalSettingsFrame = CpGlobalSettingsFrame.new()
131-
local courseManagerFrame = CpCourseManagerFrame.new(self.courseStorage)
132-
g_gui:loadGui(Utils.getFilename("config/gui/VehicleSettingsFrame.xml", Courseplay.BASE_DIRECTORY),
133-
"CpVehicleSettingsFrame", vehicleSettingsFrame, true)
134-
g_gui:loadGui(Utils.getFilename("config/gui/GlobalSettingsFrame.xml", Courseplay.BASE_DIRECTORY),
135-
"CpGlobalSettingsFrame", globalSettingsFrame, true)
136-
g_gui:loadGui(Utils.getFilename("config/gui/CourseManagerFrame.xml", Courseplay.BASE_DIRECTORY),
137-
"CpCourseManagerFrame", courseManagerFrame, true)
138-
local function predicateFunc()
139-
-- Only allow the vehicle bound pages, when a vehicle with cp functionality is chosen/entered.
140-
local vehicle = CpInGameMenuAIFrameExtended.getVehicle()
141-
return vehicle ~= nil and vehicle.spec_cpAIWorker ~= nil
142-
end
143-
144-
--- As precision farming decided to be moved in between the normal map and the ai map,
145-
--- we move it down one position.
146-
local pos = g_modIsLoaded["FS22_precisionFarming"] and 4 or 3
147-
148-
CpGuiUtil.fixInGameMenuPage(vehicleSettingsFrame, "pageCpVehicleSettings",
149-
{896, 0, 128, 128}, pos + 1, predicateFunc)
150-
CpGuiUtil.fixInGameMenuPage(globalSettingsFrame, "pageCpGlobalSettings",
151-
{768, 0, 128, 128}, pos + 1, function () return true end)
152-
CpGuiUtil.fixInGameMenuPage(courseManagerFrame, "pageCpCourseManager",
153-
{256, 0, 128, 128}, pos + 1, predicateFunc)
132+
CpInGameMenu.setupGui(self.courseStorage)
154133
self.infoTextsHud = CpHudInfoTexts()
155134

156-
g_currentMission.hud.ingameMap.drawFields = Utils.appendedFunction(g_currentMission.hud.ingameMap.drawFields, Courseplay.drawHudMap)
135+
-- TODO_25
136+
-- g_currentMission.hud.ingameMap.drawFields = Utils.appendedFunction(g_currentMission.hud.ingameMap.drawFields, Courseplay.drawHudMap)
157137

138+
-- local page = g_gui.currentGui.target.pageSettings
139+
140+
-- local newPage = page.subCategoryPages[1].copy(page.subCategoryPages[1].parent)
141+
-- self:fixGui()
158142
end
159143

160144
--- Enables drawing onto the hud map.
161145
function Courseplay.drawHudMap(map)
162146
if g_Courseplay.globalSettings.drawOntoTheHudMap:getValue() then
163-
local vehicle = g_currentMission.controlledVehicle
147+
local vehicle = CpUtil.getCurrentVehicle()
164148
if vehicle and vehicle:getIsEntered() and not g_gui:getIsGuiVisible() and vehicle.spec_cpAIWorker and not vehicle.spec_locomotive then
165149
SpecializationUtil.raiseEvent(vehicle, "onCpDrawHudMap", map)
166150
end
167151
end
168152
end
169153

170-
--- Adds cp help info to the in game help menu.
171-
function Courseplay:loadMapDataHelpLineManager(superFunc, ...)
172-
local ret = superFunc(self, ...)
173-
if ret then
174-
self:loadFromXML(Utils.getFilename("config/HelpMenu.xml", Courseplay.BASE_DIRECTORY))
175-
return true
176-
end
177-
return false
178-
end
179-
HelpLineManager.loadMapData = Utils.overwrittenFunction( HelpLineManager.loadMapData, Courseplay.loadMapDataHelpLineManager)
180-
181154
--- Saves all global data, for example global settings.
182155
function Courseplay.saveToXMLFile(missionInfo)
183156
if missionInfo.isValid then
@@ -208,8 +181,9 @@ function Courseplay:update(dt)
208181
local factor = 2*mapElement.terrainSize/2048
209182
mapElement.zoomMax = mapElement.zoomMax * factor
210183
end
211-
setIngameMapFix(g_currentMission.inGameMenu.pageAI.ingameMap)
212-
setIngameMapFix(g_currentMission.inGameMenu.pageMapOverview.ingameMap)
184+
--- TODO_25
185+
-- setIngameMapFix(g_currentMission.inGameMenu.pageAI.ingameMap)
186+
-- setIngameMapFix(g_currentMission.inGameMenu.pageMapOverview.ingameMap)
213187
end
214188
end
215189

@@ -234,7 +208,7 @@ end
234208
---@param button number
235209
function Courseplay:mouseEvent(posX, posY, isDown, isUp, button)
236210
if not g_gui:getIsGuiVisible() then
237-
local vehicle = g_currentMission.controlledVehicle
211+
local vehicle = CpUtil.getCurrentVehicle()
238212
local hud = vehicle and vehicle.getCpHud and vehicle:getCpHud()
239213
if hud then
240214
hud:mouseEvent(posX, posY, isDown, isUp, button)
@@ -276,7 +250,6 @@ function Courseplay:load()
276250
CpAIMessages.register()
277251
g_vineScanner:setup()
278252
end
279-
280253
------------------------------------------------------------------------------------------------------------------------
281254
-- Player action events
282255
------------------------------------------------------------------------------------------------------------------------
@@ -352,7 +325,7 @@ function Courseplay.register(typeManager)
352325
CpAICombineUnloader.register(typeManager, typeName, typeEntry.specializations)
353326
CpAISiloLoaderWorker.register(typeManager, typeName, typeEntry.specializations)
354327
CpAIBunkerSiloWorker.register(typeManager, typeName, typeEntry.specializations)
355-
CpGamePadHud.register(typeManager, typeName,typeEntry.specializations)
328+
-- TODO 25 CpGamePadHud.register(typeManager, typeName,typeEntry.specializations)
356329
CpHud.register(typeManager, typeName, typeEntry.specializations)
357330
CpInfoTexts.register(typeManager, typeName, typeEntry.specializations)
358331
CpShovelPositions.register(typeManager, typeName, typeEntry.specializations)

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
# Courseplay Beta for Farming Simulator 2025
22

3-
We are working on migrating Courseplay to Farming Simulator 2025.
4-
We don't yet know how long it'll take, it depends on how much the Giants API changed,
5-
when they make documentation and tools available, and of course, how much time we can spend on it.
3+
<!-- [![Modhub release](https://img.shields.io/badge/Modhub%20Release-Modification-blue.svg)](https://www.farming-simulator.com/mod.php?mod_id=248390title=fs2022)-->
4+
[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/Courseplay/Courseplay_FS25?include_prereleases&style=flat-square&label=Github+Release)](https://github.com/Courseplay/Courseplay_FS25/releases/latest)
5+
[![GitHub Pre-Releases (by Asset)](https://img.shields.io/github/downloads-pre/Courseplay/Courseplay_FS25/latest/FS25_Courseplay.zip?style=flat-square)](https://github.com/Courseplay/Courseplay_FS25/releases/latest/download/FS25_Courseplay.zip)
6+
[![GitHub issues](https://img.shields.io/github/issues/Courseplay/Courseplay_FS25?style=flat-square)](https://github.com/Courseplay/Courseplay_FS25/issues)
7+
8+
**[Download the latest developer version](https://github.com/Courseplay/Courseplay_FS25/releases/latest)** (the file FS25_Courseplay.zip).
9+
10+
<!-- **[Courseplay Website](https://courseplay.github.io/Courseplay_FS25.github.io/)** -->
611

7-
We'll keep you updated on our progress here, please be patient.
812

913
This (and later, the Giants modhub) is the **only official source for Courseplay**,
1014
if you see it anywhere else, it's a scam.
1115

16+
## Developer version
17+
18+
Please be aware you're using a developer version, which may and will contain errors, bugs, mistakes and unfinished code. Chances are you computer will explode when using it. Twice. If you have no idea what "beta", "alpha", or "developer" means and entails, steer clear. The Courseplay team will not take any responsibility for crop destroyed, savegames deleted or baby pandas killed.
19+
20+
You have been warned.
21+
22+
If you're still ok with this, please remember to post possible issues that you find in the developer version. That's the only way we can find sources of error and fix them.
23+
Be as specific as possible:
24+
25+
* tell us the version number
26+
* only use the vehicles necessary, not 10 other ones at a time
27+
* which vehicles are involved, what is the intended action?
28+
* Post! The! Log! to [Gist](https://gist.github.com/) or [PasteBin](http://pastebin.com/)
29+
* For more details on how to post a proper bug report, visit our [Wiki](https://github.com/Courseplay/Courseplay_FS25/wiki)
30+
31+
1232
## Help Us Out
1333

1434
We work long, hard, in our own free time at developing and improving Courseplay. If you like the project, show us your undying love:
1535

1636
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=7PDM2P6HQ5D56&item_name=Promote+the+development+of+Courseplay&currency_code=EUR&source=url)
1737

18-
<a href="https://www.buymeacoffee.com/courseplay" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
38+
<a href="https://www.buymeacoffee.com/courseplay" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>

config/CourseGeneratorSettingsSetup.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<Settings prefixText="CP_vehicle_courseGeneratorSetting_">
1010
<!--Basic settings-->
1111
<SettingSubTitle title="basic">
12-
<Setting classType="AIParameterSettingList" name="workWidth" min="0.5" max="50" incremental="0.1" unit="2" setDefault="setAutomaticWorkWidthAndOffset" onChangeCallback="cpShowWorkWidth" isVisible="isWorkWidthSettingVisible"/>
12+
<Setting classType="AIParameterSettingList" name="workWidth" min="0.5" max="55" incremental="0.1" unit="2" setDefault="setAutomaticWorkWidthAndOffset" onChangeCallback="cpShowWorkWidth" isVisible="isWorkWidthSettingVisible"/>
1313
<Setting classType="AIParameterSettingList" name="multiTools" min="1" max="5" default="1" isExpertModeOnly="true"/>
1414
<Setting classType="AIParameterBooleanSetting" name="useSameTurnWidth" isVisible="hasMoreThenOneVehicle" isExpertModeOnly="true"/>
1515
<Setting classType="AIParameterSettingList" name="numberOfHeadlands" min="0" max="40"/>
@@ -24,7 +24,7 @@
2424
<!-- Only active with one or more headlands -->
2525
<!--Headland settings-->
2626
<SettingSubTitle title="headland" isVisible="hasHeadlandsSelected">
27-
<Setting classType="AIParameterBooleanSetting" name="sharpenCorners" defaultBool="false"/>
27+
<Setting classType="AIParameterBooleanSetting" name="sharpenCorners" defaultBool="true"/>
2828
<Setting classType="AIParameterSettingList" name="headlandsWithRoundCorners" min="0" max="50" default="1"/>
2929
<Setting classType="AIParameterSettingList" name="turningRadius" min="5" max="12" setDefault="setDefaultTurningRadius"/>
3030
<Setting classType="AIParameterBooleanSetting" name="headlandClockwise" defaultBool="true">

config/GlobalSettingsSetup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<SettingSubTitle prefix="true" title="userSettings">
5151
<!-- When enabled, then a few settings are invisible and return their default values. -->
5252
<Setting classType="AIParameterBooleanSetting" name="expertModeActive" isUserSetting="true" defaultBool="false"/>
53-
<Setting classType="AIParameterBooleanSetting" name="controllerHudSelected" isUserSetting="true" defaultBool="false" onChangeCallback="onHudSelectionChanged"/>
53+
<!-- <Setting classType="AIParameterBooleanSetting" name="controllerHudSelected" isUserSetting="true" defaultBool="false" onChangeCallback="onHudSelectionChanged"/> -->
5454
<Setting classType="AIParameterBooleanSetting" name="showsAllActiveCourses" isUserSetting="true" defaultBool="false" isExpertModeOnly="true"/>
5555
<Setting classType="AIParameterBooleanSetting" name="drawOntoTheHudMap" isUserSetting="true" defaultBool="true"/>
5656
<Setting classType="AIParameterBooleanSetting" name="showActionEventHelp" isUserSetting="true" defaultBool="false" onChangeCallback="onActionEventTextVisibilityChanged"/>

0 commit comments

Comments
 (0)