@@ -2993,11 +2993,9 @@ function UniversalAutoload:isValidForLoading(object)
29932993 local rearAutoTrigger = triggerId == spec .rearAutoTriggerId
29942994 local rearPickupTrigger = triggerId == spec .rearPickupTriggerId
29952995 local curtainsOpen = not (tipState == Trailer .TIPSTATE_CLOSED or tipState == Trailer .TIPSTATE_CLOSING )
2996- if rearPickupTrigger then
2997- if not doorOpen then
2998- if debugPallets then print (object .i3dFilename , " rear door is CLOSED" ) end
2999- return false
3000- end
2996+ if rearPickupTrigger and not doorOpen then
2997+ if debugPallets then print (object .i3dFilename , " rear door is CLOSED" ) end
2998+ return false
30012999 end
30023000 end
30033001
@@ -3927,7 +3925,7 @@ function UniversalAutoload:getIsLoadingKeyAllowed()
39273925 return
39283926 end
39293927
3930- if spec .doPostLoadDelay or spec .validLoadCount == 0 or spec . currentLoadside == " none " then
3928+ if spec .doPostLoadDelay or spec .validLoadCount == 0 then
39313929 return false
39323930 end
39333931 if spec .baleCollectionMode then
@@ -4561,7 +4559,7 @@ function UniversalAutoload:ualLoadingTrigger_Callback(triggerId, otherActorId, o
45614559 if onEnter then
45624560 UniversalAutoload .addAvailableObject (self , object , triggerId )
45634561 elseif onLeave then
4564- UniversalAutoload .removeAvailableObject (self , object )
4562+ UniversalAutoload .removeAvailableObject (self , object , triggerId )
45654563 end
45664564 end
45674565 end
@@ -4598,7 +4596,7 @@ function UniversalAutoload:ualAutoLoadingTrigger_Callback(triggerId, otherActorI
45984596 if UniversalAutoload .getIsValidObject (self , object ) then
45994597 if onEnter then
46004598 if debugLoading then print (" AutoLoadingTrigger ENTER: " .. tostring (object .id )) end
4601- UniversalAutoload .addAutoLoadingObject (self , object , triggerId )
4599+ UniversalAutoload .addAutoLoadingObject (self , object )
46024600 elseif onLeave then
46034601 if debugLoading then print (" AutoLoadingTrigger LEAVE: " .. tostring (object .id )) end
46044602 UniversalAutoload .removeAutoLoadingObject (self , object )
@@ -4655,6 +4653,10 @@ end
46554653function UniversalAutoload :addAvailableObject (object , triggerId )
46564654 local spec = self .spec_universalAutoload
46574655
4656+ if spec .availableObjects [object ] ~= nil and spec .objectToTriggerId [object ] ~= triggerId then
4657+ UniversalAutoload .removeAvailableObject (self , object , spec .objectToTriggerId [object ])
4658+ end
4659+
46584660 if spec .availableObjects [object ] == nil and spec .loadedObjects [object ] == nil then
46594661 spec .availableObjects [object ] = object
46604662 spec .objectToTriggerId [object ] = triggerId
@@ -4674,11 +4676,11 @@ function UniversalAutoload:addAvailableObject(object, triggerId)
46744676 end
46754677end
46764678--
4677- function UniversalAutoload :removeAvailableObject (object )
4679+ function UniversalAutoload :removeAvailableObject (object , triggerId )
46784680 local spec = self .spec_universalAutoload
46794681 local isActiveForLoading = spec .isLoading or spec .isUnloading or spec .doPostLoadDelay
46804682
4681- if spec .availableObjects [object ] ~= nil then
4683+ if spec .availableObjects [object ] ~= nil and ( triggerId == nil or spec . objectToTriggerId [ object ] == triggerId ) then
46824684 spec .availableObjects [object ] = nil
46834685 spec .objectToTriggerId [object ] = nil
46844686 spec .totalAvailableCount = spec .totalAvailableCount - 1
@@ -4720,7 +4722,7 @@ function UniversalAutoload:ualOnDeleteAvailableObject_Callback(object)
47204722 UniversalAutoload .removeFromSortedObjectsToLoad (self , object )
47214723end
47224724--
4723- function UniversalAutoload :addAutoLoadingObject (object , triggerId )
4725+ function UniversalAutoload :addAutoLoadingObject (object )
47244726 local spec = self .spec_universalAutoload
47254727
47264728 if UniversalAutoload .isShippingContainer (object ) then
@@ -4731,7 +4733,6 @@ function UniversalAutoload:addAutoLoadingObject(object, triggerId)
47314733 if UniversalAutoload .isValidForManualLoading (object ) or (object .isSplitShape and self .isLogTrailer ) then
47324734 if spec .autoLoadingObjects [object ] == nil and spec .loadedObjects [object ] == nil then
47334735 spec .autoLoadingObjects [object ] = object
4734- spec .objectToTriggerId [object ] = triggerId
47354736 if object .addDeleteListener ~= nil then
47364737 object :addDeleteListener (self , " ualOnDeleteAutoLoadingObject_Callback" )
47374738 end
@@ -4754,7 +4755,6 @@ function UniversalAutoload:removeAutoLoadingObject(object)
47544755
47554756 if spec .autoLoadingObjects [object ] ~= nil then
47564757 spec .autoLoadingObjects [object ] = nil
4757- spec .objectToTriggerId [object ] = nil
47584758 if object .removeDeleteListener ~= nil then
47594759 object :removeDeleteListener (self , " ualOnDeleteAutoLoadingObject_Callback" )
47604760 end
0 commit comments