was true for filterObjectEnter too
The return value is applied to all.
Here’s a report I put on the “community bug tracker” a while back:
Describe the bug
Dragging a group of objects to a container tests filterObjectEnter on one, then applies that value to all.
Steps to reproduce the behavior:
Create a bag with filterObjectEnter that rejects the first time, accepts the second (script below).
Create a handful of random objects.
Select the group of objects and drag all to the bag.
Observe a single call to filterObjectEnter, all objects are rejected.
Drag same group to the bag again.
Observe a single call to filterObjectEnter, all objects are accepted.
Expected behavior
The filter method should be called separately for each object.
function filterObjectEnter(enter_object)
_n = (_n or 0) + 1
local result = (_n % 2) == 0
print(‘filter: ‘ .. _n .. ‘ ‘ .. tostring(result))
return result
end
Tabletop Simulator Info (please complete the following information):
OS: macOS
Version 12.4.3
This bug appears to still be present. Putting this script on a bag:
function tryObjectEnter(object)
print(object.getGUID())
return false
end
then dropping a set of drag-selected objects onto the bag shows only one print, and all objects are rejected. Flipping the return to true shows only one print then all objects are inserted.