Skip to content

Commit

Permalink
Release 1.0.2.2
Browse files Browse the repository at this point in the history
-Added pulldown menu for target selection and filltype selection.
   Closes #149
   Closes #120
   Relates to #141
-Added support for 'Umlaute' (ä,ü,ö etc.)
   Closes #127
-Courseplay related:
   -Calling holdForUnloadOrRefill() now, while tractor is on the way or currently being loaded
   -Added nil check as referenced in Courseplay/courseplay#3836
  -Should resolve #135
-Lonely Waypoints are now displayed with an 'X' as if they were a destination, so they can be easily spotted.
   Closes #150
-Improved smoothness when driving through corners.
   Relates to #141
-Messages relating the recalculation now have a smaller showMessageFor timer, so they are updated more frequently
-Unloader may only drive through fruit when the unload process takes place inside the fruit area. Hopefully prevents posible collisions with the combine.
.
  • Loading branch information
Stephan-S committed May 26, 2019
1 parent 33e89d5 commit 2bfd6b1
Show file tree
Hide file tree
Showing 10 changed files with 326 additions and 43 deletions.
2 changes: 1 addition & 1 deletion FS19_AutoDrive/modDesc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Créer, ajouter, modifier, supprimer vos routes ou points de destination à l'ai
]]>
</es>
</description>
<version>1.0.2.1</version>
<version>1.0.2.2</version>
<multiplayer supported="true"/>
<iconFilename>store.dds</iconFilename>
<extraSourceFiles>
Expand Down
23 changes: 21 additions & 2 deletions FS19_AutoDrive/scripts/AutoDrive.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AutoDrive = {};
AutoDrive.Version = "1.0.2.1";
AutoDrive.Version = "1.0.2.2";
AutoDrive.config_changed = false;

AutoDrive.directory = g_currentModDirectory;
Expand Down Expand Up @@ -297,7 +297,19 @@ function init(self)

if self.spec_autodrive == nil then
self.spec_autodrive = AutoDrive;
end;
end;

self.ad.pullDownList = {};
self.ad.pullDownList.active = false;
self.ad.pullDownList.start = false;
self.ad.pullDownList.destination = false;
self.ad.pullDownList.fillType = false;
self.ad.pullDownList.itemList = {};
self.ad.pullDownList.selectedItem = nil;
self.ad.pullDownList.posX = 0;
self.ad.pullDownList.posY = 0;
self.ad.pullDownList.width = 0;
self.ad.pullDownList.height = 0;
end;

function AutoDrive:onLeaveVehicle()
Expand Down Expand Up @@ -471,6 +483,13 @@ function AutoDrive:onDrawCreationMode(vehicle)
end;
end;
end;

if (ADTableLength(point.out) == 0) and (ADTableLength(point.incoming) == 0) then
local node = createTransformGroup("X");
setTranslation(node, point.x, point.y + 4 , point.z );
DebugUtil.drawDebugNode(node,"X");
end;

end;

for markerID,marker in pairs(AutoDrive.mapMarker) do
Expand Down
7 changes: 6 additions & 1 deletion FS19_AutoDrive/scripts/AutoDriveCombineMode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ AutoDrive.UNLOAD_WAIT_TIMER = 15000;
function AutoDrive:handleCombineHarvester(vehicle, dt)
if vehicle.ad.currentDriver ~= nil then
vehicle.ad.driverOnTheWay = true;
vehicle.ad.tryingToCallDriver = false;
vehicle.ad.tryingToCallDriver = false;
if (vehicle.ad.currentDriver.ad.combineUnloadInFruitWaitTimer >= AutoDrive.UNLOAD_WAIT_TIMER) then
if vehicle.cp and vehicle.cp.driver and vehicle.cp.driver.holdForUnloadOrRefill then
vehicle.cp.driver:holdForUnloadOrRefill();
end;
end;
return;
end;

Expand Down
19 changes: 19 additions & 0 deletions FS19_AutoDrive/scripts/AutoDriveDriveFuncs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ function AutoDrive:handlePrintMessage(vehicle, dt)
AutoDrive.print.currentMessage = nil;
AutoDrive.print.currentMessageActiveSince = 0;
AutoDrive.print.referencedVehicle = nil;
AutoDrive.print.showMessageFor = 12000;
end;
else
if AutoDrive.print.nextMessage ~= nil then
Expand Down Expand Up @@ -183,11 +184,17 @@ function AutoDrive:initializeAD(vehicle, dt)
local closest = AutoDrive:findMatchingWayPointForVehicle(vehicle);
if vehicle.ad.skipStart == true then
vehicle.ad.skipStart = false;
if AutoDrive.mapMarker[vehicle.ad.mapMarkerSelected_Unload] == nil then
return;
end;
vehicle.ad.wayPoints = AutoDrive:FastShortestPath(AutoDrive.mapWayPoints, closest, AutoDrive.mapMarker[vehicle.ad.mapMarkerSelected_Unload].name, AutoDrive.mapMarker[vehicle.ad.mapMarkerSelected_Unload].id);
vehicle.ad.wayPointsChanged = true;
vehicle.ad.unloadSwitch = true;
vehicle.ad.combineState = AutoDrive.DRIVE_TO_UNLOAD_POS;
else
if AutoDrive.mapMarker[vehicle.ad.mapMarkerSelected] == nil then
return;
end;
vehicle.ad.wayPoints = AutoDrive:FastShortestPath(AutoDrive.mapWayPoints, closest, AutoDrive.mapMarker[vehicle.ad.mapMarkerSelected].name, vehicle.ad.targetSelected);
vehicle.ad.wayPointsChanged = true;
end;
Expand Down Expand Up @@ -385,6 +392,18 @@ function AutoDrive:driveToNextWayPoint(vehicle, dt)
finalSpeed = finalSpeed / 2;
end;

if vehicle.ad.lastUsedSpeed == nil then
vehicle.ad.lastUsedSpeed = finalSpeed;
end;

if finalSpeed > vehicle.ad.lastUsedSpeed then
finalSpeed = math.min(vehicle.ad.lastUsedSpeed + (dt/1000)*5, finalSpeed);
elseif finalSpeed < vehicle.ad.lastUsedSpeed then
finalSpeed = math.max(vehicle.ad.lastUsedSpeed - (dt/1000)*5, finalSpeed);
end;

vehicle.ad.lastUsedSpeed = finalSpeed;

local acceleration = 1;
if vehicle.ad.trafficDetected == true then
AutoDrive:getVehicleToStop(vehicle, false, dt);
Expand Down
5 changes: 5 additions & 0 deletions FS19_AutoDrive/scripts/AutoDriveGraphHandling.lua
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,15 @@ function AutoDrive:handleRecalculation(vehicle)
AutoDrive.Recalculation.nextCalculationSkipFrames = 0;

AutoDrive:printMessage(vehicle, g_i18n:getText("AD_Recalculationg_routes_status") .. " " .. AutoDrive.recalculationPercentage .. "%");
AutoDrive.print.showMessageFor = 500;
if AutoDrive.recalculationPercentage == 100 then
AutoDrive.print.showMessageFor = 12000;
end;
else
AutoDrive.Recalculation.nextCalculationSkipFrames = AutoDrive.Recalculation.nextCalculationSkipFrames - 1;
end;
end;

end;
end;

Expand Down
Loading

1 comment on commit 2bfd6b1

@Anonymous-any
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, just a thing I've posted yesterday on CP it seem I was wrong for CP pipe accusation ^^.
Also Courseplay/courseplay#3820 (comment)
AD won't open the cover.
Thank for all Stephan Grt !

Please sign in to comment.