Skip to content

Commit

Permalink
Gamepad hud adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
schwiti6190 committed Apr 6, 2024
1 parent 0f92cc2 commit adb5f01
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 46 deletions.
2 changes: 0 additions & 2 deletions config/gamePadHud/BaleLoaderGamePadHudPage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
-->

<Settings title="CP_vehicle_setting_display">
<Setting type="vehicleSettings" name = "showCourse" />
<Setting type="fieldWorkJobParameters" name = "startAt" />
<Setting type="baleFinderJobParameters" name = "baleWrapType" />
<Setting type="vehicleSettings" name = "baleCollectorOffset" />
</Settings>
1 change: 0 additions & 1 deletion config/gamePadHud/BunkerSiloGamePadHudPage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
-->

<Settings title="CP_vehicle_setting_display">
<Setting type="fieldWorkJobParameters" name = "startAt" />
<Setting type="vehicleSettings" name="bunkerSiloWorkWidth"/>
<Setting type="bunkerSiloJobParameters" name = "drivingForwardsIntoSilo" />
<Setting type="bunkerSiloJobParameters" name = "waitAtParkPosition" />
Expand Down
1 change: 0 additions & 1 deletion config/gamePadHud/SiloLoaderGamePadHudPage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
-->

<Settings title="CP_vehicle_setting_display">
<Setting type="fieldWorkJobParameters" name = "startAt" />
<Setting type="vehicleSettings" name="bunkerSiloWorkWidth"/>
<Setting type="vehicleSettings" name="loadingShovelHeightOffset"/>
</Settings>
35 changes: 9 additions & 26 deletions scripts/gui/CpGamePadHudScreen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ function CpGamePadHudScreen:setData(vehicle, settings)
self.settings = settings
end

function CpGamePadHudScreen:onClickCpMultiTextOption()
function CpGamePadHudScreen:onClickCpMultiTextOption(v, guiElement)
CpSettingsUtil.updateGuiElementsBoundToSettings(self.layout, self.vehicle)
if guiElement.aiParameter and guiElement.aiParameter:getName() == "selectedJob" then
self.vehicle:reopenCpGamePadHud()
end
end

function CpGamePadHudScreen:onOpen(element)
Expand All @@ -63,6 +66,11 @@ function CpGamePadHudScreen:onOpen(element)
for i = #self.layout.elements, 1, -1 do
self.layout.elements[i]:delete()
end
CpSettingsUtil.generateGuiElementsFromSettingsTableAlternating({self.vehicle:cpGetHudSelectedJobSetting()}, self.layout,
self.settingTemplate:getDescendantByName("title"),
self.settingTemplate:getDescendantByName("element"))



CpSettingsUtil.generateGuiElementsFromSettingsTableAlternating(self.settings, self.layout,
self.settingTemplate:getDescendantByName("title"),
Expand Down Expand Up @@ -192,17 +200,6 @@ function CpGamePadHudFieldWorkScreen.new(settings, target, custom_mt)
return self
end

function CpGamePadHudFieldWorkScreen:update(dt, ...)
CpGamePadHudFieldWorkScreen:superClass().update(self, dt, ...)
if self.vehicle:getCanStartCpBunkerSiloWorker() and self.vehicle:getCpStartingPointSetting():getValue() == CpFieldWorkJobParameters.START_AT_BUNKER_SILO
and not AIUtil.hasChildVehicleWithSpecialization(self.vehicle, Leveler) then
self.vehicle:reopenCpGamePadHud()
elseif self.vehicle:getCanStartCpSiloLoaderWorker() and self.vehicle:getCpStartingPointSetting():getValue() == CpFieldWorkJobParameters.START_AT_SILO_LOADING
and not AIUtil.hasChildVehicleWithSpecialization(self.vehicle, ConveyorBelt) then
self.vehicle:reopenCpGamePadHud()
end
end

function CpGamePadHudFieldWorkScreen:drawWorkWidth()
self.vehicle:showCpCourseWorkWidth()
end
Expand Down Expand Up @@ -245,13 +242,6 @@ function CpGamePadHudBunkerSiloScreen.new(settings, target, custom_mt)
return self
end

function CpGamePadHudBunkerSiloScreen:update(dt, ...)
CpGamePadHudBunkerSiloScreen:superClass().update(self, dt, ...)
if not self.vehicle:getCanStartCpBunkerSiloWorker() or self.vehicle:getCpStartingPointSetting():getValue() ~= CpFieldWorkJobParameters.START_AT_BUNKER_SILO then
self.vehicle:reopenCpGamePadHud()
end
end

function CpGamePadHudBunkerSiloScreen:drawWorkWidth()
self.vehicle:showCpBunkerSiloWorkWidth()
end
Expand All @@ -266,13 +256,6 @@ function CpGamePadHudSiloLoaderScreen.new(settings, target, custom_mt)
return self
end

function CpGamePadHudSiloLoaderScreen:update(dt, ...)
CpGamePadHudSiloLoaderScreen:superClass().update(self, dt, ...)
if not self.vehicle:getCanStartCpSiloLoaderWorker() or self.vehicle:getCpStartingPointSetting():getValue() ~= CpFieldWorkJobParameters.START_AT_SILO_LOADING then
self.vehicle:reopenCpGamePadHud()
end
end

function CpGamePadHudSiloLoaderScreen:drawWorkWidth()
self.vehicle:showCpBunkerSiloWorkWidth()
end
33 changes: 17 additions & 16 deletions scripts/specializations/CpGamePadHud.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,24 +188,25 @@ end

function CpGamePadHud:actionEventOpenCloseDisplay()
local spec = self.spec_cpGamePadHud
spec.isVisible = true
local page = ""
if self:getCanStartCpCombineUnloader() then
page = CpGamePadHud.UNLOADER_PAGE
elseif self:getCanStartCpBaleFinder() then
page = CpGamePadHud.BALE_LOADER_PAGE
elseif self:getCanStartCpSiloLoaderWorker() and (self:getCpStartingPointSetting():getValue() == CpFieldWorkJobParameters.START_AT_SILO_LOADING or
AIUtil.hasChildVehicleWithSpecialization(self, ConveyorBelt)) then
page = CpGamePadHud.SILO_LOADER_PAGE
elseif self:getCanStartCpBunkerSiloWorker() and (self:getCpStartingPointSetting():getValue() == CpFieldWorkJobParameters.START_AT_BUNKER_SILO
or (AIUtil.hasChildVehicleWithSpecialization(self, Leveler)
and not AIUtil.hasChildVehicleWithSpecialization(self, Shovel))) then
page = CpGamePadHud.BUNKER_SILO_PAGE
else
local page
if self:cpIsHudFieldWorkJobSelected() then
page = CpGamePadHud.FIELDWORK_PAGE
elseif self:cpIsHudBaleFinderJobSelected() then
page = CpGamePadHud.BALE_LOADER_PAGE
elseif self:cpIsHudBunkerSiloJobSelected() then
page = CpGamePadHud.BUNKER_SILO_PAGE
elseif self:cpIsHudSiloLoaderJobSelected() then
page = CpGamePadHud.SILO_LOADER_PAGE
elseif self:cpIsHudUnloaderJobSelected() then
page = CpGamePadHud.UNLOADER_PAGE
elseif self:cpIsHudStreetJobSelected() then
page = CpGamePadHud.FIELDWORK_PAGE
end
if page then
spec.isVisible = true
CpGamePadHud.pages[page].screen:setData(self, spec.pages[page].settings)
g_gui:showGui(page)
end
CpGamePadHud.pages[page].screen:setData(self, spec.pages[page].settings)
g_gui:showGui(page)
end

function CpGamePadHud:isCpGamePadHudActive()
Expand Down

0 comments on commit adb5f01

Please sign in to comment.