diff --git a/BaleLoaderAIDriver.lua b/BaleLoaderAIDriver.lua index 48df5096e..63e26dcf5 100644 --- a/BaleLoaderAIDriver.lua +++ b/BaleLoaderAIDriver.lua @@ -63,8 +63,8 @@ function BaleLoaderAIDriver:init(vehicle) self:debug('baleloader %s', tostring(self.baleLoader)) -- Bale loaders have no AI markers (as they are not AIImplements according to Giants) so add a function here -- to get the markers - self.baleLoader.getAIMarkers = function(self) - return UnloadableFieldworkAIDriver.getAIMarkersFromGrabberNode(self, self.spec_baleLoader) + self.baleLoader.getAIMarkers = function(object) + return UnloadableFieldworkAIDriver.getAIMarkersFromGrabberNode(object, object.spec_baleLoader) end self:initStates(BaleLoaderAIDriver.myStates) diff --git a/BaleToCollect.lua b/BaleToCollect.lua index 6213f88e6..ff200db0b 100644 --- a/BaleToCollect.lua +++ b/BaleToCollect.lua @@ -29,7 +29,13 @@ BaleToCollect = CpObject() function BaleToCollect:init(baleObject) self.bale = baleObject local x, _, z = getWorldTranslation(self.bale.nodeId) - self.fieldId = PathfinderUtil.getFieldIdAtWorldPosition(x, z) + -- this finds bales on merged fields too, but the bale must be on the field + self.fieldId = courseplay.fields:getFieldNumForPosition(x, z) + if self.fieldId == 0 then + -- this does not find bales on merged fields, but finds them if they are on the + -- field border too (just off the field) + self.fieldId = PathfinderUtil.getFieldIdAtWorldPosition(x, z) + end end --- Call this before attempting to construct a BaleToCollect to check the validity of the object diff --git a/BaleWrapperAIDriver.lua b/BaleWrapperAIDriver.lua index 3221d4c01..89fc0795d 100644 --- a/BaleWrapperAIDriver.lua +++ b/BaleWrapperAIDriver.lua @@ -30,8 +30,8 @@ function BaleWrapperAIDriver:init(vehicle) if not self.baler then -- Bale wrappers which aren't balers have no AI markers as they have no pick up so add a function here -- to get the markers - self.baleWrapper.getAIMarkers = function(self) - return UnloadableFieldworkAIDriver.getAIMarkersFromGrabberNode(self, self.spec_baleWrapper) + self.baleWrapper.getAIMarkers = function(object) + return UnloadableFieldworkAIDriver.getAIMarkersFromGrabberNode(object, object.spec_baleWrapper) end end end diff --git a/fields.lua b/fields.lua index 31b5b1e5d..83057c2ea 100644 --- a/fields.lua +++ b/fields.lua @@ -579,6 +579,7 @@ function courseplay.fields:onWhichFieldAmI(vehicle) return self:getFieldNumForPosition( positionX, positionZ ) end +---@return number field number at position, 0 if it is not on a field. function courseplay.fields:getFieldNumForPosition(positionX, positionZ) local fieldNum = 0 for index, field in pairs(courseplay.fields.fieldData) do diff --git a/img/iconSprite.dds b/img/iconSprite.dds index 5d2ca1948..3a3a47b16 100644 Binary files a/img/iconSprite.dds and b/img/iconSprite.dds differ diff --git a/modDesc.xml b/modDesc.xml index 8f930fc97..49250e935 100644 --- a/modDesc.xml +++ b/modDesc.xml @@ -1,6 +1,6 @@ - 6.03.00045 + 6.03.00046 <!-- en=English de=German fr=French es=Spanish ru=Russian pl=Polish it=Italian br=Brazilian-Portuguese cs=Chinese(Simplified) ct=Chinese(Traditional) cz=Czech nl=Netherlands hu=Hungary jp=Japanese kr=Korean pt=Portuguese ro=Romanian tr=Turkish --> <en>CoursePlay SIX</en>