Skip to content

Commit

Permalink
Merge pull request #1181 from Stephan-S/dev-iwan
Browse files Browse the repository at this point in the history
Release 2.0.1.8
  • Loading branch information
Iwan1803 authored Nov 19, 2024
2 parents 23043f5 + fe8430d commit 61ecadf
Show file tree
Hide file tree
Showing 55 changed files with 3,036 additions and 500 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

/.vscode
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# FS22_AutoDrive
FS22 version of the AutoDrive mod

### Latest Release: 2.0.1.6
### Latest Release: 2.0.1.8
![GitHub all releases](https://img.shields.io/github/downloads/Stephan-S/FS22_AutoDrive/total?label=Downloads&style=plastic)
Direct Download: https://github.com/Stephan-S/FS22_AutoDrive/releases/latest/download/FS22_AutoDrive.zip

Expand Down
8 changes: 8 additions & 0 deletions gui/userSettingsPage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@
<GuiElement type="bitmap" profile="multiTextOptionSettingsBg" />
<GuiElement type="bitmap" profile="baseReference" position="730px 0px" size="50px 50px"/>
</GuiElement>
<GuiElement type="multiTextOption" profile="multiTextOptionSettings" onCreate="onCreateAutoDriveSetting" onClick="onOptionChange" name="scaleMarkerText" toolTipElementId="ingameMenuHelpBoxText">
<GuiElement type="button" profile="multiTextOptionSettingsLeft" />
<GuiElement type="button" profile="multiTextOptionSettingsRight" />
<GuiElement type="text" profile="multiTextOptionSettingsText" />
<GuiElement type="text" profile="multiTextOptionSettingsTitle" position="27px 0px" />
<GuiElement type="bitmap" profile="multiTextOptionSettingsBg" />
<GuiElement type="bitmap" profile="baseReference" position="730px 0px" size="50px 50px"/>
</GuiElement>
</GuiElement>
</GuiElement>

Expand Down
2 changes: 1 addition & 1 deletion modDesc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Différents modes d'utilisation ont été ajoutés depuis les premières version
<![CDATA[Этот мод может быть использован для создания сети маршрутов для транспортных средств для автономного вождения. После настройки вы можете указать трактору, стоящему где-угодно рядом с сетью, проехать в любую точку, например, в магазин, поле №1 или в точку продажи.]]>
</ru>
</description>
<version>2.0.1.6</version>
<version>2.0.1.8</version>
<multiplayer supported="true" />
<iconFilename>icon.dds</iconFilename>
<extraSourceFiles>
Expand Down
1 change: 1 addition & 0 deletions register.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ source(Utils.getFilename("scripts/Utils/Buffer.lua", g_currentModDirectory))
source(Utils.getFilename("scripts/Utils/FlaggedTable.lua", g_currentModDirectory))
source(Utils.getFilename("scripts/Utils/CollisionDetectionUtils.lua", g_currentModDirectory))
source(Utils.getFilename("scripts/Utils/PathFinderUtils.lua", g_currentModDirectory))
source(Utils.getFilename("scripts/Utils/Dubins.lua", g_currentModDirectory))
source(Utils.getFilename("scripts/Utils/AutoDriveUtilFuncs.lua", g_currentModDirectory))
source(Utils.getFilename("scripts/Utils/SortedQueue.lua", g_currentModDirectory))
source(Utils.getFilename("scripts/Utils/DevFuncs.lua", g_currentModDirectory))
Expand Down
5 changes: 3 additions & 2 deletions scripts/AutoDrive.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AutoDrive = {}
AutoDrive.version = "2.0.1.6"
AutoDrive.version = "2.0.1.8"

AutoDrive.directory = g_currentModDirectory

Expand All @@ -17,6 +17,7 @@ AutoDrive.experimentalFeatures.UTurn = true
AutoDrive.experimentalFeatures.FoldImplements = true
AutoDrive.experimentalFeatures.RefuelOnlyAtValidStations = true
AutoDrive.experimentalFeatures.RecordWhileNotInVehicle = false
AutoDrive.experimentalFeatures.NewPathfinder = true

AutoDrive.dynamicChaseDistance = true
AutoDrive.smootherDriving = true
Expand Down Expand Up @@ -440,7 +441,7 @@ function AutoDrive.drawNetworkOnMap()
if isSubPrio(outNode) then
r, g, b, a = unpack(AutoDrive.currentColors.ad_color_subPrioDualConnection)
end
elseif ADGraphManager:isReverseRoad(start, target) then
elseif ADGraphManager:isReverseRoad(node, outNode) then
r, g, b, a = unpack(AutoDrive.currentColors.ad_color_reverseConnection)
end
setOverlayColor( AutoDrive.courseOverlayId, r, g, b, a)
Expand Down
9 changes: 4 additions & 5 deletions scripts/ExternalInterface.lua
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ function AutoDrive:notifyDestinationListeners()
end

function AutoDrive:combineIsCallingDriver(combine) --only for CoursePlay
local openPipe,_ = ADHarvestManager.getOpenPipePercent(combine)
return openPipe or ADHarvestManager.doesHarvesterNeedUnloading(combine, true)
return AutoDrive:getIsCPWaitingForUnload(combine)
end

function AutoDrive:getCombineOpenPipePercent(combine) --for AIVE
Expand Down Expand Up @@ -828,9 +827,9 @@ function AutoDrive:getALFillTypes(object) -- used by PullDownList, getSupportedF
-- spec_universalAutoload
local spec = object.spec_universalAutoload
if spec and AutoDrive:hasAL(object) then
AutoDrive.debugPrint(vehicle, AutoDrive.DC_EXTERNALINTERFACEINFO, "AutoDrive:getALCurrentFillType spec_universalAutoload function not supported!")
AutoDrive.debugPrint(object, AutoDrive.DC_EXTERNALINTERFACEINFO, "AutoDrive:getALCurrentFillType spec_universalAutoload function not supported!")
end
AutoDrive.debugPrint(vehicle, AutoDrive.DC_EXTERNALINTERFACEINFO, "AutoDrive:getALFillTypes #fillTypes %s", tostring(#fillTypes))
AutoDrive.debugPrint(object, AutoDrive.DC_EXTERNALINTERFACEINFO, "AutoDrive:getALFillTypes #fillTypes %s", tostring(#fillTypes))
return fillTypes
end

Expand All @@ -847,7 +846,7 @@ function AutoDrive:getALCurrentFillType(object) -- used by onEnterVehicle, onPos
-- spec_universalAutoload
local spec = object.spec_universalAutoload
if spec and AutoDrive:hasAL(object) then
AutoDrive.debugPrint(vehicle, AutoDrive.DC_EXTERNALINTERFACEINFO, "AutoDrive:getALCurrentFillType spec_universalAutoload function not supported!")
AutoDrive.debugPrint(object, AutoDrive.DC_EXTERNALINTERFACEINFO, "AutoDrive:getALCurrentFillType spec_universalAutoload function not supported!")
end
return nil
end
Expand Down
1 change: 1 addition & 0 deletions scripts/Hud.lua
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ function AutoDriveHud:mouseEvent(vehicle, posX, posY, isDown, isUp, button)

if mouseActiveForAutoDrive then
local mouseEventHandled = false
local silent = false
if AutoDrive.splineInterpolation ~= nil then
AutoDrive.splineInterpolation.valid = false
end
Expand Down
42 changes: 26 additions & 16 deletions scripts/Hud/PullDownList.lua
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,16 @@ function ADPullDownList:createSelection_FillType()

if vehicle ~= nil then
local trailers, _ = AutoDrive.getAllUnits(vehicle)
supportedFillTypes = {}
for _, trailer in ipairs(trailers) do
if AutoDrive:hasAL(trailer) then
local alFillTypes = AutoDrive:getALFillTypes(trailer)
if alFillTypes ~= nil and #alFillTypes > 0 then
-- self.autoLoadFillTypes is either nil or it contains items. It is never empty.
self.autoLoadFillTypes = alFillTypes
break
if trailers then
supportedFillTypes = {}
for _, trailer in ipairs(trailers) do
if AutoDrive:hasAL(trailer) then
local alFillTypes = AutoDrive:getALFillTypes(trailer)
if alFillTypes ~= nil and #alFillTypes > 0 then
-- self.autoLoadFillTypes is either nil or it contains items. It is never empty.
self.autoLoadFillTypes = alFillTypes
break
end
end
end
end
Expand Down Expand Up @@ -703,21 +705,29 @@ function ADPullDownList:act(vehicle, posX, posY, isDown, isUp, button)
elseif button == 4 and isUp then
-- mouse wheel
local oldSelected = self.selected
self.selected = math.max(1, self.selected - 1)
local decrement = 1
if AutoDrive.leftCTRLmodifierKeyPressed then
decrement = 10
end
self.selected = math.max(1, self.selected - decrement)
if oldSelected ~= self.selected then
self.hovered = math.max(1, self.hovered - 1)
self.hovered = math.max(1, self.hovered - decrement)
end
if self.hovered > (self.selected + ADPullDownList.MAX_SHOWN - 1) then
self.hovered = self.selected + ADPullDownList.MAX_SHOWN - 1
if self.hovered > (self.selected + ADPullDownList.MAX_SHOWN - decrement) then
self.hovered = self.selected + ADPullDownList.MAX_SHOWN - decrement
end
AutoDrive.mouseWheelActive = true
return true
elseif button == 5 and isUp then
-- mouse wheel
if self:getListElementByIndex(vehicle, self.selected + 1 + ADPullDownList.MAX_SHOWN - 3) ~= nil then
self.selected = self.selected + 1
if self:getListElementByIndex(vehicle, self.hovered + 1 + ADPullDownList.MAX_SHOWN - 3) ~= nil then
self.hovered = self.hovered + 1
local increment = 1
if AutoDrive.leftCTRLmodifierKeyPressed then
increment = 10
end
if self:getListElementByIndex(vehicle, self.selected + increment + ADPullDownList.MAX_SHOWN - 3) ~= nil then
self.selected = self.selected + increment
if self:getListElementByIndex(vehicle, self.hovered + increment + ADPullDownList.MAX_SHOWN - 3) ~= nil then
self.hovered = self.hovered + increment
end
end
AutoDrive.mouseWheelActive = true
Expand Down
6 changes: 5 additions & 1 deletion scripts/Manager/BunkerSiloManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ function ADBunkerSiloManager:update(dt)
if triggerX ~= nil then
local distance = MathUtil.vector2Length(triggerX - vehicleX, triggerZ - vehicleZ)
if distance < bsmRange then
if AutoDrive.isVehicleInBunkerSiloArea(vehicle) or bunkerSilo.adClosestVehicle == vehicle then
local fillLevel, _, _, _ = AutoDrive.getAllFillLevels(AutoDrive.getAllUnits(vehicle))
if AutoDrive.isVehicleInBunkerSiloArea(vehicle)
or bunkerSilo.adClosestVehicle == vehicle
or fillLevel < 0.1
then
-- IMPORTANT: DO NOT SET setUnPaused to avoid crash with CP silo compacter !!!
-- vehicle.ad.drivePathModule:setUnPaused()
else
Expand Down
Loading

0 comments on commit 61ecadf

Please sign in to comment.