Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
6.03.00046 Collect bales on merged fields (#6909)
Browse files Browse the repository at this point in the history
Should now be able to collect bales on merged fields.

Also made some bale related code less confusing.

* Sharper Icons

Thx to @Gonimy-Vetrom
  • Loading branch information
pvaiko committed Feb 26, 2021
1 parent cf4623b commit f0abb18
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions BaleLoaderAIDriver.lua
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion BaleToCollect.lua
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions BaleWrapperAIDriver.lua
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions fields.lua
Expand Up @@ -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
Expand Down
Binary file modified img/iconSprite.dds
Binary file not shown.
2 changes: 1 addition & 1 deletion modDesc.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<modDesc descVersion="47">
<version>6.03.00045</version>
<version>6.03.00046</version>
<author><![CDATA[Courseplay.devTeam]]></author>
<title><!-- 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>
Expand Down

0 comments on commit f0abb18

Please sign in to comment.