From db66eada0228b5e02eec40599bb84054c48eb788 Mon Sep 17 00:00:00 2001
From: schwiti6190 <58079399+schwiti6190@users.noreply.github.com>
Date: Tue, 20 Apr 2021 12:22:03 +0200
Subject: [PATCH 1/3] Diff fixes
- small action event improvements.
- added a global setting to disable action event texts.
- fixes #7051, #6810, #6611
---
AIDriver.lua | 6 ++++
ActionEventsLoader.lua | 35 +++++++++++-------
CpManager.lua | 64 +++++++++++++++++----------------
GlobalSettings.lua | 19 ++++++++++
OverloaderAIDriver.lua | 26 ++++++++++++--
base.lua | 10 ++++++
config/ActionEventsConfig.xml | 24 +++++++------
courseeditor.lua | 2 +-
gui/GlobalSettingsPage.xml | 7 ++--
helpers.lua | 12 +++++--
settings.lua | 10 ++++++
translations/translation_br.xml | 3 ++
translations/translation_cs.xml | 3 ++
translations/translation_cz.xml | 3 ++
translations/translation_de.xml | 6 ++--
translations/translation_en.xml | 3 ++
translations/translation_es.xml | 3 ++
translations/translation_fr.xml | 3 ++
translations/translation_hu.xml | 3 ++
translations/translation_it.xml | 3 ++
translations/translation_jp.xml | 3 ++
translations/translation_nl.xml | 3 ++
translations/translation_pl.xml | 3 ++
translations/translation_pt.xml | 3 ++
translations/translation_ru.xml | 3 ++
translations/translation_sl.xml | 3 ++
26 files changed, 197 insertions(+), 66 deletions(-)
diff --git a/AIDriver.lua b/AIDriver.lua
index bccdc8d11..fb66a2835 100644
--- a/AIDriver.lua
+++ b/AIDriver.lua
@@ -184,6 +184,12 @@ function AIDriver:init(vehicle)
self.triggerHandler:enableFuelLoading()
end
+---This function is called once on the first update tick,
+---for post setup possibilities.
+function AIDriver:postInit()
+
+end
+
function AIDriver:updateLoadingText()
local fillableObject = self.triggerHandler.fillableObject
if fillableObject then
diff --git a/ActionEventsLoader.lua b/ActionEventsLoader.lua
index 06d5d1721..66203fecb 100644
--- a/ActionEventsLoader.lua
+++ b/ActionEventsLoader.lua
@@ -10,6 +10,7 @@ ActionEventsLoader.actionEventAttributes = {
{name = 'callbackState', getXmlFunction = getXMLInt},
{name = 'isDisabledCallbackFunc', getXmlFunction = getXMLString},
{name = 'text', getXmlFunction = getXMLString},
+ {name = 'textVisibilityNeeded', getXmlFunction = getXMLBool},
}
---All the setting action events attributes
@@ -21,6 +22,7 @@ ActionEventsLoader.settingActionEventAttributes = {
{name = 'callbackState', getXmlFunction = getXMLInt},
{name = 'isDisabledCallbackFunc', getXmlFunction = getXMLString},
{name = 'text', getXmlFunction = getXMLString},
+ {name = 'textVisibilityNeeded', getXmlFunction = getXMLBool},
}
---String to class reference, only for global classes.
@@ -172,18 +174,18 @@ function ActionEventsLoader.registerGlobalActionEvents()
local actionEventCallback = ActionEventsLoaderUtil.getActionEventCallback(actionEventData,class)
local actionEventText = ActionEventsLoaderUtil.getActionEventText(actionEventData)
-
+ local actionEventTextVisible = ActionEventsLoaderUtil.isActionEventTextVisible(actionEventData,vehicle)
local isDisabled = ActionEventsLoaderUtil.getActionEventIsDisabled(actionEventData,class,classParameter)
- courseplay.debugFormat(courseplay.DBG_HUD,"Register action event: name= %s, text= %s, isDisabled= %s",
- actionEventName, courseplay:loc(actionEventText), tostring(isDisabled))
-
+ courseplay.debugFormat(courseplay.DBG_HUD,"Register action event: name= %s, text= %s, isDisabled= %s, isVisible:%s",
+ actionEventName, courseplay:loc(actionEventText), tostring(isDisabled),tostring(actionEventTextVisible))
+
---Registers an action event.
local _, eventId = g_inputBinding:registerActionEvent(actionEventName, class, actionEventCallback, false, true, false, true,actionEventData.callbackState)
g_inputBinding:setActionEventTextPriority(eventId, GS_PRIO_HIGH)
g_inputBinding:setActionEventText(eventId, courseplay:loc(actionEventText))
g_inputBinding:setActionEventActive(eventId, not isDisabled)
-
+ g_inputBinding:setActionEventTextVisibility(eventId,actionEventTextVisible)
ActionEventsLoader.globalActionEventNameToID[actionEventName] = eventId
end
@@ -208,11 +210,11 @@ function ActionEventsLoader.registerActionEvent(actionEventData,vehicle,isSettin
end
local actionEventCallback = ActionEventsLoaderUtil.getActionEventCallback(actionEventData,class)
local actionEventText = ActionEventsLoaderUtil.getActionEventText(actionEventData)
-
+ local actionEventTextVisible = ActionEventsLoaderUtil.isActionEventTextVisible(actionEventData,vehicle)
local isDisabled = ActionEventsLoaderUtil.getActionEventIsDisabled(actionEventData,class,classParameter)
- courseplay.debugVehicle(courseplay.DBG_HUD,vehicle,"Register action event: name= %s, text= %s, isDisabled= %s",
- actionEventName, courseplay:loc(actionEventText), tostring(isDisabled))
+ courseplay.debugVehicle(courseplay.DBG_HUD,vehicle,"Register action event: name= %s, text= %s, isDisabled= %s, isVisible:%s",
+ actionEventName, courseplay:loc(actionEventText), tostring(isDisabled),tostring(actionEventTextVisible))
---Registers an action event into the vehicle.
local _, eventId = vehicle:addActionEvent(vehicle.cpActionEvents,actionEventName, classParameter, actionEventCallback, true, false, false, true,actionEventData.callbackState)
@@ -220,6 +222,7 @@ function ActionEventsLoader.registerActionEvent(actionEventData,vehicle,isSettin
---Display text in the F1 window in the top left.
g_inputBinding:setActionEventText(eventId, courseplay:loc(actionEventText))
g_inputBinding:setActionEventActive(eventId, not isDisabled)
+ g_inputBinding:setActionEventTextVisibility(eventId,actionEventTextVisible)
---addActionEvent( action event table, action event name, action event class,
--- callback function, trigger key up, trigger key down, trigger always,
--- is active, callback state, action event icon)
@@ -236,6 +239,7 @@ function ActionEventsLoader.updateActionEvents(actionEvents,actionEventsNameToID
for _,actionEventData in ipairs(actionEvents) do
local actionEventName = ActionEventsLoaderUtil.getActionEventName(actionEventData)
local actionEventText = ActionEventsLoaderUtil.getActionEventText(actionEventData)
+ local actionEventTextVisible = ActionEventsLoaderUtil.isActionEventTextVisible(actionEventData,vehicle)
local actionEvent = InputAction[actionEventName] and actionEventsNameToID[InputAction[actionEventName]]
if actionEvent then
local class,classParameter
@@ -250,14 +254,15 @@ function ActionEventsLoader.updateActionEvents(actionEvents,actionEventsNameToID
local isDisabled = ActionEventsLoaderUtil.getActionEventIsDisabled(actionEventData,class,classParameter)
if vehicle then
- courseplay.debugVehicle(courseplay.DBG_HUD,vehicle,"Update action event: name= %s, text= %s, isDisabled= %s",
- actionEventName, courseplay:loc(actionEventText), tostring(isDisabled))
+ courseplay.debugVehicle(courseplay.DBG_HUD,vehicle,"Update action event: name= %s, text= %s, isDisabled= %s, isVisible:%s",
+ actionEventName, courseplay:loc(actionEventText), tostring(isDisabled),tostring(actionEventTextVisible))
else
- courseplay.debugFormat(courseplay.DBG_HUD,"Update action event: name= %s, text= %s, isDisabled= %s",
- actionEventName, courseplay:loc(actionEventText), tostring(isDisabled))
+ courseplay.debugFormat(courseplay.DBG_HUD,"Update action event: name= %s, text= %s, isDisabled= %s, isVisible:%s",
+ actionEventName, courseplay:loc(actionEventText), tostring(isDisabled),tostring(actionEventTextVisible))
end
---Enable/disable the action event
g_inputBinding:setActionEventActive(actionEvent.actionEventId, not isDisabled)
+ g_inputBinding:setActionEventTextVisibility(actionEvent.actionEventId,actionEventTextVisible)
end
end
end
@@ -323,6 +328,12 @@ function ActionEventsLoaderUtil.getActionEventText(actionEventData)
return actionEventData.text or ActionEventsLoader.textPrefix..actionEventData.name
end
+---Needs the action event text to be visible?
+---@param table actionEventData from the config xml
+function ActionEventsLoaderUtil.isActionEventTextVisible(actionEventData)
+ return courseplay.globalSettings.showActionEventsTexts:get() or actionEventData.textVisibilityNeeded
+end
+
---Is the action event disabled ?
---Defaults to class.isDisabled , if the is disabled callback function is not defined or it is always enabled
---@param table actionEventData from the config xml
diff --git a/CpManager.lua b/CpManager.lua
index 21685f7f3..27af4cdd6 100644
--- a/CpManager.lua
+++ b/CpManager.lua
@@ -26,11 +26,13 @@ function CpManager:loadMap(name)
self.cpCoursesFolderPath = ("%s%s/%s"):format(getUserProfileAppPath(),"CoursePlay_Courses", g_currentMission.missionInfo.mapId);
self.cpCourseManagerXmlFilePath = self.cpCoursesFolderPath .. "/courseManager.xml";
self.cpCourseStorageXmlFileTemplate = "courseStorage%04d.xml";
- self.cpDebugPrintXmlFilePath = string.format("%s%s",getUserProfileAppPath(),"courseplayDebugPrint.xml")
+ self.cpDebugPrintXmlFolderPath = string.format("%s%s",getUserProfileAppPath(),"courseplayDebugPrint")
+ self.cpDebugPrintXmlFilePathDefault = string.format("%s/%s",self.cpDebugPrintXmlFolderPath,"courseplayDebugPrint.xml")
+ createFolder(self.cpDebugPrintXmlFolderPath)
+
-- we need to create CoursePlay_Courses folder before we can create any new folders inside it.
createFolder(("%sCoursePlay_Courses"):format(getUserProfileAppPath()));
createFolder(self.cpCoursesFolderPath);
-
-- Add / at end of path, so we dont save that in the courseManager.xml (Needs to be done after folder creation!)
self.cpCoursesFolderPath = self.cpCoursesFolderPath .. "/";
end
@@ -104,6 +106,7 @@ function CpManager:loadMap(name)
addConsoleCommand('cpStopAll', 'Stop all Courseplayers', 'devStopAll', self);
addConsoleCommand( 'cpSaveAllFields', 'Save all fields', 'devSaveAllFields', self )
addConsoleCommand( 'print', 'Print a variable', 'printVariable', self )
+ addConsoleCommand( 'printGlobalCpVariable', 'Print a global cp variable', 'printGlobalCpVariable', self )
addConsoleCommand( 'printVehicleVariable', 'Print g_currentMission.controlledVehicle.variable', 'printVehicleVariable', self )
addConsoleCommand( 'printDriverVariable', 'Print g_currentMission.controlledVehicle.cp.driver.variable', 'printDriverVariable', self )
addConsoleCommand( 'printSettingVariable', 'Print g_currentMission.controlledVehicle.cp.settings.variable', 'printSettingVariable', self )
@@ -550,13 +553,14 @@ function CpManager:devSaveAllFields()
return( 'All fields saved' )
end
---- Print a global variable
--- @param string variableName name of the variable, can be multiple levels
--- @param int depth maximum depth, 1 by default
--- @param int printToXML and printToXML>0 => printing variable to xmlFile
-function CpManager:printVariable(variableName, maxDepth,printToXML, printShortVersion)
+---Prints a variable to the console or a xmlFile.
+---@param string variableName name of the variable, can be multiple levels
+---@param int depth maximum depth, 1 by default
+---@param int printToXML: should the variable be printed to an xml file ? (optional)
+---@param int printToSeparateXmlFiles: should the variable be printed to an xml file named after the variable ? (optional)
+function CpManager:printVariable(variableName, maxDepth,printToXML, printToSeparateXmlFiles)
if printToXML and tonumber(printToXML) and tonumber(printToXML)>0 then
- HelperUtil.printVariableToXML(variableName, maxDepth)
+ HelperUtil.printVariableToXML(variableName, maxDepth,printToSeparateXmlFiles)
return
end
print(string.format('%s - %s', tostring(variableName), tostring(maxDepth)))
@@ -566,17 +570,11 @@ function CpManager:printVariable(variableName, maxDepth,printToXML, printShortVe
if value then
print(string.format('Printing %s (%s), depth %d', variableName, valueType, depth))
if valueType == 'table' then
- if not printShortVersion then
- DebugUtil.printTableRecursively(value, ' ', 1, depth)
- local mt = getmetatable(value)
- if mt and type(mt) == 'table' then
- print('-- metatable -->')
- DebugUtil.printTableRecursively(mt, ' ', 1, depth)
- end
- else
- --courseplay:printMeThisTable(table,level,maxlevel,upperPath)
- courseplay.alreadyPrinted = {}
- courseplay:printMeThisTable(value,0,depth,variableName)
+ DebugUtil.printTableRecursively(value, ' ', 1, depth)
+ local mt = getmetatable(value)
+ if mt and type(mt) == 'table' then
+ print('-- metatable -->')
+ DebugUtil.printTableRecursively(mt, ' ', 1, depth)
end
else
print(variableName .. ': ' .. tostring(value))
@@ -591,33 +589,37 @@ end
--- Print the variable in the selected vehicle's namespace
-- You can omit the dot for data members but if you want to call a function, you must start the variable name with a colon
-function CpManager:printVehicleVariable(variableName, maxDepth, printToXML)
- self:printVariableInternal( 'g_currentMission.controlledVehicle', variableName, maxDepth, printToXML)
+function CpManager:printVehicleVariable(variableName, maxDepth, printToXML,printToSeparateXmlFiles)
+ self:printVariableInternal( 'g_currentMission.controlledVehicle', variableName, maxDepth, printToXML,printToSeparateXmlFiles)
+end
+
+function CpManager:printDriverVariable(variableName, maxDepth, printToXML,printToSeparateXmlFiles)
+ self:printVariableInternal( 'g_currentMission.controlledVehicle.cp.driver', variableName, maxDepth, printToXML,printToSeparateXmlFiles)
end
-function CpManager:printDriverVariable(variableName, maxDepth, printToXML)
- self:printVariableInternal( 'g_currentMission.controlledVehicle.cp.driver', variableName, maxDepth, printToXML)
+function CpManager:printSettingVariable(variableName, maxDepth, printToXML,printToSeparateXmlFiles)
+ self:printVariableInternal( 'g_currentMission.controlledVehicle.cp.settings', variableName, maxDepth, printToXML,printToSeparateXmlFiles)
end
-function CpManager:printSettingVariable(variableName, maxDepth, printToXML)
- self:printVariableInternal( 'g_currentMission.controlledVehicle.cp.settings', variableName, maxDepth, printToXML)
+function CpManager:printCourseGeneratorSettingVariable(variableName, maxDepth, printToXML,printToSeparateXmlFiles)
+ self:printVariableInternal( 'g_currentMission.controlledVehicle.cp.courseGeneratorSettings', variableName, maxDepth, printToXML,printToSeparateXmlFiles)
end
-function CpManager:printCourseGeneratorSettingVariable(variableName, maxDepth, printToXML)
- self:printVariableInternal( 'g_currentMission.controlledVehicle.cp.courseGeneratorSettings', variableName, maxDepth, printToXML)
+function CpManager:printGlobalSettingVariable(variableName, maxDepth, printToXML,printToSeparateXmlFiles)
+ self:printVariableInternal( 'courseplay.courseplay.globalSettings', variableName, maxDepth, printToXML,printToSeparateXmlFiles)
end
-function CpManager:printGlobalSettingVariable(variableName, maxDepth, printToXML)
- self:printVariableInternal( 'courseplay.courseplay.globalSettings', variableName, maxDepth, printToXML)
+function CpManager:printGlobalCpVariable(variableName, maxDepth, printToXML,printToSeparateXmlFiles)
+ self:printVariableInternal( 'courseplay', variableName, maxDepth, printToXML,printToSeparateXmlFiles)
end
-function CpManager:printVariableInternal(prefix, variableName, maxDepth,printToXML)
+function CpManager:printVariableInternal(prefix, variableName, maxDepth,printToXML,printToSeparateXmlFiles)
if not StringUtil.startsWith(variableName, ':') and not StringUtil.startsWith(variableName, '.') then
-- allow to omit the . at the beginning of the variable name.
prefix = prefix .. '.'
end
- self:printVariable(prefix .. variableName, maxDepth,printToXML)
+ self:printVariable(prefix .. variableName, maxDepth,printToXML,printToSeparateXmlFiles)
end
diff --git a/GlobalSettings.lua b/GlobalSettings.lua
index e9f5dd097..6c29590d9 100644
--- a/GlobalSettings.lua
+++ b/GlobalSettings.lua
@@ -63,6 +63,25 @@ function ShowMiniHudSetting:init()
self:set(false)
end
+---@class ShowActionEventTextsSetting : BooleanSetting
+ShowActionEventTextsSetting = CpObject(BooleanSetting)
+function ShowActionEventTextsSetting:init()
+ BooleanSetting.init(self, 'showActionEventsTexts', 'COURSEPLAY_SHOW_ACTION_EVENTS_TEXTS',
+ 'COURSEPLAY_SHOW_ACTION_EVENTS_TEXTS_TOOLTIP', nil)
+ -- set default while we are transitioning from the the old setting to this new one
+ self:set(true)
+end
+
+---On setting change, make sure the current entered vehicle gets updated.
+function ShowActionEventTextsSetting:onChange()
+ if g_currentMission then
+ local vehicle = g_currentMission.controlledVehicle
+ if vehicle ~= nil then
+ ActionEventsLoader.updateAllActionEvents(vehicle)
+ end
+ end
+end
+
---@class AutoRepairSetting : SettingList
AutoRepairSetting = CpObject(SettingList)
diff --git a/OverloaderAIDriver.lua b/OverloaderAIDriver.lua
index 053c9f23c..b17fc4fd9 100644
--- a/OverloaderAIDriver.lua
+++ b/OverloaderAIDriver.lua
@@ -26,6 +26,9 @@ OverloaderAIDriver.myStates = {
OVERLOADING = {},
}
+OverloaderAIDriver.MIN_SPEED_UNLOAD_COURSE = 10
+
+
function OverloaderAIDriver:init(vehicle)
--there seems to be a bug, where "vehicle" is not always set once start is pressed
CombineUnloadAIDriver.init(self, vehicle)
@@ -37,6 +40,13 @@ function OverloaderAIDriver:init(vehicle)
self.nearOverloadPoint = false
end
+function OverloaderAIDriver:postInit()
+ ---Refresh the Hud content here,as otherwise the moveable pipe is not
+ ---detected the first time after loading a savegame.
+ self:setHudContent()
+ CombineUnloadAIDriver.postInit(self)
+end
+
function OverloaderAIDriver:findPipeAndTrailer()
local implementWithPipe = AIDriverUtil.getImplementWithSpecialization(self.vehicle, Pipe)
if implementWithPipe then
@@ -145,13 +155,13 @@ end
function OverloaderAIDriver:onWaypointChange(ix)
-- this is called when the next wp changes, that is well before we get there
-- save it in a variable to avoid the relatively expensive hasWaitPointWithinDistance to be called too often
- self.nearOverloadPoint = self.course:hasWaitPointWithinDistance(ix, 30)
+ self.nearOverloadPoint,self.closestOverloadPointIx = self.course:hasWaitPointWithinDistance(ix, 30)
CombineUnloadAIDriver.onWaypointChange(self, ix)
end
function OverloaderAIDriver:onWaypointPassed(ix)
-- just in case...
- self.nearOverloadPoint = self.course:hasWaitPointWithinDistance(ix, 30)
+ self.nearOverloadPoint, self.closestOverloadPointIx = self.course:hasWaitPointWithinDistance(ix, 30)
if self.course:isWaitAt(ix) then
if self:isTrailerEmpty() then
self:debug('Wait point reached but my trailer is empty, continuing')
@@ -164,6 +174,18 @@ function OverloaderAIDriver:onWaypointPassed(ix)
end
end
+function OverloaderAIDriver:getSpeed()
+
+ local defaultSpeed = CombineUnloadAIDriver.getSpeed(self)
+
+ if self.unloadCourseState == self.states.ENROUTE and self.closestOverloadPointIx then
+ local distToWaitPoint = self.course:getDistanceBetweenVehicleAndWaypoint(self.vehicle,self.closestOverloadPointIx)
+ return MathUtil.clamp(distToWaitPoint, self.MIN_SPEED_UNLOAD_COURSE, defaultSpeed)
+ else
+ return defaultSpeed
+ end
+end
+
function OverloaderAIDriver:isTrailerEmpty()
if self.trailer and self.trailer.getFillUnits then
for _, fillUnit in pairs(self.trailer:getFillUnits()) do
diff --git a/base.lua b/base.lua
index 62ae3999f..a86f6bda2 100644
--- a/base.lua
+++ b/base.lua
@@ -585,6 +585,16 @@ function courseplay:onUpdate(dt)
self.cp.infoText = nil
end
+ if self.cp.firstRun == nil then
+ if self.cp.driver then
+ ---Post init function, as not all giants variables are
+ ---set correctly at the first courseplay:setAIDriver() call.
+ self.cp.driver:postInit()
+ self.cp.firstRun = true
+ end
+ end
+
+
if self.cp.drawCourseMode == courseplay.COURSE_2D_DISPLAY_DBGONLY or self.cp.drawCourseMode == courseplay.COURSE_2D_DISPLAY_BOTH then
courseplay:drawWaypointsLines(self);
end;
diff --git a/config/ActionEventsConfig.xml b/config/ActionEventsConfig.xml
index a455385f1..59c329b42 100644
--- a/config/ActionEventsConfig.xml
+++ b/config/ActionEventsConfig.xml
@@ -16,6 +16,7 @@
isDisabledCallbackFunc: is used to disable a action event after a action event refresh or on load.
callbackState: isDisabledCallbackFunc parameter, this is an int!
text: is the action event text, by default it returns courseplay:loc(name), where 'name' is the previous defined action event name.
+ textVisibilityNeeded: Is disabling action event text forbidden ? (default: false)
-->
@@ -32,17 +33,17 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -55,6 +56,7 @@
isDisabledCallbackFunc: is used to disable a action event after a action event refresh or on load optional, default is setting:isDisabled().
callbackState: isDisabledCallbackFunc parameter, this is an int!
text: is the action event text, by default it returns courseplay:loc(name), where 'name' is the previous defined action event name.
+ textVisibilityNeeded: Is disabling action event text forbidden ? (default: false)
-->
diff --git a/courseeditor.lua b/courseeditor.lua
index 82b8b9e9c..c4827422e 100644
--- a/courseeditor.lua
+++ b/courseeditor.lua
@@ -174,7 +174,7 @@ function courseEditor.setEnabledActionEvent(vehicle)
end
function courseEditor.getIsNotAllowedToUse(vehicle)
- return vehicle.cp.isRecording or courseEditor:isAutoDriveCourse(vehicle) or #vehicle.Waypoints == 0
+ return vehicle.cp.isRecording or vehicle:getIsCourseplayDriving() or courseEditor:isAutoDriveCourse(vehicle) or #vehicle.Waypoints == 0
end
function courseEditor:getIsDisabled()
diff --git a/gui/GlobalSettingsPage.xml b/gui/GlobalSettingsPage.xml
index 405880770..1a2b55ab0 100644
--- a/gui/GlobalSettingsPage.xml
+++ b/gui/GlobalSettingsPage.xml
@@ -63,8 +63,7 @@
-
-
+
@@ -80,15 +79,13 @@
-
\ No newline at end of file
diff --git a/helpers.lua b/helpers.lua
index 1a02c1341..d7822f908 100644
--- a/helpers.lua
+++ b/helpers.lua
@@ -1227,9 +1227,17 @@ end
---Prints a global variable to an xml File.
---@param int/float/.. global variable to print to xmlFile
---@param int maxDepth represent the max iterations
-function HelperUtil.printVariableToXML(variableName, maxDepth)
+function HelperUtil.printVariableToXML(variableName, maxDepth,printToSeparateXmlFiles)
local baseKey = 'CpDebugPrint'
- local xmlFile = createXMLFile("xmlFile", CpManager.cpDebugPrintXmlFilePath, baseKey);
+ local xmlFile
+ if printToSeparateXmlFiles and tonumber(printToSeparateXmlFiles)>0 then
+ local fileName = string.gsub(variableName,":","_")..".xml"
+ -- fileName = string.gsub(fileName,":","_")
+ local filePath = string.format("%s/%s",CpManager.cpDebugPrintXmlFolderPath,fileName)
+ xmlFile = createXMLFile("xmlFile",filePath, baseKey);
+ else
+ xmlFile = createXMLFile("xmlFile", CpManager.cpDebugPrintXmlFilePathDefault, baseKey);
+ end
local xmlFileValid = xmlFile and xmlFile ~= 0 or false
if not xmlFileValid then
courseplay.error("Xml File not valid!")
diff --git a/settings.lua b/settings.lua
index f0350998c..1b5846f2e 100644
--- a/settings.lua
+++ b/settings.lua
@@ -3807,6 +3807,15 @@ function WorkingToolPositionsSetting:onLoad(savegame)
end
Cylindered.onLoad = Utils.appendedFunction(Cylindered.onLoad,WorkingToolPositionsSetting.onLoad)
+---Disabled cylinder control of frontloaders, moveable pipes and so on..., while CP is driving.
+function WorkingToolPositionsSetting.actionEventInputCylindered(object,superFunc, actionName, inputValue, callbackState, isAnalog, isMouse)
+ local rootVehicle = object:getRootVehicle()
+ if not rootVehicle:getIsCourseplayDriving() then
+ return superFunc(object, actionName, inputValue, callbackState, isAnalog, isMouse)
+ end
+end
+Cylindered.actionEventInput = Utils.overwrittenFunction(Cylindered.actionEventInput,WorkingToolPositionsSetting.actionEventInputCylindered)
+
---@class FrontloaderToolPositionsSetting : WorkingToolPositionsSetting
FrontloaderToolPositionsSetting = CpObject(WorkingToolPositionsSetting)
function FrontloaderToolPositionsSetting:init(vehicle)
@@ -4055,6 +4064,7 @@ function SettingsContainer.createGlobalSettings()
container:addSetting(EnableOpenHudWithMouseGlobalSetting)
container:addSetting(AutoRepairSetting)
container:addSetting(ShowMapHotspotSetting)
+ container:addSetting(ShowActionEventTextsSetting)
return container
end
diff --git a/translations/translation_br.xml b/translations/translation_br.xml
index 4bc2e204c..a67c48170 100644
--- a/translations/translation_br.xml
+++ b/translations/translation_br.xml
@@ -474,6 +474,9 @@
+
+
+
diff --git a/translations/translation_cs.xml b/translations/translation_cs.xml
index 54e3cc2de..c35c761cb 100644
--- a/translations/translation_cs.xml
+++ b/translations/translation_cs.xml
@@ -475,6 +475,9 @@
+
+
+
diff --git a/translations/translation_cz.xml b/translations/translation_cz.xml
index 48ecd9246..ecbfc8a6b 100644
--- a/translations/translation_cz.xml
+++ b/translations/translation_cz.xml
@@ -478,6 +478,9 @@
+
+
+
diff --git a/translations/translation_de.xml b/translations/translation_de.xml
index 99b52966f..79e037c3a 100644
--- a/translations/translation_de.xml
+++ b/translations/translation_de.xml
@@ -475,6 +475,9 @@
+
+
+
@@ -514,8 +517,7 @@
-
-
+
diff --git a/translations/translation_en.xml b/translations/translation_en.xml
index 44cd06439..fb16ab4aa 100644
--- a/translations/translation_en.xml
+++ b/translations/translation_en.xml
@@ -474,6 +474,9 @@
+
+
+
diff --git a/translations/translation_es.xml b/translations/translation_es.xml
index b2cabc4f3..c5137ccc6 100644
--- a/translations/translation_es.xml
+++ b/translations/translation_es.xml
@@ -473,6 +473,9 @@
+
+
+
diff --git a/translations/translation_fr.xml b/translations/translation_fr.xml
index e05da4d86..f63241b89 100644
--- a/translations/translation_fr.xml
+++ b/translations/translation_fr.xml
@@ -477,6 +477,9 @@
+
+
+
diff --git a/translations/translation_hu.xml b/translations/translation_hu.xml
index 446fd6cd6..1ea78a5dd 100644
--- a/translations/translation_hu.xml
+++ b/translations/translation_hu.xml
@@ -473,6 +473,9 @@
+
+
+
diff --git a/translations/translation_it.xml b/translations/translation_it.xml
index cdc127330..92c4993ee 100644
--- a/translations/translation_it.xml
+++ b/translations/translation_it.xml
@@ -475,6 +475,9 @@
+
+
+
diff --git a/translations/translation_jp.xml b/translations/translation_jp.xml
index d07f675ee..5992f35ff 100644
--- a/translations/translation_jp.xml
+++ b/translations/translation_jp.xml
@@ -475,6 +475,9 @@
+
+
+
diff --git a/translations/translation_nl.xml b/translations/translation_nl.xml
index 04ed53a74..088714f13 100644
--- a/translations/translation_nl.xml
+++ b/translations/translation_nl.xml
@@ -473,6 +473,9 @@
+
+
+
diff --git a/translations/translation_pl.xml b/translations/translation_pl.xml
index 24620c84c..7fe2d6b4c 100644
--- a/translations/translation_pl.xml
+++ b/translations/translation_pl.xml
@@ -476,6 +476,9 @@
+
+
+
diff --git a/translations/translation_pt.xml b/translations/translation_pt.xml
index 1a9e96844..23e638a62 100644
--- a/translations/translation_pt.xml
+++ b/translations/translation_pt.xml
@@ -473,6 +473,9 @@
+
+
+
diff --git a/translations/translation_ru.xml b/translations/translation_ru.xml
index f00286556..e4d8c6083 100644
--- a/translations/translation_ru.xml
+++ b/translations/translation_ru.xml
@@ -476,6 +476,9 @@
+
+
+
diff --git a/translations/translation_sl.xml b/translations/translation_sl.xml
index 324cdc481..2c84ad814 100644
--- a/translations/translation_sl.xml
+++ b/translations/translation_sl.xml
@@ -476,6 +476,9 @@
+
+
+
From 06bfb957d2ca8f140c999e5f29bb7aa8148bcb83 Mon Sep 17 00:00:00 2001
From: schwiti6190 <58079399+schwiti6190@users.noreply.github.com>
Date: Fri, 23 Apr 2021 13:40:08 +0200
Subject: [PATCH 2/3] Update modDesc.xml
---
modDesc.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modDesc.xml b/modDesc.xml
index 50b9111f4..ab71615f8 100644
--- a/modDesc.xml
+++ b/modDesc.xml
@@ -1,6 +1,6 @@
- 6.03.00054
+ 6.03.00055
CoursePlay SIX
From 47856cdd452015399bd87b0c9b639e727601385f Mon Sep 17 00:00:00 2001
From: schwiti6190 <58079399+schwiti6190@users.noreply.github.com>
Date: Fri, 23 Apr 2021 14:27:39 +0200
Subject: [PATCH 3/3] small PR adjustments
---
ActionEventsLoader.lua | 6 +++---
base.lua | 4 ++--
config/ActionEventsConfig.xml | 26 +++++++++++++-------------
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/ActionEventsLoader.lua b/ActionEventsLoader.lua
index 66203fecb..630de5be9 100644
--- a/ActionEventsLoader.lua
+++ b/ActionEventsLoader.lua
@@ -10,7 +10,7 @@ ActionEventsLoader.actionEventAttributes = {
{name = 'callbackState', getXmlFunction = getXMLInt},
{name = 'isDisabledCallbackFunc', getXmlFunction = getXMLString},
{name = 'text', getXmlFunction = getXMLString},
- {name = 'textVisibilityNeeded', getXmlFunction = getXMLBool},
+ {name = 'textAlwaysVisible', getXmlFunction = getXMLBool},
}
---All the setting action events attributes
@@ -22,7 +22,7 @@ ActionEventsLoader.settingActionEventAttributes = {
{name = 'callbackState', getXmlFunction = getXMLInt},
{name = 'isDisabledCallbackFunc', getXmlFunction = getXMLString},
{name = 'text', getXmlFunction = getXMLString},
- {name = 'textVisibilityNeeded', getXmlFunction = getXMLBool},
+ {name = 'textAlwaysVisible', getXmlFunction = getXMLBool},
}
---String to class reference, only for global classes.
@@ -331,7 +331,7 @@ end
---Needs the action event text to be visible?
---@param table actionEventData from the config xml
function ActionEventsLoaderUtil.isActionEventTextVisible(actionEventData)
- return courseplay.globalSettings.showActionEventsTexts:get() or actionEventData.textVisibilityNeeded
+ return courseplay.globalSettings.showActionEventsTexts:get() or actionEventData.textAlwaysVisible
end
---Is the action event disabled ?
diff --git a/base.lua b/base.lua
index a86f6bda2..5c3fa5ec3 100644
--- a/base.lua
+++ b/base.lua
@@ -585,12 +585,12 @@ function courseplay:onUpdate(dt)
self.cp.infoText = nil
end
- if self.cp.firstRun == nil then
+ if self.cp.postInitDone == nil then
if self.cp.driver then
---Post init function, as not all giants variables are
---set correctly at the first courseplay:setAIDriver() call.
self.cp.driver:postInit()
- self.cp.firstRun = true
+ self.cp.postInitDone = true
end
end
diff --git a/config/ActionEventsConfig.xml b/config/ActionEventsConfig.xml
index 59c329b42..ad592957b 100644
--- a/config/ActionEventsConfig.xml
+++ b/config/ActionEventsConfig.xml
@@ -16,7 +16,7 @@
isDisabledCallbackFunc: is used to disable a action event after a action event refresh or on load.
callbackState: isDisabledCallbackFunc parameter, this is an int!
text: is the action event text, by default it returns courseplay:loc(name), where 'name' is the previous defined action event name.
- textVisibilityNeeded: Is disabling action event text forbidden ? (default: false)
+ textAlwaysVisible: Should the action event texts always be visible, regardless of settings, etc..
-->
@@ -33,17 +33,17 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -56,7 +56,7 @@
isDisabledCallbackFunc: is used to disable a action event after a action event refresh or on load optional, default is setting:isDisabled().
callbackState: isDisabledCallbackFunc parameter, this is an int!
text: is the action event text, by default it returns courseplay:loc(name), where 'name' is the previous defined action event name.
- textVisibilityNeeded: Is disabling action event text forbidden ? (default: false)
+ textAlwaysVisible: Should the action event texts always be visible, regardless of settings, etc..
-->