diff --git a/config/VehicleConfigurations.xml b/config/VehicleConfigurations.xml
index d50e7001c..d38286de3 100644
--- a/config/VehicleConfigurations.xml
+++ b/config/VehicleConfigurations.xml
@@ -365,6 +365,9 @@ You can define the following custom settings:
+
@@ -549,4 +552,30 @@ You can define the following custom settings:
disablePipeMovingToolCorrection = "true"
unloadOffsetX = "-3.56"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scripts/ai/ImplementUtil.lua b/scripts/ai/ImplementUtil.lua
index 82defb206..a2aaf19ea 100644
--- a/scripts/ai/ImplementUtil.lua
+++ b/scripts/ai/ImplementUtil.lua
@@ -401,6 +401,25 @@ function ImplementUtil.stopMovingTool(implement, tool)
local spec = implement.spec_cylindered
implement:raiseDirtyFlags(tool.dirtyFlag)
implement:raiseDirtyFlags(spec.cylinderedDirtyFlag)
+ local detachLock = spec.detachLockNodes and spec.detachLockNodes[tool]
+ if detachLock then
+ --- Fix shovel detach, as shovel might have angle requirements for detaching.
+ --- These limits are implemented without a hysteresis ...
+ --- So we need to force set the limit, if a difference of less than 1 degree was found.
+ local node = tool.node
+ local rot = {
+ getRotation(node)
+ }
+ if detachLock.detachingRotMinLimit ~=nil and
+ math.abs(MathUtil.getAngleDifference(detachLock.detachingRotMinLimit, rot[tool.rotationAxis])) < math.pi/180 then
+ Cylindered.setAbsoluteToolRotation(implement, tool, detachLock.detachingRotMinLimit)
+ end
+ if detachLock.detachingRotMaxLimit ~= nil and
+ math.abs(MathUtil.getAngleDifference(detachLock.detachingRotMaxLimit, rot[tool.rotationAxis])) < math.pi/180 then
+ Cylindered.setAbsoluteToolRotation(implement, tool, detachLock.detachingRotMaxLimit)
+ end
+ end
+
end
function ImplementUtil.getLevelerNode(object)
diff --git a/scripts/specializations/CpShovelPositions.lua b/scripts/specializations/CpShovelPositions.lua
index 0ac058084..d51c0575a 100644
--- a/scripts/specializations/CpShovelPositions.lua
+++ b/scripts/specializations/CpShovelPositions.lua
@@ -78,6 +78,7 @@ function CpShovelPositions.registerEventListeners(vehicleType)
SpecializationUtil.registerEventListener(vehicleType, "onDraw", CpShovelPositions)
SpecializationUtil.registerEventListener(vehicleType, "onUpdateTick", CpShovelPositions)
SpecializationUtil.registerEventListener(vehicleType, "onPostAttach", CpShovelPositions)
+ SpecializationUtil.registerEventListener(vehicleType, "onPreDetach", CpShovelPositions)
end
function CpShovelPositions.registerFunctions(vehicleType)
@@ -112,6 +113,10 @@ function CpShovelPositions:onPostAttach()
end
end
+function CpShovelPositions:onPreDetach()
+ self:cpResetShovelState()
+end
+
function CpShovelPositions:onDraw()
end