mouse_opacity doesn't work for overlays, underlays and anything inbetweenlays.
Numbered Steps to Reproduce Problem:
1) Produce any atom that can have overlays, hereafter referred to as the parent (as in, any atom)
2) Apply any other atom that has mouse_opacity set to anything other than the parent's mouse_opacity to the parent as overlay or underlay (they're functionally exactly the same)
Code Snippet (if applicable) to Reproduce Problem:
obj/idiot
name = "idiot"
icon = 'idiot.dmi'
var/list/images = list()
obj/idiot/A
name = "A"
icon_state = "1"
layer = OBJ_LAYER
obj/idiot/B
name = "B"
icon_state = "2"
layer = OBJ_LAYER+0.1
obj/idiot/New()
for(var/i=0, i<3, i++)
var/obj/overlay/I = new()
I.icon = icon
I.icon_state = icon_state
I.layer = layer + (i / 3)
I.pixel_x = i * 8
I.pixel_y = i * 8
I.mouse_opacity = 0
underlays += I
obj/overlay
Expected Results:
Being able to click through overlays with mouse_opacity set to 0. Being unable to click through overlays with mouse_opacity set to 2.
Actual Results:
Hahaha. Nope.
Does the problem occur:
Every time? Or how often? Whenever and always.
In other games? Yes.
In other user accounts? Yes.
On other computers? Yes.
When does the problem NOT occur?
I believe we cleared this up above.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Real talk:
I spent several hours with a headache trying to prove to myself why this is somehow still an issue. Let's have a look at some photographic evidence from the code snippet above.
the two parent atoms are clearly highlighted in red and blue. all the images you see are overlay objects with mouse_opacity set to 0, whereas the parent atoms (the very bottom left ones) are mouse_opacity 1 (the default value).
As I've tested this, Byond supports being able to click through the rough-cut square-shaped holes in the squares. slowly running your cursor over this map screen will flash between A, B and nothing as you'd expect it to (or have come to expect after several years). What I take from this is that your click code probably does not use some kind of mask. The mask would be exceedingly difficult to generate, as it would have to take every other object into account, and every cell of the mask would have to hold an object reference. The mask would also have to be regenerated every time the overlays change. Cross that off the roster.
The other possible case, is that you evaluate per atom. So you pick the first atom in terms of layer, the topmost one, you'd assume. Then you check through all the overlays of that atom. Except that's not right either as can be witnessed in the code sample, with the right sprites. You'd expect the red overlaystack to always be clicked on before the blue stack, but it works perfectly fine and what you see is what you get in terms of click-through.
The only remaining conclusions are:
You're using a complicated exotic special super optimized system for checking if two objects overlap each other...
...or you're simply iterating through all icons that are being drawn. In which case, the only thing missing for a proper implementation of click-through is literally one variable.
What is going on here?
I'm thinking this would fit better as a feature request.