Skip to content

Commit f8ecba3

Browse files
authored
Merge pull request #1090 from Stephan-S/dev-iwan
AutoDrive 2.0.1.6
2 parents 1eb6f65 + fe7706c commit f8ecba3

86 files changed

Lines changed: 2079 additions & 1326 deletions

File tree

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: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# FS22_AutoDrive
22
FS22 version of the AutoDrive mod
33

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

@@ -18,13 +18,12 @@ And to all who do donate: Thank you very much :-)
1818
#### Stephan (Founder):
1919
https://www.paypal.me/StephanSchlosser
2020

21-
#### Axel (Modder)
22-
2321
#### Iwan1803 (Community Manager, Supporter & Tester):
24-
https://www.tipeeestream.com/iwan1803/tip
22+
https://iwan1803.de/urls/tip
2523

26-
#### Willi (Supporter & Tester)
24+
#### Axel & Tommo (Modder)
2725

26+
#### Willi (Supporter & Tester)
2827

2928
## Course Editor
3029
The course editor is now maintained by @KillBait and can be found here:

gui/settingsPage.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@
100100
<GuiElement type="bitmap" profile="multiTextOptionSettingsBg" />
101101
<GuiElement type="bitmap" profile="baseReference" position="730px 0px" size="50px 50px"/>
102102
</GuiElement>
103+
<GuiElement type="multiTextOption" profile="multiTextOptionSettings" onCreate="onCreateAutoDriveSetting" onClick="onOptionChange" name="BSMRange" toolTipElementId="ingameMenuHelpBoxText">
104+
<GuiElement type="button" profile="multiTextOptionSettingsLeft" />
105+
<GuiElement type="button" profile="multiTextOptionSettingsRight" />
106+
<GuiElement type="text" profile="multiTextOptionSettingsText" />
107+
<GuiElement type="text" profile="multiTextOptionSettingsTitle" position="27px 0px" />
108+
<GuiElement type="bitmap" profile="multiTextOptionSettingsBg" />
109+
<GuiElement type="bitmap" profile="baseReference" position="730px 0px" size="50px 50px"/>
110+
</GuiElement>
103111
</GuiElement>
104112
</GuiElement>
105113

gui/vehicleSettingsPage.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@
163163
<GuiElement type="bitmap" profile="multiTextOptionSettingsBg" />
164164
<GuiElement type="bitmap" profile="baseReference" position="730px 0px" size="50px 50px"/>
165165
</GuiElement>
166+
<GuiElement type="multiTextOption" profile="multiTextOptionSettings" onCreate="onCreateAutoDriveSetting" onClick="onOptionChange" name="maxTriggerDistanceVehicle" toolTipElementId="ingameMenuHelpBoxText">
167+
<GuiElement type="button" profile="multiTextOptionSettingsLeft" />
168+
<GuiElement type="button" profile="multiTextOptionSettingsRight" />
169+
<GuiElement type="text" profile="multiTextOptionSettingsText" />
170+
<GuiElement type="text" profile="multiTextOptionSettingsTitle" position="27px 0px" />
171+
<GuiElement type="bitmap" profile="multiTextOptionSettingsBg" />
172+
<GuiElement type="bitmap" profile="baseReference" position="730px 0px" size="50px 50px"/>
173+
</GuiElement>
166174
</GuiElement>
167175
</GuiElement>
168176
<GuiElement type="bitmap" profile="ingameMenuHelpRowBg" position="210px -64px" id="ingameMenuHelpBox" visible="false">

modDesc.xml

Lines changed: 2 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="75">
2+
<modDesc descVersion="79">
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.4</version>
35+
<version>2.0.1.6</version>
3636
<multiplayer supported="true" />
3737
<iconFilename>icon.dds</iconFilename>
3838
<extraSourceFiles>

register.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ source(Utils.getFilename("scripts/TelemetryExport.lua", g_currentModDirectory))
2222

2323
source(Utils.getFilename("scripts/Hud/GenericHudElement.lua", g_currentModDirectory))
2424
source(Utils.getFilename("scripts/Hud/HudButton.lua", g_currentModDirectory))
25+
source(Utils.getFilename("scripts/Hud/HudCounterButton.lua", g_currentModDirectory))
2526
source(Utils.getFilename("scripts/Hud/HudSettingsButton.lua", g_currentModDirectory))
2627
source(Utils.getFilename("scripts/Hud/HudIcon.lua", g_currentModDirectory))
2728
source(Utils.getFilename("scripts/Hud/HudSpeedmeter.lua", g_currentModDirectory))
@@ -79,6 +80,7 @@ source(Utils.getFilename("scripts/Manager/UserDataManager.lua", g_currentModDire
7980
source(Utils.getFilename("scripts/Manager/MultipleTargetsManager.lua", g_currentModDirectory))
8081
source(Utils.getFilename("scripts/Manager/ThirdPartyModsManager.lua", g_currentModDirectory))
8182
source(Utils.getFilename("scripts/Manager/Scheduler.lua", g_currentModDirectory))
83+
source(Utils.getFilename("scripts/Manager/BunkerSiloManager.lua", g_currentModDirectory))
8284

8385
source(Utils.getFilename("scripts/Tasks/AbstractTask.lua", g_currentModDirectory))
8486
source(Utils.getFilename("scripts/Tasks/DriveToDestinationTask.lua", g_currentModDirectory))

scripts/AutoDrive.lua

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AutoDrive = {}
2-
AutoDrive.version = "2.0.1.4"
2+
AutoDrive.version = "2.0.1.6"
33

44
AutoDrive.directory = g_currentModDirectory
55

@@ -92,6 +92,11 @@ AutoDrive.FLAG_TRAFFIC_SYSTEM_CONNECTION = 4
9292
-- add this to measured size of vehicles
9393
AutoDrive.DIMENSION_ADDITION = 0.2
9494

95+
-- AD invoked by which type of user
96+
AutoDrive.USER_PLAYER = 1
97+
AutoDrive.USER_GIANTS = 2
98+
AutoDrive.USER_CP = 3
99+
95100
AutoDrive.colors = {
96101
ad_color_singleConnection = {0, 1, 0, 1},
97102
ad_color_dualConnection = {0, 0, 1, 1},
@@ -107,8 +112,13 @@ AutoDrive.colors = {
107112
ad_color_currentConnection = {1, 1, 1, 1},
108113
ad_color_closestLine = {1, 0, 0, 1},
109114
ad_color_editorHeightLine = {1, 1, 1, 1},
115+
ad_color_previewSingleConnection = {0.3, 0.9, 0, 1},
116+
ad_color_previewDualConnection = {0, 0, 0.9, 1},
117+
ad_color_previewSubPrioSingleConnection = {0.9, 0.4, 0.1, 1},
118+
ad_color_previewSubPrioDualConnection = {0.3, 0.15, 0, 1},
110119
ad_color_previewOk = {0.3, 0.9, 0, 1},
111-
ad_color_previewNotOk = {1, 0.1, 0, 1}
120+
ad_color_previewNotOk = {1, 0.1, 0, 1},
121+
ad_color_textInputBackground = {0.0227, 0.5346, 0.8519, 1} -- Giants original
112122
}
113123

114124
AutoDrive.currentColors = {} -- this will hold the current colors, derived from default colors above, overwritten by local settings
@@ -146,7 +156,7 @@ end
146156

147157
function AutoDrive:restartMySavegame()
148158
if g_server then
149-
restartApplication(" -autoStartSavegameId 1", true)
159+
restartApplication(true, " -autoStartSavegameId 1")
150160
end
151161
end
152162

@@ -252,6 +262,7 @@ function AutoDrive:loadMap(name)
252262

253263
ADMultipleTargetsManager:load()
254264
-- AutoDrive.initTelemetry()
265+
ADBunkerSiloManager:load()
255266

256267
InGameMenuAIFrame.onFrameOpen = Utils.appendedFunction(InGameMenuAIFrame.onFrameOpen, AutoDrive.onAIFrameOpen)
257268
InGameMenuAIFrame.onFrameClose = Utils.appendedFunction(InGameMenuAIFrame.onFrameClose, AutoDrive.onAIFrameClose)
@@ -651,6 +662,7 @@ function AutoDrive:update(dt)
651662
if g_server ~= nil then
652663
ADHarvestManager:update(dt)
653664
ADScheduler:update(dt)
665+
ADBunkerSiloManager:update(dt)
654666
end
655667

656668
ADMessagesManager:update(dt)

scripts/Events/Graph/CreateSplineConnectionEvent.lua

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ function CreateSplineConnectionEvent.emptyNew()
88
return self
99
end
1010

11-
function CreateSplineConnectionEvent.new(start, waypoints, target)
11+
function CreateSplineConnectionEvent.new(start, waypoints, target, dualConnection)
1212
local self = CreateSplineConnectionEvent.emptyNew()
1313
self.start = start
1414
self.waypoints = waypoints
1515
self.target = target
16+
self.dualConnection = dualConnection
1617
return self
1718
end
1819

19-
function CreateSplineConnectionEvent:writeStream(streamId, connection)
20+
function CreateSplineConnectionEvent:writeStream(streamId, connection)
2021
local paramsXZ = g_currentMission.vehicleXZPosCompressionParams
2122
local paramsY = g_currentMission.vehicleYPosCompressionParams
2223

@@ -30,6 +31,7 @@ function CreateSplineConnectionEvent:writeStream(streamId, connection)
3031
end
3132

3233
streamWriteInt32(streamId, self.target)
34+
streamWriteBool(streamId, self.dualConnection)
3335
end
3436

3537
function CreateSplineConnectionEvent:readStream(streamId, connection)
@@ -47,21 +49,22 @@ function CreateSplineConnectionEvent:readStream(streamId, connection)
4749
end
4850

4951
self.target = streamReadInt32(streamId)
52+
self.dualConnection = streamReadBool(streamId)
5053
self:run(connection)
5154
end
5255

5356
function CreateSplineConnectionEvent:run(connection)
5457
if g_server ~= nil and connection:getIsServer() == false then
5558
-- If the event is coming from a client, server have only to broadcast
56-
CreateSplineConnectionEvent.sendEvent(self.start, self.waypoints, self.target)
59+
CreateSplineConnectionEvent.sendEvent(self.start, self.waypoints, self.target, self.dualConnection)
5760
else
5861
-- If the event is coming from the server, both clients and server have to create the way point
59-
ADGraphManager:createSplineConnection(self.start, self.waypoints, self.target, false)
62+
ADGraphManager:createSplineConnection(self.start, self.waypoints, self.target, self.dualConnection, false)
6063
end
6164
end
6265

63-
function CreateSplineConnectionEvent.sendEvent(start, waypoints, target)
64-
local event = CreateSplineConnectionEvent.new(start, waypoints, target)
66+
function CreateSplineConnectionEvent.sendEvent(start, waypoints, target, dualConnection)
67+
local event = CreateSplineConnectionEvent.new(start, waypoints, target, dualConnection)
6568
if g_server ~= nil then
6669
-- Server have to broadcast to all clients and himself
6770
g_server:broadcastEvent(event, true)

scripts/Events/Graph/ToggleConnectionEvent.lua

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,41 @@ function AutoDriveToggleConnectionEvent.emptyNew()
88
return self
99
end
1010

11-
function AutoDriveToggleConnectionEvent.new(startNode, endNode, reverseDirection)
11+
function AutoDriveToggleConnectionEvent.new(startNode, endNode, reverseDirection, dualConnection)
1212
local self = AutoDriveToggleConnectionEvent.emptyNew()
1313
self.startNode = startNode
1414
self.endNode = endNode
1515
self.reverseDirection = reverseDirection
16+
self.dualConnection = dualConnection
1617
return self
1718
end
1819

1920
function AutoDriveToggleConnectionEvent:writeStream(streamId, connection)
2021
streamWriteUIntN(streamId, self.startNode.id, 20)
2122
streamWriteUIntN(streamId, self.endNode.id, 20)
2223
streamWriteBool(streamId, self.reverseDirection)
24+
streamWriteBool(streamId, self.dualConnection)
2325
end
2426

2527
function AutoDriveToggleConnectionEvent:readStream(streamId, connection)
2628
self.startNode = ADGraphManager:getWayPointById(streamReadUIntN(streamId, 20))
2729
self.endNode = ADGraphManager:getWayPointById(streamReadUIntN(streamId, 20))
2830
self.reverseDirection = streamReadBool(streamId)
31+
self.dualConnection = streamReadBool(streamId)
2932
self:run(connection)
3033
end
3134

3235
function AutoDriveToggleConnectionEvent:run(connection)
3336
if g_server ~= nil and connection:getIsServer() == false then
3437
-- If the event is coming from a client, server have only to broadcast
35-
AutoDriveToggleConnectionEvent.sendEvent(self.startNode, self.endNode, self.reverseDirection)
38+
AutoDriveToggleConnectionEvent.sendEvent(self.startNode, self.endNode, self.reverseDirection, self.dualConnection)
3639
else
37-
ADGraphManager:toggleConnectionBetween(self.startNode, self.endNode, self.reverseDirection, false)
40+
ADGraphManager:toggleConnectionBetween(self.startNode, self.endNode, self.reverseDirection, self.dualConnection, false)
3841
end
3942
end
4043

41-
function AutoDriveToggleConnectionEvent.sendEvent(startNode, endNode, reverseDirection)
42-
local event = AutoDriveToggleConnectionEvent.new(startNode, endNode, reverseDirection)
44+
function AutoDriveToggleConnectionEvent.sendEvent(startNode, endNode, reverseDirection, dualConnection)
45+
local event = AutoDriveToggleConnectionEvent.new(startNode, endNode, reverseDirection, dualConnection)
4346
if g_server ~= nil then
4447
-- Server have to broadcast to all clients and himself
4548
g_server:broadcastEvent(event, true)

scripts/Events/HudInputEvent.lua

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ AutoDriveHudInputEventEvent.TYPE_SECOND_MARKER = 2
44
AutoDriveHudInputEventEvent.TYPE_FILLTYPE = 3
55
AutoDriveHudInputEventEvent.TYPE_TOGGLE_FILLTYPE_SELECTION = 4
66
AutoDriveHudInputEventEvent.TYPE_TOGGLE_ALL_FILLTYPE_SELECTIONS = 5
7+
AutoDriveHudInputEventEvent.CHANGE_LOOP_COUNTER = 6
8+
9+
10+
711

812
AutoDriveHudInputEventEvent_mt = Class(AutoDriveHudInputEventEvent, Event)
913

@@ -40,7 +44,7 @@ function AutoDriveHudInputEventEvent:run(connection)
4044
if self.eventType == self.TYPE_FIRST_MARKER then
4145
local currentFirstMarker = self.vehicle.ad.stateModule:getFirstMarkerId()
4246
if currentFirstMarker > 0 and currentFirstMarker ~= self.value then
43-
if not (self.vehicle.spec_combine or AutoDrive.getIsBufferCombine(self.vehicle) or self.vehicle.ad.isCombine ~= nil) then
47+
if not self.vehicle.ad.hasCombine then
4448
-- not stop / change CP for harvesters
4549
AutoDrive:StopCP(self.vehicle)
4650
end
@@ -63,6 +67,11 @@ function AutoDriveHudInputEventEvent:run(connection)
6367
if self.eventType == self.TYPE_TOGGLE_ALL_FILLTYPE_SELECTIONS then
6468
self.vehicle.ad.stateModule:toggleAllFillTypeSelections(self.value)
6569
end
70+
71+
if self.eventType == self.CHANGE_LOOP_COUNTER then
72+
local increment, fast, wheel = ADHudCounterButton.int_to_flags(self.value)
73+
self.vehicle.ad.stateModule:changeLoopCounter(increment, fast, wheel)
74+
end
6675
end
6776
end
6877

@@ -100,3 +109,11 @@ function AutoDriveHudInputEventEvent:sendToggleAllFillTypeSelectionsEvent(vehicl
100109
g_client:getServerConnection():sendEvent(AutoDriveHudInputEventEvent.new(vehicle, self.TYPE_TOGGLE_ALL_FILLTYPE_SELECTIONS, fillTypeId))
101110
end
102111
end
112+
113+
function AutoDriveHudInputEventEvent:sendChangeLoopCounterEvent(vehicle, increment, fast, wheel)
114+
if g_client ~= nil then
115+
-- Client have to send to server
116+
local value = ADHudCounterButton.flags_to_int(increment, fast, wheel)
117+
g_client:getServerConnection():sendEvent(AutoDriveHudInputEventEvent.new(vehicle, self.CHANGE_LOOP_COUNTER, value))
118+
end
119+
end

scripts/Gui/EnterDestinationFilterGUI.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ function ADEnterDestinationFilterGui:onOpen()
2222
ADEnterDestinationFilterGui:superClass().onOpen(self)
2323
self.textInputElement.blockTime = 0
2424
self.textInputElement:onFocusActivate()
25+
if self.textInputElement.overlay and self.textInputElement.overlay.colorFocused then
26+
if AutoDrive.currentColors and AutoDrive.currentColors.ad_color_textInputBackground then
27+
self.textInputElement.overlay.colorFocused = AutoDrive.currentColors.ad_color_textInputBackground
28+
end
29+
end
2530
if g_currentMission.controlledVehicle ~= nil and g_currentMission.controlledVehicle.ad ~= nil then
2631
self.textInputElement:setText(g_currentMission.controlledVehicle.ad.destinationFilterText)
2732
end

0 commit comments

Comments
 (0)