ID:2371965
 
Resolved
Layering interactions with big icons screwed up in some cases like when using visual contents.
BYOND Version:512.1425
Operating System:Windows 7 Ultimate 64-bit
Web Browser:Chrome 66.0.3359.181
Applies to:Dream Seeker
Status: Resolved (512.1426)

This issue has been resolved.
Descriptive Problem Summary:

obj
carry_item
icon = 'items.dmi'
layer = FLOAT_LAYER
plane = FLOAT_PLANE




The left is when I add the object to the mob's vis_contents. The object layers under the player, when it should appear directly above it.

The right is when I add the same object to the mob's overlays. The object layers over the player, as it is expected that vis_contents should.


The bug only seems to affect objects with different visual bounds. As long as the two objects share the exact same icon size, there's no problem. But the minute you start using a smaller icon file on top of a larger one, the layering goes all out of whack.

test_vis_contents2() is the one that's bugged in the below demo:

http://files.byondhome.com/Ter13/visbug_src.zip
Lummox JR resolved issue with message:
Layering interactions with big icons screwed up in some cases like when using visual contents.
I found the cause of this and it's a doozy.

We have some code in from 455+ that checks for big-icon turfs and checks the "group" number of an icon to pull it forward if it's overlapping other tiles. The purpose of this is so that big-icon turfs will properly appear over the top of other turfs.

With an overlay you have the same group number; with visual contents, because that's a different object the group number is different too. KEEP_TOGETHER would obviate this because this code is reached after children are grouped together, but that doesn't apply here.

Since I've always hated the hackiness of that code, I decided to fall back on the older, also hacky but better established microlayering which should already mostly do the same thing. However I found the microlayering was using values just a smidge too small to be reliable (rounding error was making some of the differences disappear), so I had to alter that a tad too. Chances are I would never have had to do the group-checking code in the first place if I'd made that change back in the day.

Hopefully this won't break anything with big icons. I suspect if anything it'll be better.
Hopefully this won't break anything with big icons. I suspect if anything it'll be better.

I have very little faith. Poking the layering bear always results in craziness. Will update you with the next beta whether I see side-effects.
In response to Ter13
Ter13 wrote:
Hopefully this won't break anything with big icons. I suspect if anything it'll be better.

I have very little faith. Poking the layering bear always results in craziness. Will update you with the next beta whether I see side-effects.

Yeah, I hear you there. I did run some tests on the proposed fix, which was how I found that MicroLayer() needed some adjustments.