Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pickups #154

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scripts/ai/controllers/CutterController.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ CutterController = CpObject(ImplementController)
function CutterController:init(vehicle, implement)
ImplementController.init(self, vehicle, implement)
self.cutterSpec = self.implement.spec_cutter
-- To avoid the error thrown for pickups:
-- Cutter.lua:1494: invalid argument #1 to 'ipairs' (table expected, got nil)
self.cutterSpec.fruitTypeIndices = {}
end

function CutterController:getDriveData()
Expand Down
31 changes: 16 additions & 15 deletions scripts/dev/DevHelper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,18 @@ function DevHelper:update()

end

function DevHelper:overlapBoxCallback(transformId)
function DevHelper:overlapBoxCallback(transformId, subShapeIndex)
local collidingObject = g_currentMission.nodeToObject[transformId]
local text = ''
for i = 0, getNumOfUserAttributes(transformId) - 1 do
local type, name, x = getUserAttributeByIndex(transformId, i)
text = tostring(i) .. ':' .. (type or '?') .. '/' .. (name or '?') .. '/' .. (x or '?')
local text = tostring(subShapeIndex)
for key, classId in pairs(ClassIds) do
if getHasClassId(transformId, classId) then
text = text .. ' ' .. key
end
end
for key, rigidBodyType in pairs(RigidBodyType) do
if getRigidBodyType(transformId) == rigidBodyType then
text = text .. ' ' .. key
end
end
if collidingObject then
if collidingObject.getRootVehicle then
Expand All @@ -112,14 +118,12 @@ function DevHelper:overlapBoxCallback(transformId)
text = text .. ' ' .. collidingObject.getName and collidingObject:getName() or 'N/A'
end
end
else
for key, classId in pairs(ClassIds) do
if getHasClassId(transformId, classId) then
text = text .. ' ' .. key
end
end
end
table.insert(self.data.collidingShapes, text .. ' ' .. getRigidBodyType(transformId))
for i = 0, getNumOfUserAttributes(transformId) - 1 do
local type, name, x = getUserAttributeByIndex(transformId, i)
text = text .. ' ' .. tostring(i) .. ':' .. (type or '?') .. '/' .. (name or '?') .. '/' .. (x or '?')
end
table.insert(self.data.collidingShapes, text)
end

-- Left-Alt + , (<) = mark current position as start for pathfinding
Expand Down Expand Up @@ -206,9 +210,6 @@ function DevHelper:fillDisplayData()
table.insert(displayData, {name = 'isOnFieldArea', value = self.data.isOnFieldArea})
table.insert(displayData, {name = 'onFieldArea', value = self.data.onFieldArea})
table.insert(displayData, {name = 'totalOnFieldArea', value = self.data.totalOnFieldArea})
table.insert(displayData, {name = 'nx', value = self.data.nx})
table.insert(displayData, {name = 'ny', value = self.data.ny})
table.insert(displayData, {name = 'nz', value = self.data.nz})
for i = 1, #self.data.collidingShapes do
table.insert(displayData, {name = 'collidingShapes ' .. i, value = self.data.collidingShapes[i]})
end
Expand Down
Loading