ID:2540465
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
Having a way to layer objects in the same physical space but each with a different "mouse opacity layer" so that they take mouse events at different priority.

Example:

Object A with mouse_layer = 2 would take mouse events over Object B occupying the same physical space with mouse_layer = 1.

This issue doesn't crop up very often in top-down perspective, but in the isometric diamond there are some use cases where clickable objects occupy the same physical space and things get messy.
Without understanding the situation better, like a use case where this would come up, I'm a bit confused. Also I think you're confusing physical space with visual space here. But it seems to me there should be a way to approach this already.
If there's a way to approach this already, that's great.

I run into this when objects are visually underneath another clickable object (e.g, a tree). We want that object to render underneath like it is already, but to the mouse, it takes all the mouse events instead.
In response to Crazah
mouse_opacity=0 on the tree?
In response to NSBR
Maybe I need to break this down further to specific use-cases I've run into in my project. A monster walks underneath a tree. The tree is clickable as users can gather things from trees. The monster is hoverable/clickable as well. The monster should have mouse precedence.

Similarly, a player walks underneath a clickable tree, drops an item. That item can never be picked up by players because it's hidden underneath another clickable object.
#define TOUCH_PLANE 10000

var/obj/touch_me_daddy/daddytouch = new()

obj/touch_me_daddy
vis_flags = VIS_INHERIT_ICON|VIS_INHERIT_ICON_STATE|VIS_INHERIT_DIR|VIS_INHERIT_ID|VIS_INHERIT_LAYER
plane = TOUCH_PLANE
alpha = 0

atom/movable
var
need_touch = 0
New()
if(need_touch)
vis_contents += daddytouch
..()
Del()
if(need_touch)
vis_contents -= daddytouch
..()


513 is obscenely good.

INHERIT_ID will make the mouse interact with the origin
INHERIT_ICON will make it mirror the icon.
INHERIT_ICON_STATE is obvious.
INHERIT_DIR is also obvious.
INHERIT_LAYER is also obvious.

The important bit here is that atoms with alpha of 0 will still act mouse aware without being visible. So we're just creating a special super-layer for objects that should appear in front of terrain.