From 44e68025c76658bc0a8cec8ba72d4dad67720467 Mon Sep 17 00:00:00 2001 From: David Schwietering Date: Sat, 6 Apr 2024 11:42:42 +0200 Subject: [PATCH] Some more adjustments --- config/HudSettingsSetup.xml | 37 ++---- config/MasterTranslations.xml | 50 +------- scripts/gui/hud/CpBaseHud.lua | 120 +++++++++--------- scripts/gui/hud/CpCombineUnloaderHudPage.lua | 45 ++----- scripts/gui/hud/CpFieldworkHudPage.lua | 45 +++---- .../specializations/CpAICombineUnloader.lua | 5 - scripts/specializations/CpAIFieldWorker.lua | 7 - scripts/specializations/CpAIWorker.lua | 4 +- .../CpCourseGeneratorSettings.lua | 2 +- scripts/specializations/CpHud.lua | 44 +++---- 10 files changed, 130 insertions(+), 229 deletions(-) diff --git a/config/HudSettingsSetup.xml b/config/HudSettingsSetup.xml index f0dcf2a20..d3678b831 100644 --- a/config/HudSettingsSetup.xml +++ b/config/HudSettingsSetup.xml @@ -7,39 +7,28 @@ - + - 1 - 2 - 3 + 1 - 4 + 2 - 5 + 3 - 6 + 4 - 7 - 8 + 5 - 9 - 10 - 11 - + 6 - fieldWork_nearest - fieldWork_first - fieldWork_last - baleFinder - bunkerSilo - siloLoader - unloader_harvester - unloader_loader - street_driveTo - street_unloadOrRefill - street_loadAndUnload + CP_job_fieldWork + CP_job_baleCollect + CP_job_bunkerSilo + CP_job_siloLoader + CP_job_combineUnload + CP_job_street diff --git a/config/MasterTranslations.xml b/config/MasterTranslations.xml index 486d62a15..85360754f 100644 --- a/config/MasterTranslations.xml +++ b/config/MasterTranslations.xml @@ -453,53 +453,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + diff --git a/scripts/gui/hud/CpBaseHud.lua b/scripts/gui/hud/CpBaseHud.lua index 62b81a9c8..64447cc06 100644 --- a/scripts/gui/hud/CpBaseHud.lua +++ b/scripts/gui/hud/CpBaseHud.lua @@ -33,7 +33,7 @@ CpBaseHud.headerFontSize = 14 CpBaseHud.titleFontSize = 20 CpBaseHud.defaultFontSize = 16 -CpBaseHud.numLines = 7 +CpBaseHud.numLines = 8 CpBaseHud.uvs = { plusSymbol = { @@ -168,7 +168,9 @@ function CpBaseHud:init(vehicle) } self.lines[i] = line end - + self.lines[self.numLines-1].left[2] = self.lines[self.numLines-1].left[2] - self.hMargin/2 + self.lines[self.numLines-1].right[2] = self.lines[self.numLines-1].right[2] - self.hMargin/2 + self.lines[self.numLines].right[2] = self.lines[self.numLines].right[2] - self.hMargin/4 local background = CpGuiUtil.createOverlay({self.width, self.height}, {g_baseUIFilename, g_colorBgUVs}, @@ -222,7 +224,7 @@ function CpBaseHud:init(vehicle) self.BASE_COLOR, self.alignments.bottomLeft) self.cpIcon = CpHudButtonElement.new(cpIconOverlay, self.baseHud) - local x, y = unpack(self.lines[7].left) + local x, y = unpack(self.lines[8].left) y = y - self.hMargin/4 self.cpIcon:setPosition(x, y) self.cpIcon:setCallback("onClickPrimary", self.vehicle, function (vehicle) @@ -230,20 +232,26 @@ function CpBaseHud:init(vehicle) end) --- Title - local x, y = unpack(self.lines[7].left) + local x, y = unpack(self.lines[8].left) x = x + cpIconWidth + self.wMargin/2 self.vehicleNameBtn = CpTextHudElement.new(self.baseHud , x , y, self.defaultFontSize) self.vehicleNameBtn:setCallback("onClickPrimary", self.vehicle, function() self:openVehicleSettingsGui(self.vehicle) end) - - --- Starting point - self.startingPointBtn = self:addLeftLineTextButtonWithIcon(self.baseHud, 5, self.defaultFontSize, + + self.selectedJobBtn = self:addLeftLineTextButton(self.baseHud, 7, self.defaultFontSize, function (vehicle) - self:executeStartingPointBtnCallback(vehicle) - end, self.vehicle, 24, 24, "img/ui_courseplay.dds") - + vehicle:cpGetHudSelectedJobSetting():setNextItem() + end, self.vehicle) + + local x, y = unpack(self.lines[6].left) + local spacerLineOverlay = Overlay.new("dataS/scripts/shared/graph_pixel.png", + x, y, self.width - 2 * self.wMargin, self.hMargin/8) + spacerLineOverlay:setColor(unpack(self.OFF_COLOR)) + spacerLineOverlay:setAlignment(Overlay.ALIGN_VERTICAL_MIDDLE) + local spacerLine = CpHudElement.new(spacerLineOverlay, self.baseHud) + -------------------------------------- --- Right side -------------------------------------- @@ -257,7 +265,7 @@ function CpBaseHud:init(vehicle) self.alignments.bottomRight) self.exitBtn = CpHudButtonElement.new(exitBtnOverlay, self.baseHud) - local x, y = CpBaseHud.x + self.width -width/3 , CpBaseHud.y + self.height - headerHeight + self.hMargin/8 + local x, y = CpBaseHud.x + self.width -width/3 , CpBaseHud.y + self.height - headerHeight + self.hMargin/12 self.exitBtn:setPosition(x, y) self.exitBtn:setCallback("onClickPrimary", self.vehicle, function (vehicle) vehicle:closeCpHud() @@ -271,7 +279,7 @@ function CpBaseHud:init(vehicle) self.OFF_COLOR, self.alignments.bottomRight) self.onOffButton = CpHudButtonElement.new(onOffIndicatorOverlay, self.baseHud) - local x, y = unpack(self.lines[6].right) + local x, y = unpack(self.lines[8].right) self.onOffButton:setPosition(x, y) self.onOffButton:setCallback("onClickPrimary", self.vehicle, function(vehicle) vehicle:cpStartStopDriver(true) @@ -285,7 +293,7 @@ function CpBaseHud:init(vehicle) self.OFF_COLOR, self.alignments.bottomRight) self.startStopRecordingBtn = CpHudButtonElement.new(circleOverlay, self.baseHud) - local x, y = unpack(self.lines[6].right) + local x, y = unpack(self.lines[8].right) x = x - onOffBtnWidth - self.wMargin/2 self.startStopRecordingBtn:setPosition(x, y) self.startStopRecordingBtn:setCallback("onClickPrimary", self.vehicle, function (vehicle) @@ -302,7 +310,7 @@ function CpBaseHud:init(vehicle) self.OFF_COLOR, self.alignments.bottomRight) self.pauseRecordingBtn = CpHudButtonElement.new(circleOverlay, self.baseHud) - local x, y = unpack(self.lines[6].right) + local x, y = unpack(self.lines[8].right) self.pauseRecordingBtn:setPosition(x, y) self.pauseRecordingBtn:setCallback("onClickPrimary", self.vehicle, function (vehicle) if vehicle:getIsCpCourseRecorderActive() then @@ -310,6 +318,20 @@ function CpBaseHud:init(vehicle) end end) + --- Goal button. + local width, height = getNormalizedScreenValues(34, 34) + local goalOverlay = CpGuiUtil.createOverlay({width, height}, + {AITargetHotspot.FILENAME, self.uvs.goalSymbol}, + self.OFF_COLOR, + self.alignments.bottomRight) + + self.goalBtn = CpHudButtonElement.new(goalOverlay, self.baseHud) + local x, y = unpack(self.lines[7].right) + self.goalBtn:setPosition(x, y - self.hMargin/4) + self.goalBtn:setCallback("onClickPrimary", vehicle, function (vehicle) + self:openCourseGeneratorGui(vehicle) + end) + ---- Disables zoom, while mouse is over the cp hud. local function disableCameraZoomOverHud(vehicle, superFunc, ...) @@ -469,7 +491,6 @@ function CpBaseHud:isMouseOverArea(posX, posY) end function CpBaseHud:getActiveHudPage(vehicle) - if vehicle:cpIsHudFieldWorkJobSelected() then return self.fieldworkLayout elseif vehicle:cpIsHudBaleFinderJobSelected() then @@ -480,10 +501,8 @@ function CpBaseHud:getActiveHudPage(vehicle) return self.siloLoaderWorkerLayout elseif vehicle:cpIsHudUnloaderJobSelected() then return self.combineUnloaderLayout - elseif vehicle:cpIsHudDriveToJobSelected() then - return self.fieldworkLayout - else - return self.fieldworkLayout + elseif vehicle:cpIsHudStreetJobSelected() then + -- return self.fieldworkLayout end end @@ -543,38 +562,33 @@ function CpBaseHud:updateContent(vehicle, status) self.siloLoaderWorkerLayout:setDisabled(true) local activeLayout = self:getActiveHudPage(vehicle) - activeLayout:setVisible(true) - activeLayout:setDisabled(false) - activeLayout:updateContent(vehicle, status) - - local text, uvs = self:getStartingPointBtnTextAndIconUvs(vehicle) - if text ~= self.startingPointBtn:getText() then - self.startingPointBtn:setTextDetails(text) - self.startingPointBtn.icon:setUVs(uvs) + if activeLayout then + activeLayout:setVisible(true) + activeLayout:setDisabled(false) + activeLayout:updateContent(vehicle, status) end + self.selectedJobBtn:setTextDetails(vehicle:cpGetHudSelectedJobSetting():getString()) end -function CpBaseHud:getStartingPointBtnTextAndIconUvs(vehicle) - local setting = vehicle:cpGetHudStartingPointSetting() - local uvs = self.uvs.fieldWorkSymbol - if vehicle:cpIsHudFieldWorkJobSelected() then - uvs = self.uvs.fieldWorkSymbol - elseif vehicle:cpIsHudBaleFinderJobSelected() then - uvs = self.uvs.baleFinderSymbol - elseif vehicle:cpIsHudBunkerSiloJobSelected() then - uvs = self.uvs.bunkerSymbol - elseif vehicle:cpIsHudSiloLoaderJobSelected() then - uvs = self.uvs.shovelSymbol - elseif vehicle:cpIsHudUnloaderJobSelected() then - uvs = self.uvs.unloaderSymbol - elseif vehicle:cpIsHudDriveToJobSelected() then - uvs = self.uvs.streetDriveToSymbol - else - uvs = self.uvs.streetLoadAndUnloadSymbol - end - return setting:getString(), GuiUtils.getUVs(unpack(uvs)) -end +-- function CpBaseHud:getStartingPointBtnTextAndIconUvs(vehicle) +-- local setting = vehicle:cpGetHudSelectedJobSetting() +-- local uvs = self.uvs.fieldWorkSymbol +-- if vehicle:cpIsHudFieldWorkJobSelected() then +-- uvs = self.uvs.fieldWorkSymbol +-- elseif vehicle:cpIsHudBaleFinderJobSelected() then +-- uvs = self.uvs.baleFinderSymbol +-- elseif vehicle:cpIsHudBunkerSiloJobSelected() then +-- uvs = self.uvs.bunkerSymbol +-- elseif vehicle:cpIsHudSiloLoaderJobSelected() then +-- uvs = self.uvs.shovelSymbol +-- elseif vehicle:cpIsHudUnloaderJobSelected() then +-- uvs = self.uvs.unloaderSymbol +-- elseif vehicle:cpIsHudStreetJobSelected() then +-- uvs = self.uvs.streetDriveToSymbol +-- end +-- return setting:getString(), GuiUtils.getUVs(unpack(uvs)) +-- end function CpBaseHud:delete() self.baseHud:delete() @@ -604,18 +618,6 @@ function CpBaseHud:openGlobalSettingsGui(vehicle) CpGuiUtil.openGlobalSettingsGui(vehicle) end -function CpBaseHud:executeStartingPointBtnCallback(vehicle) - local setting = vehicle:cpGetHudStartingPointSetting() - setting:setNextItem() - - -- local activeLayout = self:getActiveHudPage(vehicle) - -- if activeLayout and activeLayout.executeStartingPointBtnCallback then - -- activeLayout:executeStartingPointBtnCallback(vehicle) - -- else - -- vehicle:getCpStartingPointSetting():setNextItem() - -- end -end - --- Saves hud position. function CpBaseHud.saveToXmlFile(xmlFile, baseKey) if CpBaseHud.x ~= nil and CpBaseHud.y ~= nil then diff --git a/scripts/gui/hud/CpCombineUnloaderHudPage.lua b/scripts/gui/hud/CpCombineUnloaderHudPage.lua index 526536b1c..249106774 100644 --- a/scripts/gui/hud/CpCombineUnloaderHudPage.lua +++ b/scripts/gui/hud/CpCombineUnloaderHudPage.lua @@ -29,14 +29,11 @@ function CpCombineUnloaderHudPageElement:setupElements(baseHud, vehicle, lines, self.fullThresholdBtn = baseHud:addLineTextButton(self, 4, CpBaseHud.defaultFontSize, vehicle:getCpSettings().fullThreshold) - - -- --- Giants unloading station - -- local x, y = unpack(lines[5].left) - -- self.giantsUnloadStationText = CpTextHudElement.new(self , x , y, CpBaseHud.defaultFontSize) - -- self.giantsUnloadStationText:setCallback("onClickPrimary", vehicle, - -- function(vehicle) - -- vehicle:getCpCombineUnloaderJobParameters().unloadingStation:setNextItem() - -- end) + --- Unloading combine or silo loader ? + self.unloadModeBtn = baseHud:addLeftLineTextButton(self, 5, CpBaseHud.defaultFontSize, + function (vehicle) + vehicle:getCpCombineUnloaderJobParameters().unloadTarget:setNextItem() + end, vehicle) --- Drive now button local width, height = getNormalizedScreenValues(22, 22) @@ -47,7 +44,7 @@ function CpCombineUnloaderHudPageElement:setupElements(baseHud, vehicle, lines, CpBaseHud.OFF_COLOR, CpBaseHud.alignments.bottomRight) self.driveNowBtn = CpHudButtonElement.new(driveNowOverlay, self) - local x, y = unpack(lines[6].right) + local x, y = unpack(lines[8].right) y = y - hMargin/4 local driveNowBtnX = x - 2*width - wMargin/2 - wMargin/8 self.driveNowBtn:setPosition(driveNowBtnX, y) @@ -55,21 +52,6 @@ function CpCombineUnloaderHudPageElement:setupElements(baseHud, vehicle, lines, vehicle:startCpCombineUnloaderUnloading() end) - --- Giants unload button - local width, height = getNormalizedScreenValues(22, 22) - local giantsUnloadOverlay = CpGuiUtil.createOverlay({width, height}, - {AIHotspot.FILENAME, AIHotspot.UVS}, - CpBaseHud.OFF_COLOR, - CpBaseHud.alignments.bottomRight) - self.activateGiantsUnloadBtn = CpHudButtonElement.new(giantsUnloadOverlay, self) - local _, y = unpack(lines[6].right) - y = y - hMargin/16 - x = driveNowBtnX - driveNowBtnWidth - wMargin/8 - self.activateGiantsUnloadBtn:setPosition(x, y) - self.activateGiantsUnloadBtn:setCallback("onClickPrimary", vehicle, function (vehicle) - vehicle:getCpCombineUnloaderJobParameters().useGiantsUnload:setNextItem() - end) - CpGuiUtil.addCopyAndPasteButtons(self, baseHud, vehicle, lines, wMargin, hMargin, 1) @@ -117,15 +99,9 @@ function CpCombineUnloaderHudPageElement:updateContent(vehicle, status) self.fullThresholdBtn:setTextDetails(fullThreshold:getTitle(), fullThreshold:getString()) self.fullThresholdBtn:setDisabled(fullThreshold:getIsDisabled()) - -- local useGiantsUnload = vehicle:getCpCombineUnloaderJobParameters().useGiantsUnload - -- self.giantsUnloadStationText:setVisible(useGiantsUnload:getValue() and not useGiantsUnload:getIsDisabled()) - -- self.giantsUnloadStationText:setDisabled(not useGiantsUnload:getValue() or vehicle:getIsCpActive()) - -- local giantsUnloadStation = vehicle:getCpCombineUnloaderJobParameters().unloadingStation - -- self.giantsUnloadStationText:setTextDetails(giantsUnloadStation:getString()) - - -- self.activateGiantsUnloadBtn:setColor(useGiantsUnload:getValue() and unpack(CpBaseHud.ON_COLOR) or unpack(CpBaseHud.OFF_COLOR)) - -- self.activateGiantsUnloadBtn:setVisible(not useGiantsUnload:getIsDisabled()) - -- self.activateGiantsUnloadBtn:setDisabled(useGiantsUnload:getIsDisabled() or vehicle:getIsCpActive()) + self.unloadModeBtn:setDisabled(vehicle:getIsCpActive()) + local text = vehicle:getCpCombineUnloaderJobParameters().unloadTarget:getString() + self.unloadModeBtn:setTextDetails(text) local fillLevelPercentage = FillLevelManager.getTotalTrailerFillLevelPercentage(vehicle) if fillLevelPercentage > 0.01 then @@ -200,6 +176,3 @@ function CpCombineUnloaderHudPageElement:arePositionEqual(parameters, otherParam return true end -function CpCombineUnloaderHudPageElement:isStartingPointBtnVisible() - return false -end diff --git a/scripts/gui/hud/CpFieldworkHudPage.lua b/scripts/gui/hud/CpFieldworkHudPage.lua index 51da27ad4..5b223c4ee 100644 --- a/scripts/gui/hud/CpFieldworkHudPage.lua +++ b/scripts/gui/hud/CpFieldworkHudPage.lua @@ -1,6 +1,6 @@ --- Fieldwork Hud page ----@class CpFieldWorkHudPageElement : CpHudElement +---@class CpFieldWorkHudPageElement : CpHudPageElement ---@field private parent CpBaseHud CpFieldWorkHudPageElement = {} local CpFieldWorkHudPageElement_mt = Class(CpFieldWorkHudPageElement, CpHudPageElement) @@ -13,8 +13,9 @@ end function CpFieldWorkHudPageElement:setupElements(baseHud, vehicle, lines, wMargin, hMargin) --- Time remaining text - local x, y = unpack(lines[6].left) - self.timeRemainingText = CpTextHudElement.new(self , x , y, CpBaseHud.defaultFontSize) + local x, y = unpack(lines[7].right) + self.timeRemainingText = CpTextHudElement.new(self, x - 2 * baseHud.wMargin, y, + CpBaseHud.defaultFontSize, RenderText.ALIGN_RIGHT) --- Clear course button. local width, height = getNormalizedScreenValues(18, 18) @@ -24,7 +25,7 @@ function CpFieldWorkHudPageElement:setupElements(baseHud, vehicle, lines, wMargi CpBaseHud.OFF_COLOR, CpBaseHud.alignments.bottomRight) self.clearCourseBtn = CpHudButtonElement.new(clearCourseOverlay, self) - local x, y = unpack(lines[6].right) + local x, y = unpack(lines[8].right) x = x - 2*width - wMargin/2 - wMargin/4 self.clearCourseBtn:setPosition(x, y) self.clearCourseBtn:setCallback("onClickPrimary", vehicle, function (vehicle) @@ -41,7 +42,7 @@ function CpFieldWorkHudPageElement:setupElements(baseHud, vehicle, lines, wMargi CpBaseHud.OFF_COLOR, CpBaseHud.alignments.bottomRight) self.courseVisibilityBtn = CpHudButtonElement.new(courseVisibilityOverlay, self) - local _, y = unpack(lines[6].right) + local _, y = unpack(lines[8].right) y = y - hMargin/16 x = x - width - wMargin/4 self.courseVisibilityBtn:setPosition(x, y) @@ -49,20 +50,25 @@ function CpFieldWorkHudPageElement:setupElements(baseHud, vehicle, lines, wMargi vehicle:getCpSettings().showCourse:setNextItem() end) - + --- Starting point + self.startingPointBtn = baseHud:addLeftLineTextButton(self, 5, CpBaseHud.defaultFontSize, + function (vehicle) + vehicle:getCpStartingPointSetting():setNextItem() + end, vehicle) + --- Work width self.workWidthBtn = baseHud:addLineTextButton(self, 3, CpBaseHud.defaultFontSize, - vehicle:getCourseGeneratorSettings().workWidth) + vehicle:getCourseGeneratorSettings().workWidth) - --- Tool offset x - self.toolOffsetXBtn = baseHud:addLineTextButton(self, 2, CpBaseHud.defaultFontSize, - vehicle:getCpSettings().toolOffsetX) + --- Tool offset x + self.toolOffsetXBtn = baseHud:addLineTextButton(self, 2, CpBaseHud.defaultFontSize, + vehicle:getCpSettings().toolOffsetX) - --- Lane offset + --- Lane offset self.laneOffsetBtn = baseHud:addRightLineTextButton(self, 5, CpBaseHud.defaultFontSize, - function (vehicle) - vehicle:getCpLaneOffsetSetting():setNextItem() - end, vehicle) + function (vehicle) + vehicle:getCpLaneOffsetSetting():setNextItem() + end, vehicle) --- Course name @@ -95,6 +101,9 @@ function CpFieldWorkHudPageElement:updateContent(vehicle, status) self.waypointProgressBtn:setTextDetails(status:getWaypointText()) + local startingPoint = vehicle:getCpStartingPointSetting() + self.startingPointBtn:setTextDetails(startingPoint:getString()) + local laneOffset = vehicle:getCpLaneOffsetSetting() self.laneOffsetBtn:setVisible(laneOffset:getCanBeChanged()) self.laneOffsetBtn:setTextDetails(laneOffset:getString()) @@ -126,11 +135,3 @@ function CpFieldWorkHudPageElement:updateContent(vehicle, status) CpGuiUtil.updateCopyBtn(self, vehicle, status) end - -function CpFieldWorkHudPageElement:isStartingPointBtnDisabled(vehicle) - return false -end - -function CpFieldWorkHudPageElement:getStartingPointBtnText(vehicle) - return vehicle:getCpStartingPointSetting():getString() -end \ No newline at end of file diff --git a/scripts/specializations/CpAICombineUnloader.lua b/scripts/specializations/CpAICombineUnloader.lua index cf9aa19cb..b2ebd5a24 100644 --- a/scripts/specializations/CpAICombineUnloader.lua +++ b/scripts/specializations/CpAICombineUnloader.lua @@ -249,11 +249,6 @@ end function CpAICombineUnloader:getCpStartableJob(superFunc, isStartedByHud) local spec = self.spec_cpAICombineUnloader if isStartedByHud and self:cpIsHudUnloaderJobSelected() then - if self:cpGetHudStartingPointSetting():getValue() == CpHud.hudSettings.START_AT_UNLOADER_HARVESTER then - spec.cpJob:getCpJobParameters().unloadTarget:setValue(CpCombineUnloaderJobParameters.UNLOAD_COMBINE) - else - spec.cpJob:getCpJobParameters().unloadTarget:setValue(CpCombineUnloaderJobParameters.UNLOAD_SILO_LOADER) - end return self:getCanStartCpCombineUnloader() and spec.cpJob end return superFunc(self, isStartedByHud) or self:getCanStartCpCombineUnloader() and spec.cpJob diff --git a/scripts/specializations/CpAIFieldWorker.lua b/scripts/specializations/CpAIFieldWorker.lua index 2a73779f3..868d92906 100644 --- a/scripts/specializations/CpAIFieldWorker.lua +++ b/scripts/specializations/CpAIFieldWorker.lua @@ -296,13 +296,6 @@ end function CpAIFieldWorker:getCpStartableJob(superFunc, isStartedByHud) local spec = self.spec_cpAIFieldWorker if isStartedByHud and self:cpIsHudFieldWorkJobSelected() then - if self:cpGetHudStartingPointSetting():getValue() == CpHud.hudSettings.START_AT_FIELDWORK_FIRST_POINT then - spec.cpJob:getCpJobParameters().startAt:setValue(CpFieldWorkJobParameters.START_AT_FIRST_POINT) - elseif self:cpGetHudStartingPointSetting():getValue() == CpHud.hudSettings.START_AT_FIELDWORK_NEAREST_POINT then - spec.cpJob:getCpJobParameters().startAt:setValue(CpFieldWorkJobParameters.START_AT_NEAREST_POINT) - else - spec.cpJob:getCpJobParameters().startAt:setValue(CpFieldWorkJobParameters.START_AT_LAST_POINT) - end return self:getCanStartCpFieldWork() and self:hasCpCourse() and spec.cpJob end return superFunc(self, isStartedByHud) or self:getCanStartCpFieldWork() and self:hasCpCourse() and spec.cpJob diff --git a/scripts/specializations/CpAIWorker.lua b/scripts/specializations/CpAIWorker.lua index 05b718516..68858044b 100644 --- a/scripts/specializations/CpAIWorker.lua +++ b/scripts/specializations/CpAIWorker.lua @@ -182,7 +182,7 @@ function CpAIWorker:updateActionEvents() g_inputBinding:setActionEventActive(actionEvent.actionEventId, false) end actionEvent = spec.actionEvents[InputAction.CP_CHANGE_STARTING_POINT] - local startingPointSetting = self:cpGetHudStartingPointSetting() + local startingPointSetting = self:cpGetHudSelectedJobSetting() g_inputBinding:setActionEventText(actionEvent.actionEventId, string.format("CP: %s %s", startingPointSetting:getTitle(), startingPointSetting:getString())) g_inputBinding:setActionEventActive(actionEvent.actionEventId, self:getCanStartCp()) @@ -197,7 +197,7 @@ function CpAIWorker:updateActionEvents() end function CpAIWorker:changeStartingPoint() - local startingPointSetting = self:cpGetHudStartingPointSetting() + local startingPointSetting = self:cpGetHudSelectedJobSetting() startingPointSetting:setNextItem() end diff --git a/scripts/specializations/CpCourseGeneratorSettings.lua b/scripts/specializations/CpCourseGeneratorSettings.lua index 248867cae..4e907afaf 100644 --- a/scripts/specializations/CpCourseGeneratorSettings.lua +++ b/scripts/specializations/CpCourseGeneratorSettings.lua @@ -228,7 +228,7 @@ end --- Only show the work width, if the bale finder can't be started. function CpCourseGeneratorSettings:isWorkWidthSettingVisible() - return not self:getCanStartCpBaleFinder() and not self:getCanStartCpBunkerSiloWorker() + return not self:getCanStartCpBaleFinder() end --- Generates speed setting values up to the max possible speed. diff --git a/scripts/specializations/CpHud.lua b/scripts/specializations/CpHud.lua index 36e653d7a..559ab0c5d 100644 --- a/scripts/specializations/CpHud.lua +++ b/scripts/specializations/CpHud.lua @@ -64,15 +64,14 @@ function CpHud.registerFunctions(vehicleType) SpecializationUtil.registerFunction(vehicleType, 'showCpBunkerSiloWorkWidth', CpHud.showCpBunkerSiloWorkWidth) SpecializationUtil.registerFunction(vehicleType, 'showCpCombineUnloaderWorkWidth', CpHud.showCpCombineUnloaderWorkWidth) SpecializationUtil.registerFunction(vehicleType, 'showCpCourseWorkWidth', CpHud.showCpCourseWorkWidth) - SpecializationUtil.registerFunction(vehicleType, "cpGetHudStartingPointSetting", CpHud.cpGetHudStartingPointSetting) + SpecializationUtil.registerFunction(vehicleType, "cpGetHudSelectedJobSetting", CpHud.cpGetHudSelectedJobSetting) SpecializationUtil.registerFunction(vehicleType, "cpIsHudFieldWorkJobSelected", CpHud.cpIsHudFieldWorkJobSelected) SpecializationUtil.registerFunction(vehicleType, "cpIsHudBaleFinderJobSelected", CpHud.cpIsHudBaleFinderJobSelected) SpecializationUtil.registerFunction(vehicleType, "cpIsHudBunkerSiloJobSelected", CpHud.cpIsHudBunkerSiloJobSelected) SpecializationUtil.registerFunction(vehicleType, "cpIsHudSiloLoaderJobSelected", CpHud.cpIsHudSiloLoaderJobSelected) SpecializationUtil.registerFunction(vehicleType, "cpIsHudUnloaderJobSelected", CpHud.cpIsHudUnloaderJobSelected) - SpecializationUtil.registerFunction(vehicleType, "cpIsHudDriveToJobSelected", CpHud.cpIsHudDriveToJobSelected) - SpecializationUtil.registerFunction(vehicleType, "cpIsHudTransportJobSelected", CpHud.cpIsHudTransportJobSelected) + SpecializationUtil.registerFunction(vehicleType, "cpIsHudStreetJobSelected", CpHud.cpIsHudStreetJobSelected) end function CpHud.registerOverwrittenFunctions(vehicleType) @@ -357,53 +356,46 @@ end function CpHud:cpIsHudFieldWorkJobSelected() local spec = self.spec_cpHud - local value = spec.hudSettings.hudStartAt:getValue() - return value <= CpHud.hudSettings.START_AT_FIELDWORK_LAST_POINT + local value = spec.hudSettings.selectedJob:getValue() + return value == CpHud.hudSettings.FIELDWORK_SELECTED end function CpHud:cpIsHudBaleFinderJobSelected() local spec = self.spec_cpHud - local value = spec.hudSettings.hudStartAt:getValue() - return value == CpHud.hudSettings.START_AT_BALE_FINDER + local value = spec.hudSettings.selectedJob:getValue() + return value == CpHud.hudSettings.BALE_FINDER_SELECTED end function CpHud:cpIsHudBunkerSiloJobSelected() local spec = self.spec_cpHud - local value = spec.hudSettings.hudStartAt:getValue() - return value == CpHud.hudSettings.START_AT_BUNKER_SILO + local value = spec.hudSettings.selectedJob:getValue() + return value == CpHud.hudSettings.BUNKER_SILO_SELECTED end function CpHud:cpIsHudSiloLoaderJobSelected() local spec = self.spec_cpHud - local value = spec.hudSettings.hudStartAt:getValue() - return value == CpHud.hudSettings.START_AT_SILO_LOADING + local value = spec.hudSettings.selectedJob:getValue() + return value == CpHud.hudSettings.SILO_LOADER_SELECTED end function CpHud:cpIsHudUnloaderJobSelected() local spec = self.spec_cpHud - local value = spec.hudSettings.hudStartAt:getValue() - return value == CpHud.hudSettings.START_AT_UNLOADER_HARVESTER or - value == CpHud.hudSettings.START_AT_UNLOADER_LOADER + local value = spec.hudSettings.selectedJob:getValue() + return value == CpHud.hudSettings.COMBINE_UNLOADER_SELECTED end -function CpHud:cpIsHudDriveToJobSelected() +function CpHud:cpIsHudStreetJobSelected() local spec = self.spec_cpHud - local value = spec.hudSettings.hudStartAt:getValue() - return value == CpHud.hudSettings.START_AT_STREET_DRIVE_TO + local value = spec.hudSettings.selectedJob:getValue() + return value == CpHud.hudSettings.STREET_DRIVER_SELECTED end -function CpHud:cpIsHudTransportJobSelected() +function CpHud:cpGetHudSelectedJobSetting() local spec = self.spec_cpHud - local value = spec.hudSettings.hudStartAt:getValue() - return value > CpHud.hudSettings.START_AT_STREET_DRIVE_TO -end - -function CpHud:cpGetHudStartingPointSetting() - local spec = self.spec_cpHud - return spec.hudSettings.hudStartAt + return spec.hudSettings.selectedJob end function CpHud:getCpStartText() local spec = self.spec_cpHud - return spec.hudSettings.hudStartAt:getString() or "---" + return spec.hudSettings.selectedJob:getString() or "---" end \ No newline at end of file