Skip to content

Commit f66359a

Browse files
committed
fix: crash in devhelper with no towed implement
1 parent 8f54140 commit f66359a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

scripts/dev/DevHelper.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,12 @@ function DevHelper:drawPathfinderCollisionBoxes()
276276
if not self.vehicleData then
277277
return
278278
end
279+
279280
if not self.overlapBoxNode then
280281
self.overlapBoxNode = CpUtil.createNode('devhelperPathfinderBoxes', 0, 0, 0)
281282
link(g_currentMission.terrainRootNode, self.overlapBoxNode)
282283
end
284+
283285
-- visualize here what the pathfinder does to create the collision boxes for the main and the towed vehicle
284286
-- draw main vehicle
285287
PathfinderUtil.setWorldPositionAndRotationOnTerrain(self.overlapBoxNode, self.data.x, self.data.z, self.yRot, 0)
@@ -288,6 +290,11 @@ function DevHelper:drawPathfinderCollisionBoxes()
288290
local x, y, z = localToWorld(self.overlapBoxNode, ob.xOffset, 1, ob.zOffset)
289291
-- function DebugUtil.drawOverlapBox(x, y, z, rotX, rotY, rotZ, extendX, extendY, extendZ, r, g, b)
290292
DebugUtil.drawOverlapBox(x, y, z, xRot, yRot, zRot, ob.width, 1, ob.length, 0, 0.5, 0.5)
293+
294+
if not self.towedImplement then
295+
return
296+
end
297+
291298
ob = self.vehicleData:getTowedImplementOverlapBoxParams()
292299
-- move the helper node to the hitch
293300
x, y, z = localToWorld(self.overlapBoxNode, 0, 0, self.vehicleData:getHitchOffset())

0 commit comments

Comments
 (0)