Skip to content

Commit

Permalink
Logic fix
Browse files Browse the repository at this point in the history
  • Loading branch information
schwiti6190 committed Sep 23, 2023
1 parent 8ecfd31 commit 1d24f46
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/ai/jobs/CpAIJobSiloLoader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function CpAIJobSiloLoader.getTrailerUnloadArea(position, silo)
local x, z = position:getPosition()
local dirX, dirZ = position:getDirection()
if x == nil or dirX == nil then
return false, {}, true
return false, {}, false
end
--- Rotation matrix to rotate Z directions to x directions
local dirX2 = dirX * math.cos(math.pi/2) - dirZ * math.sin(math.pi/2)
Expand Down Expand Up @@ -227,8 +227,8 @@ function CpAIJobSiloLoader.getTrailerUnloadArea(position, silo)
if silo then
local fx, fz = silo:getFrontCenter()
local bx, bz = silo:getBackCenter()
if MathUtil.vector2Length(x-fx, z-fz) < CpAIJobSiloLoader.MAX_UNLOAD_TARGET_DISTANCE_FROM_SILO and
MathUtil.vector2Length(x-bx, z-bz) < CpAIJobSiloLoader.MAX_UNLOAD_TARGET_DISTANCE_FROM_SILO then
if MathUtil.vector2Length(x-fx, z-fz) > CpAIJobSiloLoader.MAX_UNLOAD_TARGET_DISTANCE_FROM_SILO or
MathUtil.vector2Length(x-bx, z-bz) > CpAIJobSiloLoader.MAX_UNLOAD_TARGET_DISTANCE_FROM_SILO then
return true, area, false
end
end
Expand Down

0 comments on commit 1d24f46

Please sign in to comment.