var/obj/O = some object
var/obj/U = another object
O.filters = filter(type = "mask", mask = U)
This would alpha mask O to U. Essentially, their alpha channels are multiplied when drawing O.
Ideally this would work with the same positions as these objects when drawn on the screen.
However, I would also settle for a /icon as the mask, with additional parameters for x and y offsets; it would functionally be very similar.
That would look like this:
var/obj/O = some object
var/icon/I = some mask icon
O.filters = filter(type = "mask", x = 20, y = -5, mask = I)