Skip to content

Commit 1589c0f

Browse files
authored
Release 2.0.0.2
2 parents 664b8d4 + f655cc0 commit 1589c0f

30 files changed

+458
-65
lines changed

modDesc.xml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,20 @@
77
<description>
88
<en>
99
<![CDATA[This mod can be used to create a network of routes for vehicles to drive autonomously. Once setup you can tell a tractor which is standing anywhere close to the network to drive to any point, such as the shop, field 1 or to a sell point.
10-
11-
Changelog 2.0.0.0:
1210
]]>
1311
</en>
1412
<de>
1513
<![CDATA[Dieser Mod erlaubt es ein Netzwerk von Routen aufzuzeichnen, um dann ein Fahrzeug von jedem beliebigen Punkt zu speziell definierten Zielen, wie zum Beispiel der eigenen Farm, Feld 1 oder auch zu jedem Verkaufspunkt fahren zu lassen.
16-
17-
Changelog 2.0.0.0:
1814
]]>
1915
</de>
2016
<it>
2117
<![CDATA[Questa mod può essere usata per creare una rete di percorsi per permettere ai veicoli di guidare autonomamente. Una volta effettuata la configurazione puoi dire a un veicolo di guidare tramite la rete verso un qualsiasi punto, come il negozio, il campo 1 o un punto vendita.
22-
23-
Log delle modifiche 2.0.0.0:
2418
]]>
2519
</it>
2620
<fr>
2721
<![CDATA[Ce mod peut être utilisé pour créer un réseau de routes permettant aux véhicules de conduire de manière autonome. Une fois la configuration effectuée, vous pouvez indiquer à un tracteur situé près du réseau de se rendre à n’importe quel point, tel que le magasin, le champ 1 ou un point de vente.
2822
Créer, ajouter, modifier, supprimer vos routes ou points de destination à l'aide de l'éditeur intégré très pratique !
2923
Différents modes d'utilisation ont été ajoutés depuis les premières versions, et peuvent être combinés à l'utilisation du bien connu "Courseplay".
30-
31-
Changelog 2.0.0.0:
3224
]]>
3325
</fr>
3426
<es>
@@ -38,7 +30,7 @@ Changelog 2.0.0.0:
3830
<![CDATA[Этот мод может быть использован для создания сети маршрутов для транспортных средств для автономного вождения. После настройки вы можете указать трактору, стоящему где-угодно рядом с сетью, проехать в любую точку, например, в магазин, поле №1 или в точку продажи.]]>
3931
</ru>
4032
</description>
41-
<version>2.0.0.1</version>
33+
<version>2.0.0.2</version>
4234
<multiplayer supported="true" />
4335
<iconFilename>icon.dds</iconFilename>
4436
<extraSourceFiles>
@@ -98,6 +90,7 @@ Changelog 2.0.0.0:
9890
<action name="ADToggleHudExtension" category="VEHICLE" ignoreComboMask="false" />
9991
<action name="ADToggleAutomaticUnloadTarget" category="VEHICLE" ignoreComboMask="false" />
10092
<action name="ADToggleAutomaticPickupTarget" category="VEHICLE" ignoreComboMask="false" />
93+
<action name="ADRepairVehicle" category="VEHICLE" ignoreComboMask="false" />
10194
</actions>
10295

10396
<inputBinding>

register.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- Author: Stephan
55
66
-- Date: 17.12.2021
7-
-- Version: 2.0.0.0
7+
-- Version: 2.0.0.2
88

99
-- #############################################################################
1010

scripts/AutoDrive.lua

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AutoDrive = {}
2-
AutoDrive.version = "2.0.0.1"
2+
AutoDrive.version = "2.0.0.2"
33

44
AutoDrive.directory = g_currentModDirectory
55

@@ -14,7 +14,8 @@ AutoDrive.experimentalFeatures.telemetryOutput = false
1414
AutoDrive.experimentalFeatures.enableRoutesManagerOnDediServer = false
1515
AutoDrive.experimentalFeatures.detectGrasField = true
1616
AutoDrive.experimentalFeatures.colorAssignmentMode = false
17-
AutoDrive.experimentalFeatures.DrawAlternativ = false
17+
AutoDrive.experimentalFeatures.UTurn = true
18+
AutoDrive.experimentalFeatures.FoldImplements = false
1819

1920
AutoDrive.dynamicChaseDistance = true
2021
AutoDrive.smootherDriving = true
@@ -118,7 +119,8 @@ AutoDrive.actions = {
118119
{"ADParkVehicle", false, 0},
119120
{"AD_devAction", false, 0},
120121
{"ADRefuelVehicle", false, 0},
121-
{"ADToggleHudExtension", true, 1}
122+
{"ADToggleHudExtension", true, 1},
123+
{"ADRepairVehicle", false, 0}
122124
}
123125

124126
AutoDrive.colors = {
@@ -150,8 +152,9 @@ AutoDrive.fuelFillTypes = {
150152
"AIR"
151153
}
152154

153-
AutoDrive.nonFillableFillTypes = {
154-
"AIR" -- this fillType should not be transported
155+
AutoDrive.nonFillableFillTypes = { -- these fillTypes should not be transported
156+
"AIR",
157+
"SILAGE_ADDITIVE"
155158
}
156159

157160
AutoDrive.seedFillTypes = {
@@ -285,6 +288,7 @@ function AutoDrive:loadMap(name)
285288
BaseMission.draw = Utils.appendedFunction(BaseMission.draw, AutoDrive.drawBaseMission)
286289
PlaceableHotspot.getCategory = Utils.overwrittenFunction(PlaceableHotspot.getCategory, AutoDrive.PlaceableHotspotGetCategory)
287290
InGameMenuAIFrame.setMapSelectionItem = Utils.overwrittenFunction(InGameMenuAIFrame.setMapSelectionItem, AutoDrive.InGameMenuAIFrameSetMapSelectionItem)
291+
MapHotspot.getRenderLast = Utils.overwrittenFunction(MapHotspot.getRenderLast, AutoDrive.MapHotspotGetRenderLast)
288292
end
289293

290294
function AutoDrive:onAIFrameOpen()
@@ -295,6 +299,7 @@ end
295299
function AutoDrive:onAIFrameClose()
296300
AutoDrive.aiFrameOpen = false
297301
AutoDrive.aiFrame = nil
302+
AutoDrive.aiFrameVehicle = nil
298303
end
299304

300305
function AutoDrive:refreshContextInputAIFrame()
@@ -312,15 +317,15 @@ function AutoDrive:drawBaseMission()
312317
AutoDrive:drawRouteOnMap()
313318
if AutoDrive.aiFrameVehicle ~= nil then
314319
AutoDrive.Hud:drawHud(AutoDrive.aiFrameVehicle)
315-
else
320+
elseif g_currentMission.controlledVehicle ~= nil then
316321
AutoDrive.Hud:drawHud(g_currentMission.controlledVehicle)
317322
end
318323
end
319324
end
320325

321326
function AutoDrive:PlaceableHotspotGetCategory()
322327
if self.isADMarker then
323-
return MapHotspot.CATEGORY_AI
328+
return MapHotspot.CATEGORY_PLAYER
324329
end
325330
return PlaceableHotspot.CATEGORY_MAPPING[self.placeableType]
326331
end
@@ -337,6 +342,13 @@ function AutoDrive:InGameMenuAIFrameSetMapSelectionItem(superFunc, hotspot)
337342
return superFunc(self, hotspot)
338343
end
339344

345+
function AutoDrive:MapHotspotGetRenderLast(superFunc)
346+
if self.isADMarker then
347+
return true
348+
end
349+
return superFunc(self)
350+
end
351+
340352
function AutoDrive.drawRouteOnMap()
341353
if AutoDrive.aiFrame == nil then
342354
return

scripts/Hud.lua

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -723,21 +723,23 @@ function AutoDriveHud:mouseEvent(vehicle, posX, posY, isDown, isUp, button)
723723

724724
AutoDrive.handleWayPointSection(vehicle, button, isUp)
725725
else
726-
vehicle.ad.selectedNodeId = nil
727-
vehicle.ad.nodeToMoveId = nil
728-
vehicle.ad.hoveredNodeId = nil
729-
vehicle.ad.newcreated = nil
730-
vehicle.ad.sectionWayPoints = {}
726+
AutoDrive.resetMouseSelections(vehicle)
731727
end
732728
else
729+
AutoDrive.resetMouseSelections(vehicle)
730+
end
731+
732+
AutoDrive.mouseWheelActive = AutoDrive.mouseWheelActive or (AutoDrive.pullDownListExpanded ~= 0)
733+
end
734+
735+
function AutoDrive.resetMouseSelections(vehicle)
736+
if vehicle ~= nil and vehicle.ad ~= nil then
733737
vehicle.ad.selectedNodeId = nil
734738
vehicle.ad.nodeToMoveId = nil
735739
vehicle.ad.hoveredNodeId = nil
736740
vehicle.ad.newcreated = nil
737-
vehicle.ad.sectionWayPoints = {}
741+
vehicle.ad.sectionWayPoints = {}
738742
end
739-
740-
AutoDrive.mouseWheelActive = AutoDrive.mouseWheelActive or (AutoDrive.pullDownListExpanded ~= 0)
741743
end
742744

743745
function AutoDrive.handleWayPointSection(vehicle, button, isUp)

scripts/Manager/GraphManager.lua

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,7 @@ function ADGraphManager:createDebugMarkers(updateMap)
10301030
end
10311031
local count1 = 1
10321032
local count2 = 1
1033+
local count3 = 1
10331034
local mapMarkerCounter = #self:getMapMarkers() + 1
10341035
for i, wp in pairs(network) do
10351036
-- mark wayPoint without outgoing connection
@@ -1078,6 +1079,28 @@ function ADGraphManager:createDebugMarkers(updateMap)
10781079
end
10791080
end
10801081
end
1082+
1083+
-- mark wayPoint without outgoing connection
1084+
if wp.out ~= nil then
1085+
for _, wp_out in pairs(wp.out) do
1086+
local missingIncoming = self:checkForMissingIncoming(wp, self:getWayPointById(wp_out))
1087+
if missingIncoming then
1088+
local debugMapMarkerName = "3_" .. tostring(count3)
1089+
1090+
-- create the mapMarker
1091+
local mapMarker = {}
1092+
mapMarker.name = debugMapMarkerName
1093+
mapMarker.group = ADGraphManager.debugGroupName
1094+
mapMarker.markerIndex = mapMarkerCounter
1095+
mapMarker.id = wp.id
1096+
mapMarker.isADDebug = true
1097+
self:setMapMarker(mapMarker)
1098+
1099+
count3 = count3 + 1
1100+
mapMarkerCounter = mapMarkerCounter + 1
1101+
end
1102+
end
1103+
end
10811104
end
10821105
end
10831106
if shouldUpdateMap == true then
@@ -1105,6 +1128,32 @@ function ADGraphManager:checkForWrongReverseStart(wp_ref, wp_current, wp_ahead)
11051128
return reverseStart
11061129
end
11071130

1131+
function ADGraphManager:checkForMissingIncoming(wp_current)
1132+
local ret = false
1133+
1134+
if wp_current == nil then
1135+
return ret
1136+
end
1137+
local reverseFound = false
1138+
if wp_current.incoming ~= nil and #wp_current.incoming == 0 then
1139+
1140+
-- search for a possible reverse connection
1141+
for _, wp in pairs(self.wayPoints) do
1142+
if wp.out ~= nil and wp_current.id ~= nil then
1143+
if table.contains(wp.out, wp_current.id) then
1144+
reverseFound = true
1145+
break
1146+
end
1147+
end
1148+
end
1149+
if not reverseFound then
1150+
-- the waypoint has no incoming connection
1151+
ret = true
1152+
end
1153+
end
1154+
return ret
1155+
end
1156+
11081157
function ADGraphManager:toggleWayPointAsSubPrio(wayPointId)
11091158
local wayPoint = self:getWayPointById(wayPointId)
11101159
if wayPoint ~= nil then

scripts/Manager/InputManager.lua

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ ADInputManager.actionsToInputs = {
5353
ADRefuelVehicle = "input_refuelVehicle",
5454
ADToggleHudExtension = "input_toggleHudExtension",
5555
ADToggleAutomaticUnloadTarget = "input_toggleAutomaticUnloadTarget",
56-
ADToggleAutomaticPickupTarget = "input_toggleAutomaticPickupTarget"
56+
ADToggleAutomaticPickupTarget = "input_toggleAutomaticPickupTarget",
57+
ADRepairVehicle = "input_repairVehicle"
5758
}
5859

5960

@@ -95,7 +96,8 @@ ADInputManager.inputsToIds = {
9596
input_bunkerUnloadType = 29,
9697
input_refuelVehicle = 30,
9798
input_toggleAutomaticUnloadTarget = 31,
98-
input_toggleAutomaticPickupTarget = 32
99+
input_toggleAutomaticPickupTarget = 32,
100+
input_repairVehicle = 33
99101
}
100102

101103
ADInputManager.idsToInputs = {}
@@ -491,7 +493,7 @@ function ADInputManager:input_bunkerUnloadType(vehicle)
491493
end
492494

493495
function ADInputManager:input_refuelVehicle(vehicle)
494-
AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_VEHICLEINFO, "ADInputManager:input_refuelVehicle ")
496+
AutoDrive.debugPrint(vehicle, AutoDrive.DC_VEHICLEINFO, "ADInputManager:input_refuelVehicle ")
495497
local refuelDestination = ADTriggerManager.getClosestRefuelDestination(vehicle, true)
496498
if refuelDestination ~= nil and refuelDestination >= 1 then
497499
-- vehicle.ad.stateModule:setFirstMarker(refuelDestination)
@@ -511,3 +513,18 @@ function ADInputManager:input_refuelVehicle(vehicle)
511513
AutoDriveMessageEvent.sendMessageOrNotification(vehicle, ADMessagesManager.messageTypes.ERROR, "$l10n_AD_Driver_of; %s $l10n_AD_No_Refuel_Station; %s", 5000, vehicle.ad.stateModule:getName(), refuelFillTypeTitle)
512514
end
513515
end
516+
517+
function ADInputManager:input_repairVehicle(vehicle)
518+
AutoDrive.debugPrint(vehicle, AutoDrive.DC_VEHICLEINFO, "ADInputManager:input_repairVehicle ")
519+
local repairDestinationMarkerNodeID = AutoDrive:getClosestRepairTrigger(vehicle)
520+
if repairDestinationMarkerNodeID ~= nil then
521+
if vehicle.ad.stateModule:isActive() then
522+
self:input_start_stop(vehicle) --disable if already active
523+
end
524+
vehicle.ad.onRouteToRepair = true
525+
vehicle.ad.stateModule:setMode(AutoDrive.MODE_DRIVETO)
526+
self:input_start_stop(vehicle)
527+
else
528+
AutoDriveMessageEvent.sendMessageOrNotification(vehicle, ADMessagesManager.messageTypes.ERROR, "$l10n_AD_Driver_of; %s $l10n_AD_No_Repair_Station;", 5000, vehicle.ad.stateModule:getName())
529+
end
530+
end

scripts/Modules/PathFinderModule.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1981,8 +1981,10 @@ function PathFinderModule:checkSlopeAngle(x1, z1, x2, z2)
19811981
local lengthMiddle = MathUtil.vector3Length(worldPosMiddle.x - x2, terrain3 - terrain2, worldPosMiddle.z - z2)
19821982
local angleBetween = math.atan(math.abs(terrain1 - terrain2) / length)
19831983
local angleBetweenCenter = math.atan(math.abs(terrain3 - terrain2) / lengthMiddle)
1984+
1985+
local waterY = g_currentMission.environmentAreaSystem:getWaterYAtWorldPosition(worldPosMiddle.x, terrain3, worldPosMiddle.z) or -200
19841986

1985-
local belowGroundLevel = terrain1 < g_currentMission.waterY - 0.5 or terrain2 < g_currentMission.waterY - 0.5 or terrain3 < g_currentMission.waterY - 0.5
1987+
local belowGroundLevel = terrain1 < waterY - 0.5 or terrain2 < waterY - 0.5 or terrain3 < waterY - 0.5
19861988

19871989
if belowGroundLevel then
19881990
if self.vehicle ~= nil and self.vehicle.ad ~= nil and self.vehicle.ad.debug ~= nil and AutoDrive.debugVehicleMsg ~= nil then

scripts/Modules/TaskModule.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ function ADTaskModule:RefuelIfNeeded()
131131
end
132132

133133
function ADTaskModule:hasToRepair()
134+
if self.vehicle.ad.onRouteToRepair then
135+
return true
136+
end
134137
if not AutoDrive.getSetting("autoRepair", self.vehicle) then
135138
return false
136139
end

scripts/Modules/TrailerModule.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ function ADTrailerModule:updateLoad(dt)
292292
-- update load delay timer
293293
self.loadDelayTimer:timer(self.lastFillLevel >= self.fillLevel and self.trigger == self, ADTrailerModule.LOAD_DELAY_TIME, dt)
294294

295-
if self.trigger == nil and not fillUnitFull then
295+
if self.trigger == nil and (not fillUnitFull or self.fillUnits > 1) then
296296

297297
AutoDrive.debugPrint(self.vehicle, AutoDrive.DC_TRAILERINFO, "ADTrailerModule:updateLoad search for load self.trigger %s", tostring(self.trigger))
298298

0 commit comments

Comments
 (0)