Skip to content

Commit

Permalink
Merge pull request #1 from Courseplay/fs25
Browse files Browse the repository at this point in the history
Fs25
  • Loading branch information
Tensuko authored Dec 22, 2024
2 parents d15485c + 61e73e9 commit 2f93029
Show file tree
Hide file tree
Showing 189 changed files with 11,998 additions and 8,705 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/BUG_REPORT_DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ body:
attributes:
value: 'Danke, dass du dir Zeit nimmst, diesen Bugreport auszufüllen.
Lese dir bitte zuerst unsere [Wiki Seite](https://github.com/Courseplay/Courseplay_FS22/wiki)
Lies dir bitte zuerst unsere [Wiki Seite](https://github.com/Courseplay/Courseplay_FS25/wiki)
durch, bevor du ein neues Issue erstellst!
'
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/BUG_REPORT_EN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ body:
attributes:
value: 'Thanks for taking the time to fill out this bug report!
Please make sure to read our [Wiki Page](https://github.com/Courseplay/Courseplay_FS22/wiki)
Please make sure to read our [Wiki Page](https://github.com/Courseplay/Courseplay_FS25/wiki)
before creating a new issue!
'
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/QUESTION_DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ body:
attributes:
value: 'Bitte benutze diese Vorlage, um deine Frage zu stellen!
Lese dir bitte zuerst unsere [Wiki Seite](https://github.com/Courseplay/Courseplay_FS22/wiki)
Lese dir bitte zuerst unsere [Wiki Seite](https://github.com/Courseplay/Courseplay_FS25/wiki)
durch, bevor du ein neues Issue erstellst!
Unsere Hilfe aus dem Spiel, gibt es auch unter [Courseplay.dev]!(https://courseplay.github.io/Courseplay_FS22.github.io/),
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/QUESTION_EN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ body:
attributes:
value: 'Please use this template to ask your question!
Please make sure to read our [Wiki Page](https://github.com/Courseplay/Courseplay_FS22/wiki)
Please make sure to read our [Wiki Page](https://github.com/Courseplay/Courseplay_FS25/wiki)
before creating a new issue!
Our help pages from the game can also be found at [Courseplay.dev]!(https://courseplay.github.io/Courseplay_FS22.github.io/),
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/REQUEST_DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ body:
attributes:
value: 'Danke, dass du dir Zeit nimmst, diesen Report auszufüllen.
Lese dir bitte zuerst unsere [Wiki Seite](https://github.com/Courseplay/Courseplay_FS22/wiki)
Lese dir bitte zuerst unsere [Wiki Seite](https://github.com/Courseplay/Courseplay_FS25/wiki)
durch, bevor du ein neues Issue erstellst!
'
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/REQUEST_EN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ body:
attributes:
value: 'Thanks for taking the time to fill out this report!
Please make sure to read our [Wiki Page](https://github.com/Courseplay/Courseplay_FS22/wiki)
Please make sure to read our [Wiki Page](https://github.com/Courseplay/Courseplay_FS25/wiki)
before creating a new issue!
'
Expand Down
83 changes: 28 additions & 55 deletions Courseplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ Courseplay.baseXmlKey = "Courseplay"
Courseplay.xmlKey = Courseplay.baseXmlKey.."."

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

--- Base cp folder
self.baseDir = getUserProfileAppPath() .. "modSettings/" .. Courseplay.MOD_NAME .. "/"
createFolder(self.baseDir)
--- Base cp folder
self.cpFilePath = self.baseDir.."courseplay.xml"

g_overlayManager:addTextureConfigFile(Utils.getFilename("img/iconSprite.xml", self.BASE_DIRECTORY), "cpIconSprite")
g_overlayManager:addTextureConfigFile(Utils.getFilename("img/ui_courseplay.xml", self.BASE_DIRECTORY), "cpUi")
end

function Courseplay:registerXmlSchema()
Expand All @@ -24,6 +28,7 @@ function Courseplay:registerXmlSchema()
self.globalSettings:registerXmlSchema(self.xmlSchema, self.xmlKey)
CpBaseHud.registerXmlSchema(self.xmlSchema, self.xmlKey)
CpHudInfoTexts.registerXmlSchema(self.xmlSchema, self.xmlKey)
CpInGameMenu.registerXmlSchema(self.xmlSchema, self.xmlKey)
end

--- Loads data not tied to a savegame.
Expand All @@ -32,8 +37,9 @@ function Courseplay:loadUserSettings()
if xmlFile then
self:showUserInformation(xmlFile, self.baseXmlKey)
self.globalSettings:loadFromXMLFile(xmlFile, self.xmlKey)
g_cpInGameMenu:loadFromXMLFile(xmlFile, self.xmlKey)
CpBaseHud.loadFromXmlFile(xmlFile, self.xmlKey)
CpHudInfoTexts.loadFromXmlFile(xmlFile, self.xmlKey)
self.infoTextsHud:loadFromXmlFile(xmlFile, self.xmlKey)
xmlFile:save()
xmlFile:delete()
else
Expand All @@ -47,10 +53,11 @@ function Courseplay:saveUserSettings()
if xmlFile then
self.globalSettings:saveUserSettingsToXmlFile(xmlFile, self.xmlKey)
CpBaseHud.saveToXmlFile(xmlFile, self.xmlKey)
CpHudInfoTexts.saveToXmlFile(xmlFile, self.xmlKey)
self.infoTextsHud:saveToXmlFile(xmlFile, self.xmlKey)
if self.currentVersion then
xmlFile:setValue(self.baseXmlKey.."#lastVersion", self.currentVersion)
xmlFile:setValue(self.baseXmlKey .. "#lastVersion", self.currentVersion)
end
g_cpInGameMenu:saveToXMLFile(xmlFile, self.xmlKey)
xmlFile:save()
xmlFile:delete()
end
Expand All @@ -74,9 +81,7 @@ function Courseplay:showUserInformation(xmlFile, key)
self.MOD_NAME, self.currentVersion, lastLoadedVersion)

if showInfoDialog then
g_gui:showInfoDialog({
text = string.format(g_i18n:getText("CP_infoText"), self.currentVersion)
})
InfoDialog.show(string.format(g_i18n:getText("CP_infoText"), self.currentVersion))
if xmlFile then
xmlFile:setValue(key.."#lastVersion", self.currentVersion)
end
Expand All @@ -92,27 +97,25 @@ end
function Courseplay:loadMap(filename)
self.globalSettings = CpGlobalSettings()
self:registerXmlSchema()
self:loadUserSettings()
--- Savegame infos here
CpUtil.info("Map loaded: %s, Savegame name: %s(%d)",
g_currentMission.missionInfo.mapId,
g_currentMission.missionInfo.savegameName,
g_currentMission.missionInfo.savegameIndex)
self:load()
self:setupGui()
self:loadUserSettings()
if g_currentMission.missionInfo.savegameDirectory ~= nil then
local saveGamePath = g_currentMission.missionInfo.savegameDirectory .."/"
local filePath = saveGamePath .. "Courseplay.xml"
self.xmlFile = XMLFile.load("cpXml", filePath , self.xmlSchema)
if self.xmlFile == nil then return end
self.globalSettings:loadFromXMLFile(self.xmlFile, g_Courseplay.xmlKey)
self.xmlFile:delete()

g_assignedCoursesManager:loadAssignedCourses(saveGamePath)
end

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

g_courseEditor:load()
Expand All @@ -122,62 +125,32 @@ function Courseplay:deleteMap()
g_courseEditor:delete()
BufferedCourseDisplay.deleteBuffer()
g_signPrototypes:delete()
g_devHelper:delete()
g_consoleCommands:delete()
end

function Courseplay:setupGui()
local vehicleSettingsFrame = CpVehicleSettingsFrame.new()
local globalSettingsFrame = CpGlobalSettingsFrame.new()
local courseManagerFrame = CpCourseManagerFrame.new(self.courseStorage)
g_gui:loadGui(Utils.getFilename("config/gui/VehicleSettingsFrame.xml", Courseplay.BASE_DIRECTORY),
"CpVehicleSettingsFrame", vehicleSettingsFrame, true)
g_gui:loadGui(Utils.getFilename("config/gui/GlobalSettingsFrame.xml", Courseplay.BASE_DIRECTORY),
"CpGlobalSettingsFrame", globalSettingsFrame, true)
g_gui:loadGui(Utils.getFilename("config/gui/CourseManagerFrame.xml", Courseplay.BASE_DIRECTORY),
"CpCourseManagerFrame", courseManagerFrame, true)
local function predicateFunc()
-- Only allow the vehicle bound pages, when a vehicle with cp functionality is chosen/entered.
local vehicle = CpInGameMenuAIFrameExtended.getVehicle()
return vehicle ~= nil and vehicle.spec_cpAIWorker ~= nil
end

--- As precision farming decided to be moved in between the normal map and the ai map,
--- we move it down one position.
local pos = g_modIsLoaded["FS22_precisionFarming"] and 4 or 3

CpGuiUtil.fixInGameMenuPage(vehicleSettingsFrame, "pageCpVehicleSettings",
{896, 0, 128, 128}, pos + 1, predicateFunc)
CpGuiUtil.fixInGameMenuPage(globalSettingsFrame, "pageCpGlobalSettings",
{768, 0, 128, 128}, pos + 1, function () return true end)
CpGuiUtil.fixInGameMenuPage(courseManagerFrame, "pageCpCourseManager",
{256, 0, 128, 128}, pos + 1, predicateFunc)
CpInGameMenu.setupGui(self.courseStorage)
self.infoTextsHud = CpHudInfoTexts()

g_currentMission.hud.ingameMap.drawFields = Utils.appendedFunction(g_currentMission.hud.ingameMap.drawFields, Courseplay.drawHudMap)
-- TODO_25
-- g_currentMission.hud.ingameMap.drawFields = Utils.appendedFunction(g_currentMission.hud.ingameMap.drawFields, Courseplay.drawHudMap)

-- local page = g_gui.currentGui.target.pageSettings

-- local newPage = page.subCategoryPages[1].copy(page.subCategoryPages[1].parent)
-- self:fixGui()
end

--- Enables drawing onto the hud map.
function Courseplay.drawHudMap(map)
if g_Courseplay.globalSettings.drawOntoTheHudMap:getValue() then
local vehicle = g_currentMission.controlledVehicle
local vehicle = CpUtil.getCurrentVehicle()
if vehicle and vehicle:getIsEntered() and not g_gui:getIsGuiVisible() and vehicle.spec_cpAIWorker and not vehicle.spec_locomotive then
SpecializationUtil.raiseEvent(vehicle, "onCpDrawHudMap", map)
end
end
end

--- Adds cp help info to the in game help menu.
function Courseplay:loadMapDataHelpLineManager(superFunc, ...)
local ret = superFunc(self, ...)
if ret then
self:loadFromXML(Utils.getFilename("config/HelpMenu.xml", Courseplay.BASE_DIRECTORY))
return true
end
return false
end
HelpLineManager.loadMapData = Utils.overwrittenFunction( HelpLineManager.loadMapData, Courseplay.loadMapDataHelpLineManager)

--- Saves all global data, for example global settings.
function Courseplay.saveToXMLFile(missionInfo)
if missionInfo.isValid then
Expand Down Expand Up @@ -208,8 +181,9 @@ function Courseplay:update(dt)
local factor = 2*mapElement.terrainSize/2048
mapElement.zoomMax = mapElement.zoomMax * factor
end
setIngameMapFix(g_currentMission.inGameMenu.pageAI.ingameMap)
setIngameMapFix(g_currentMission.inGameMenu.pageMapOverview.ingameMap)
--- TODO_25
-- setIngameMapFix(g_currentMission.inGameMenu.pageAI.ingameMap)
-- setIngameMapFix(g_currentMission.inGameMenu.pageMapOverview.ingameMap)
end
end

Expand All @@ -234,7 +208,7 @@ end
---@param button number
function Courseplay:mouseEvent(posX, posY, isDown, isUp, button)
if not g_gui:getIsGuiVisible() then
local vehicle = g_currentMission.controlledVehicle
local vehicle = CpUtil.getCurrentVehicle()
local hud = vehicle and vehicle.getCpHud and vehicle:getCpHud()
if hud then
hud:mouseEvent(posX, posY, isDown, isUp, button)
Expand Down Expand Up @@ -276,7 +250,6 @@ function Courseplay:load()
CpAIMessages.register()
g_vineScanner:setup()
end

------------------------------------------------------------------------------------------------------------------------
-- Player action events
------------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -352,7 +325,7 @@ function Courseplay.register(typeManager)
CpAICombineUnloader.register(typeManager, typeName, typeEntry.specializations)
CpAISiloLoaderWorker.register(typeManager, typeName, typeEntry.specializations)
CpAIBunkerSiloWorker.register(typeManager, typeName, typeEntry.specializations)
CpGamePadHud.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)
CpShovelPositions.register(typeManager, typeName, typeEntry.specializations)
Expand Down
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
# Courseplay Beta for Farming Simulator 2025

We are working on migrating Courseplay to Farming Simulator 2025.
We don't yet know how long it'll take, it depends on how much the Giants API changed,
when they make documentation and tools available, and of course, how much time we can spend on it.
<!-- [![Modhub release](https://img.shields.io/badge/Modhub%20Release-Modification-blue.svg)](https://www.farming-simulator.com/mod.php?mod_id=248390title=fs2022)-->
[![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)
[![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)
[![GitHub issues](https://img.shields.io/github/issues/Courseplay/Courseplay_FS25?style=flat-square)](https://github.com/Courseplay/Courseplay_FS25/issues)

**[Download the latest developer version](https://github.com/Courseplay/Courseplay_FS25/releases/latest)** (the file FS25_Courseplay.zip).

<!-- **[Courseplay Website](https://courseplay.github.io/Courseplay_FS25.github.io/)** -->

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

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

## Developer version

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.

You have been warned.

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.
Be as specific as possible:

* tell us the version number
* only use the vehicles necessary, not 10 other ones at a time
* which vehicles are involved, what is the intended action?
* Post! The! Log! to [Gist](https://gist.github.com/) or [PasteBin](http://pastebin.com/)
* For more details on how to post a proper bug report, visit our [Wiki](https://github.com/Courseplay/Courseplay_FS25/wiki)


## Help Us Out

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

[![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)

<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>
<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>
4 changes: 2 additions & 2 deletions config/CourseGeneratorSettingsSetup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Settings prefixText="CP_vehicle_courseGeneratorSetting_">
<!--Basic settings-->
<SettingSubTitle title="basic">
<Setting classType="AIParameterSettingList" name="workWidth" min="0.5" max="50" incremental="0.1" unit="2" setDefault="setAutomaticWorkWidthAndOffset" onChangeCallback="cpShowWorkWidth" isVisible="isWorkWidthSettingVisible"/>
<Setting classType="AIParameterSettingList" name="workWidth" min="0.5" max="55" incremental="0.1" unit="2" setDefault="setAutomaticWorkWidthAndOffset" onChangeCallback="cpShowWorkWidth" isVisible="isWorkWidthSettingVisible"/>
<Setting classType="AIParameterSettingList" name="multiTools" min="1" max="5" default="1" isExpertModeOnly="true"/>
<Setting classType="AIParameterBooleanSetting" name="useSameTurnWidth" isVisible="hasMoreThenOneVehicle" isExpertModeOnly="true"/>
<Setting classType="AIParameterSettingList" name="numberOfHeadlands" min="0" max="40"/>
Expand All @@ -24,7 +24,7 @@
<!-- Only active with one or more headlands -->
<!--Headland settings-->
<SettingSubTitle title="headland" isVisible="hasHeadlandsSelected">
<Setting classType="AIParameterBooleanSetting" name="sharpenCorners" defaultBool="false"/>
<Setting classType="AIParameterBooleanSetting" name="sharpenCorners" defaultBool="true"/>
<Setting classType="AIParameterSettingList" name="headlandsWithRoundCorners" min="0" max="50" default="1"/>
<Setting classType="AIParameterSettingList" name="turningRadius" min="5" max="12" setDefault="setDefaultTurningRadius"/>
<Setting classType="AIParameterBooleanSetting" name="headlandClockwise" defaultBool="true">
Expand Down
2 changes: 1 addition & 1 deletion config/GlobalSettingsSetup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<SettingSubTitle prefix="true" title="userSettings">
<!-- When enabled, then a few settings are invisible and return their default values. -->
<Setting classType="AIParameterBooleanSetting" name="expertModeActive" isUserSetting="true" defaultBool="false"/>
<Setting classType="AIParameterBooleanSetting" name="controllerHudSelected" isUserSetting="true" defaultBool="false" onChangeCallback="onHudSelectionChanged"/>
<!-- <Setting classType="AIParameterBooleanSetting" name="controllerHudSelected" isUserSetting="true" defaultBool="false" onChangeCallback="onHudSelectionChanged"/> -->
<Setting classType="AIParameterBooleanSetting" name="showsAllActiveCourses" isUserSetting="true" defaultBool="false" isExpertModeOnly="true"/>
<Setting classType="AIParameterBooleanSetting" name="drawOntoTheHudMap" isUserSetting="true" defaultBool="true"/>
<Setting classType="AIParameterBooleanSetting" name="showActionEventHelp" isUserSetting="true" defaultBool="false" onChangeCallback="onActionEventTextVisibilityChanged"/>
Expand Down
7 changes: 3 additions & 4 deletions config/HelpMenu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
<page title="$l10n_CP_help_page_extendedJobMenu_title">
<paragraph>
<text text="$l10n_CP_help_page_startJobMenuBase_text"/>
<image filename="img/helpmenu/startjobmenuhelp.dds" size="1024 1024" uvs="0px 0px 1020px 895px"/>
<image filename="img/helpmenu/startjobmenuhelp.dds" size="1024 1024" uvs="0px 0px 1024px 895px" aspectRatio="0.87"/>
</paragraph>
<paragraph>
<text text="$l10n_CP_help_page_startJobMenuFunctions_text"/>
</paragraph>
<paragraph>
<text text="$l10n_CP_help_page_readyJobMenuBase_text"/>
<image filename="img/helpmenu/readyjobmenuhelp.dds" size="1024 1024" uvs="0px 0px 765px 510px"/>
<image filename="img/helpmenu/readyjobmenuhelp.dds" size="1024 1024" uvs="0px 0px 765px 510px" aspectRatio="0.66"/>
</paragraph>
<paragraph>
<text text="$l10n_CP_help_page_readyJobMenuFunctions_text"/>
Expand Down Expand Up @@ -251,8 +251,7 @@
<!--Courseplay Info Panel-->
<page title="$l10n_CP_help_page_infoPanel_title">
<paragraph>
<text text="$l10n_CP_help_page_blank"/>
<image filename="img/helpmenu/infopanel.dds" size="1024 1024" uvs="0px 0px 765px 510px" aspectRatio="0.66"/>
<image filename="img/helpmenu/infopanel.dds" size="1024 1024" uvs="0px 0px 480px 130px" aspectRatio="0.27"/>
</paragraph>
<paragraph>
<text text="$l10n_CP_help_page_infoPanelBasic_text"/>
Expand Down
Loading

0 comments on commit 2f93029

Please sign in to comment.