Skip to content

Commit

Permalink
Added some settings and reenabled fruit detection. Release 1.0.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan-S committed Aug 2, 2019
1 parent 8f62e45 commit 07b1d0d
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 9 deletions.
12 changes: 12 additions & 0 deletions FS19_AutoDrive/gui/settingsGui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,16 @@ end;

function adSettingsGui:onCreateAutoDriveSettingRecalculationSpeed(element)
self:onCreateAutoDriveSetting(element, "recalculationSpeed");
end;

function adSettingsGui:onCreateAutoDriveSettingShowNextPath(element)
self:onCreateAutoDriveSetting(element, "showNextPath");
end;

function adSettingsGui:onCreateAutoDriveSettingAvoidFruit(element)
self:onCreateAutoDriveSetting(element, "avoidFruit");
end;

function adSettingsGui:onCreateAutoDriveSettingPathFinderTime(element)
self:onCreateAutoDriveSetting(element, "pathFinderTime");
end;
23 changes: 22 additions & 1 deletion FS19_AutoDrive/gui/settingsGui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,28 @@
<GuiElement type="text" profile="multiTextOptionSettingsText" />
<GuiElement type="text" profile="multiTextOptionSettingsTitle" text="recalculationSpeed" />
<GuiElement type="bitmap" profile="multiTextOptionSettingsBg" />
</GuiElement>
</GuiElement>
<GuiElement type="multiTextOption" profile="multiTextOptionSettings" onCreate="onCreateAutoDriveSettingShowNextPath" toolTipElementId="ingameMenuHelpBoxText" toolTipText="$l10n_gui_ad_showNextPath_tooltip">
<GuiElement type="button" profile="multiTextOptionSettingsLeft" />
<GuiElement type="button" profile="multiTextOptionSettingsRight" />
<GuiElement type="text" profile="multiTextOptionSettingsText" />
<GuiElement type="text" profile="multiTextOptionSettingsTitle" text="showNextPath" />
<GuiElement type="bitmap" profile="multiTextOptionSettingsBg" />
</GuiElement>
<GuiElement type="multiTextOption" profile="multiTextOptionSettings" onCreate="onCreateAutoDriveSettingAvoidFruit" toolTipElementId="ingameMenuHelpBoxText" toolTipText="$l10n_gui_ad_avoidFruit_tooltip">
<GuiElement type="button" profile="multiTextOptionSettingsLeft" />
<GuiElement type="button" profile="multiTextOptionSettingsRight" />
<GuiElement type="text" profile="multiTextOptionSettingsText" />
<GuiElement type="text" profile="multiTextOptionSettingsTitle" text="avoidFruit" />
<GuiElement type="bitmap" profile="multiTextOptionSettingsBg" />
</GuiElement>
<GuiElement type="multiTextOption" profile="multiTextOptionSettings" onCreate="onCreateAutoDriveSettingPathFinderTime" toolTipElementId="ingameMenuHelpBoxText" toolTipText="$l10n_gui_ad_pathFinderTime_tooltip">
<GuiElement type="button" profile="multiTextOptionSettingsLeft" />
<GuiElement type="button" profile="multiTextOptionSettingsRight" />
<GuiElement type="text" profile="multiTextOptionSettingsText" />
<GuiElement type="text" profile="multiTextOptionSettingsTitle" text="pathFinderTime" />
<GuiElement type="bitmap" profile="multiTextOptionSettingsBg" />
</GuiElement>
</GuiElement>

<GuiElement type="bitmap" profile="ingameMenuHelpRowBg" position="80px 50px" id="ingameMenuHelpBox" visible="true">
Expand Down
2 changes: 1 addition & 1 deletion FS19_AutoDrive/modDesc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Créer, ajouter, modifier, supprimer vos routes ou points de destination à l'ai
]]>
</ru>
</description>
<version>1.0.3.6</version>
<version>1.0.3.7</version>
<multiplayer supported="true"/>
<iconFilename>store.dds</iconFilename>
<extraSourceFiles>
Expand Down
10 changes: 6 additions & 4 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.3.6";
AutoDrive.Version = "1.0.3.7";
AutoDrive.config_changed = false;

AutoDrive.directory = g_currentModDirectory;
Expand Down Expand Up @@ -412,9 +412,11 @@ function AutoDrive:onDraw()
end
end;

if self.ad.currentWayPoint > 0 and self.ad.wayPoints ~= nil then
if self.ad.wayPoints[self.ad.currentWayPoint+1] ~= nil then
AutoDrive:drawLine(self.ad.wayPoints[self.ad.currentWayPoint], self.ad.wayPoints[self.ad.currentWayPoint+1], 1, 1, 1, 1);
if AutoDrive:getSetting("showNextPath") == true then
if self.ad.currentWayPoint > 0 and self.ad.wayPoints ~= nil then
if self.ad.wayPoints[self.ad.currentWayPoint+1] ~= nil then
AutoDrive:drawLine(self.ad.wayPoints[self.ad.currentWayPoint], self.ad.wayPoints[self.ad.currentWayPoint+1], 1, 1, 1, 1);
end;
end;
end;

Expand Down
6 changes: 3 additions & 3 deletions FS19_AutoDrive/scripts/AutoDrivePathFinder.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AutoDrive.MAX_PATHFINDER_STEPS_PER_FRAME = 20;
AutoDrive.MAX_PATHFINDER_STEPS_TOTAL = 300;
AutoDrive.MAX_PATHFINDER_STEPS_TOTAL = 400;
AutoDrive.PATHFINDER_TARGET_DISTANCE = 25;
AutoDrive.PATHFINDER_START_DISTANCE = 5;
AutoDrive.PP_UP = 0;
Expand Down Expand Up @@ -211,7 +211,7 @@ function AutoDrivePathFinder:updatePathPlanning(driver)
return;
end;

if pf.steps > AutoDrive.MAX_PATHFINDER_STEPS_TOTAL then
if pf.steps > (AutoDrive.MAX_PATHFINDER_STEPS_TOTAL * AutoDrive:getSetting("pathFinderTime")) then
if not pf.fallBackMode then --look for path through fruit
pf.fallBackMode = true;
pf.steps = 0;
Expand Down Expand Up @@ -475,7 +475,7 @@ function AutoDrivePathFinder:checkGridCell(pf, cell)
--cell.hasCollision = false;
--end;

if pf.ignoreFruit ~= nil and pf.ignoreFruit == false then
if (((pf.ignoreFruit == nil) or (pf.ignoreFruit ~= nil and pf.ignoreFruit == false)) and AutoDrive:getSetting("avoidFruit")) then
if pf.fruitToCheck == nil then
--make async query until fruittype is known
local callBack = PathFinderCallBack:new(pf, cell);
Expand Down
30 changes: 30 additions & 0 deletions FS19_AutoDrive/scripts/AutoDriveSettings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,36 @@ AutoDrive.settings.recalculationSpeed = {
translate= false
};

AutoDrive.settings.showNextPath = {
values= {false, true},
texts= {"gui_ad_no", "gui_ad_yes"},
default= 2,
current= 2,
text= "gui_ad_showNextPath",
tooltip= "gui_ad_showNextPath_tooltip",
translate= true
};

AutoDrive.settings.avoidFruit = {
values= {false, true},
texts= {"gui_ad_no", "gui_ad_yes"},
default= 2,
current= 2,
text= "gui_ad_avoidFruit",
tooltip= "gui_ad_avoidFruit_tooltip",
translate= true
};

AutoDrive.settings.pathFinderTime = {
values= {0.25, 0.5, 1.0, 1.5, 2, 3, 4, 5, 10},
texts= {"x0.25", "x0.5", "x1.0", "x1.5", "x2", "x3", "x4", "x5", "x10"},
default= 3,
current= 3,
text= "gui_ad_pathFinderTime",
tooltip= "gui_ad_pathFinderTime_tooltip",
translate= false
};

function AutoDrive:getSetting(settingName)
if AutoDrive.settings[settingName] ~= nil then
local setting = AutoDrive.settings[settingName]
Expand Down
6 changes: 6 additions & 0 deletions FS19_AutoDrive/translations/translation_de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,11 @@
<text name="gui_ad_smoothField_tooltip" text="Strecken zu/vom Drescher werden geglättet - Experimental" />
<text name="gui_ad_recalculationSpeed" text="Berechnungsgeschwindigkeit" />
<text name="gui_ad_recalculationSpeed_tooltip" text="Höhere Werte können zu einem ruckelnden Spiel führen" />
<text name="gui_ad_showNextPath" text="Zeige nächsten Pfad" />
<text name="gui_ad_showNextPath_tooltip" text="Anzeige der nächsten 2 Wegpunkte an/ausschalten" />
<text name="gui_ad_avoidFruit" text="Fruchtumfahrung" />
<text name="gui_ad_avoidFruit_tooltip" text="Drescherabfahrer versucht möglichst die Frucht zu umfahren" />
<text name="gui_ad_pathFinderTime" text="Pfadfindungs-Dauer (max)" />
<text name="gui_ad_pathFinderTime_tooltip" text="Legt fest wie lange ein Abfahrer nach einer kollisionsfreien Strecke suchen darf. Hohe Werte können das Spiel verlangsamen" />
</texts>
</l10n>
6 changes: 6 additions & 0 deletions FS19_AutoDrive/translations/translation_en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,11 @@
<text name="gui_ad_smoothField_tooltip" text="Generated field courses to and from combine will be smoothed (experimental)" />
<text name="gui_ad_recalculationSpeed" text="Calculation speed" />
<text name="gui_ad_recalculationSpeed_tooltip" text="Higher values will lead to laggy gameplay while recalculating" />
<text name="gui_ad_showNextPath" text="Show next path" />
<text name="gui_ad_showNextPath_tooltip" text="En/Disable the display of the next two waypoints" />
<text name="gui_ad_avoidFruit" text="Avoid fruit" />
<text name="gui_ad_avoidFruit_tooltip" text="Combine unloader tries to avoid fruit destruction" />
<text name="gui_ad_pathFinderTime" text="Pathfinder-time (max)" />
<text name="gui_ad_pathFinderTime_tooltip" text="Determines how long pathfinding algorithm is allowed to seach for collision free path to/from combine. (Potential fps-impact)" />
</texts>
</l10n>
Binary file added releases/1.0.3.7/FS19_AutoDrive.zip
Binary file not shown.

0 comments on commit 07b1d0d

Please sign in to comment.