RobustToolbox icon indicating copy to clipboard operation
RobustToolbox copied to clipboard

Sprite layer draw depths

Open ElectroJr opened this issue 3 years ago • 0 comments
trafficstars

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

ElectroJr avatar Jun 21 '22 02:06 ElectroJr