RobustToolbox
RobustToolbox copied to clipboard
Sprite layer draw depths
Revival of #2582.
This PR adds a draw depths to sprite layers, which determines the order in which they are drawn. It also adds RSI-direction based overrides, so that you could choose to have a layer behind another if an entity is facing a specific direction. The change is motivated by https://github.com/space-wizards/space-station-14/issues/4387 and https://github.com/space-wizards/space-station-14/issues/4563,
Previously layers would just get drawn in the order they were added to the sprite's layer list. Now it sorts them based on a draw depth & render order, similar to how entities/sprites get drawn. In order to avoid having to sort a list every time a sprite gets drawn, this caches sorted layer arrays, with one array per relevant direction. Overall this will probably be slightly slower than sprite rendering was before, but not by much.
Also makes some misc sprite/layer changes, like renaming Layer.RSI to Layer.Rsi, so that it is consistent with ISpriteLayer.Rsi
Requires space-wizards/space-station-14/pull/8989