crowelian, you can, also, make a completely different system, very very simple, where you make a grid with invisible squares, each one will be a slot, and when you leave one object over it, it will place the object on its origin point.
So, you could check FOR EACH and achieve anything else you need.
I could not think in something simpler than this.
Good luck, and welcome.