Skip to content

Commit e9084e7

Browse files
authored
Merge pull request #934 from Stephan-S/dev-iwan
Release 2.0.1.2
2 parents f82dc79 + 0baaa6c commit e9084e7

45 files changed

Lines changed: 742 additions & 246 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# FS22_AutoDrive
22
FS22 version of the AutoDrive mod
33

4-
### Latest Release: 2.0.1.0
4+
### Latest Release: 2.0.1.2
55
![GitHub all releases](https://img.shields.io/github/downloads/Stephan-S/FS22_AutoDrive/total?label=Downloads&style=plastic)
66
[Latest Release](https://github.com/Stephan-S/FS22_AutoDrive/releases/latest)
7-
Direct Download: https://github.com/Stephan-S/FS22_AutoDrive/releases/download/2.0.1.0/FS22_AutoDrive.zip
7+
Direct Download: https://github.com/Stephan-S/FS22_AutoDrive/releases/download/2.0.1.2/FS22_AutoDrive.zip
88

99
## Discord Server:
1010
For help & support, feel free to join us on Discord:

modDesc.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
2-
<modDesc descVersion="72">
2+
<modDesc descVersion="75">
33
<author>AutoDrive Team</author>
44
<title>
55
<en>AutoDrive</en>
@@ -32,7 +32,7 @@ Différents modes d'utilisation ont été ajoutés depuis les premières version
3232
<![CDATA[Этот мод может быть использован для создания сети маршрутов для транспортных средств для автономного вождения. После настройки вы можете указать трактору, стоящему где-угодно рядом с сетью, проехать в любую точку, например, в магазин, поле №1 или в точку продажи.]]>
3333
</ru>
3434
</description>
35-
<version>2.0.1.0</version>
35+
<version>2.0.1.2</version>
3636
<multiplayer supported="true" />
3737
<iconFilename>icon.dds</iconFilename>
3838
<extraSourceFiles>
@@ -92,6 +92,7 @@ Différents modes d'utilisation ont été ajoutés depuis les premières version
9292
<action name="ADToggleHudExtension" category="VEHICLE" ignoreComboMask="false" />
9393
<action name="ADToggleAutomaticUnloadTarget" category="VEHICLE" ignoreComboMask="false" />
9494
<action name="ADToggleAutomaticPickupTarget" category="VEHICLE" ignoreComboMask="false" />
95+
<action name="ADToggleLoadByFillLevel" category="VEHICLE" ignoreComboMask="false" />
9596
<action name="ADRepairVehicle" category="VEHICLE" ignoreComboMask="false" />
9697
</actions>
9798

scripts/AutoDrive.lua

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

44
AutoDrive.directory = g_currentModDirectory
55

@@ -11,7 +11,7 @@ AutoDrive.experimentalFeatures = {}
1111
AutoDrive.experimentalFeatures.redLinePosition = false
1212
-- AutoDrive.experimentalFeatures.telemetryOutput = false
1313
AutoDrive.experimentalFeatures.enableRoutesManagerOnDediServer = false
14-
AutoDrive.experimentalFeatures.detectGrasField = true
14+
AutoDrive.experimentalFeatures.detectSwath = true
1515
AutoDrive.experimentalFeatures.colorAssignmentMode = false
1616
AutoDrive.experimentalFeatures.UTurn = true
1717
AutoDrive.experimentalFeatures.FoldImplements = true
@@ -289,7 +289,7 @@ function AutoDrive:refreshContextInputAIFrame()
289289
end
290290

291291
function AutoDrive:drawBaseMission()
292-
if AutoDrive.aiFrameOpen then
292+
if AutoDrive.aiFrameOpen then
293293
AutoDrive:drawRouteOnMap()
294294
AutoDrive.drawNetworkOnMap()
295295
if AutoDrive.aiFrameVehicle ~= nil then
@@ -355,20 +355,20 @@ function AutoDrive.drawRouteOnMap()
355355
if lastWp ~= nil and index >= currentWp then
356356
local startX, startY, _, _ = AutoDrive.getScreenPosFromWorldPos(lastWp.x, lastWp.z)
357357
local endX, endY, _, _ = AutoDrive.getScreenPosFromWorldPos(wp.x, wp.z)
358-
358+
359359
if startX and startY and endX and endY then
360360
dx2D = endX - startX;
361361
dy2D = ( endY - startY ) / g_screenAspectRatio;
362362
width = MathUtil.vector2Length(dx2D, dy2D);
363-
363+
364364
dx = wp.x - lastWp.x;
365365
dz = wp.z - lastWp.z;
366366
rotation = MathUtil.getYRotationFromDirection(dx, dz) - math.pi * 0.5;
367-
367+
368368
local lineThickness = 2 / g_screenHeight
369369
setOverlayColor( AutoDrive.courseOverlayId, 0.3, 0.5, 0.56, 1)
370370
setOverlayRotation( AutoDrive.courseOverlayId, rotation, 0, 0)
371-
371+
372372
renderOverlay( AutoDrive.courseOverlayId, startX, startY, width, lineThickness )
373373
end
374374
setOverlayRotation( AutoDrive.courseOverlayId, 0, 0, 0 ) -- reset overlay rotation
@@ -407,34 +407,34 @@ function AutoDrive.drawNetworkOnMap()
407407
local outNode = network[outNodeId]
408408
local startX, startY, _, _ = AutoDrive.getScreenPosFromWorldPos(node.x, node.z)
409409
local endX, endY, _, _ = AutoDrive.getScreenPosFromWorldPos(outNode.x, outNode.z)
410-
410+
411411
if startX and startY and endX and endY then
412412
dx2D = endX - startX;
413413
dy2D = ( endY - startY ) / g_screenAspectRatio;
414414
width = MathUtil.vector2Length(dx2D, dy2D);
415-
415+
416416
dx = outNode.x - node.x;
417417
dz = outNode.z - node.z;
418418
rotation = MathUtil.getYRotationFromDirection(dx, dz) - math.pi * 0.5;
419-
419+
420420
local lineThickness = 2 / g_screenHeight
421421
local r, g, b, a = unpack(AutoDrive.currentColors.ad_color_singleConnection)
422-
422+
423423
if isSubPrio(outNode) then
424424
r, g, b, a = unpack(AutoDrive.currentColors.ad_color_subPrioSingleConnection)
425425
end
426-
426+
427427
if ADGraphManager:isDualRoad(node, outNode) then
428428
r, g, b, a = unpack(AutoDrive.currentColors.ad_color_dualConnection)
429429
if isSubPrio(outNode) then
430430
r, g, b, a = unpack(AutoDrive.currentColors.ad_color_subPrioDualConnection)
431-
end
432-
elseif ADGraphManager:isReverseRoad(start, target) then
431+
end
432+
elseif ADGraphManager:isReverseRoad(start, target) then
433433
r, g, b, a = unpack(AutoDrive.currentColors.ad_color_reverseConnection)
434434
end
435435
setOverlayColor( AutoDrive.courseOverlayId, r, g, b, a)
436436
setOverlayRotation( AutoDrive.courseOverlayId, rotation, 0, 0)
437-
437+
438438
renderOverlay( AutoDrive.courseOverlayId, startX, startY, width, lineThickness )
439439
end
440440
setOverlayRotation( AutoDrive.courseOverlayId, 0, 0, 0 ) -- reset overlay rotation
@@ -448,7 +448,7 @@ function AutoDrive.getScreenPosFromWorldPos(worldX, worldZ)
448448
local objectX = (worldX + AutoDrive.aiFrame.ingameMapBase.worldCenterOffsetX) / AutoDrive.aiFrame.ingameMapBase.worldSizeX * 0.5 + 0.25
449449
local objectZ = (worldZ + AutoDrive.aiFrame.ingameMapBase.worldCenterOffsetZ) / AutoDrive.aiFrame.ingameMapBase.worldSizeZ * 0.5 + 0.25
450450
local x, y, _, _ = AutoDrive.aiFrame.ingameMapBase.layout:getMapObjectPosition(objectX, objectZ, 0, 0, 0, true)
451-
451+
452452
return x, y
453453
end
454454

@@ -557,7 +557,7 @@ end
557557
function AutoDrive:mouseEvent(posX, posY, isDown, isUp, button)
558558
local vehicle = AutoDrive.getADFocusVehicle()
559559
local mouseActiveForAutoDrive = (g_gui.currentGui == nil or AutoDrive.aiFrameOpen) and (g_inputBinding:getShowMouseCursor() == true)
560-
560+
561561
if not mouseActiveForAutoDrive then
562562
AutoDrive.lastButtonDown = nil
563563
return
@@ -591,7 +591,7 @@ function AutoDrive:mouseEvent(posX, posY, isDown, isUp, button)
591591
end
592592
end
593593

594-
function AutoDrive:update(dt)
594+
function AutoDrive:update(dt)
595595
if AutoDrive.scanDialogState == AutoDrive.SCAN_DIALOG_NONE and ADGraphManager:getWayPointsCount() == 0 then
596596
if g_server ~= nil and g_dedicatedServer == nil then
597597
-- open dialog
@@ -657,7 +657,7 @@ function AutoDrive:update(dt)
657657
ADTriggerManager:update(dt)
658658
ADRoutesManager:update(dt)
659659

660-
-- AutoDrive.handleTelemetry(dt)
660+
-- AutoDrive.handleTelemetry(dt)
661661
end
662662

663663
function AutoDrive:draw()

scripts/Events/HudInputEvent.lua

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ AutoDriveHudInputEventEvent = {}
22
AutoDriveHudInputEventEvent.TYPE_FIRST_MARKER = 1
33
AutoDriveHudInputEventEvent.TYPE_SECOND_MARKER = 2
44
AutoDriveHudInputEventEvent.TYPE_FILLTYPE = 3
5+
AutoDriveHudInputEventEvent.TYPE_TOGGLE_FILLTYPE_SELECTION = 4
6+
AutoDriveHudInputEventEvent.TYPE_TOGGLE_ALL_FILLTYPE_SELECTIONS = 5
57

68
AutoDriveHudInputEventEvent_mt = Class(AutoDriveHudInputEventEvent, Event)
79

@@ -53,6 +55,14 @@ function AutoDriveHudInputEventEvent:run(connection)
5355
if self.eventType == self.TYPE_FILLTYPE then
5456
self.vehicle.ad.stateModule:setFillType(self.value)
5557
end
58+
59+
if self.eventType == self.TYPE_TOGGLE_FILLTYPE_SELECTION then
60+
self.vehicle.ad.stateModule:toggleFillTypeSelection(self.value)
61+
end
62+
63+
if self.eventType == self.TYPE_TOGGLE_ALL_FILLTYPE_SELECTIONS then
64+
self.vehicle.ad.stateModule:toggleAllFillTypeSelections(self.value)
65+
end
5666
end
5767
end
5868

@@ -76,3 +86,17 @@ function AutoDriveHudInputEventEvent:sendFillTypeEvent(vehicle, fillTypeId)
7686
g_client:getServerConnection():sendEvent(AutoDriveHudInputEventEvent.new(vehicle, self.TYPE_FILLTYPE, fillTypeId))
7787
end
7888
end
89+
90+
function AutoDriveHudInputEventEvent:sendToggleFillTypeSelectionEvent(vehicle, fillTypeId)
91+
if g_client ~= nil then
92+
-- Client have to send to server
93+
g_client:getServerConnection():sendEvent(AutoDriveHudInputEventEvent.new(vehicle, self.TYPE_TOGGLE_FILLTYPE_SELECTION, fillTypeId))
94+
end
95+
end
96+
97+
function AutoDriveHudInputEventEvent:sendToggleAllFillTypeSelectionsEvent(vehicle, fillTypeId)
98+
if g_client ~= nil then
99+
-- Client have to send to server
100+
g_client:getServerConnection():sendEvent(AutoDriveHudInputEventEvent.new(vehicle, self.TYPE_TOGGLE_ALL_FILLTYPE_SELECTIONS, fillTypeId))
101+
end
102+
end

0 commit comments

Comments
 (0)