Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes catwalk rendering layering and catwalk pipe cap issues (tgstati…
…on#85236) ## About The Pull Request Sooooooo this one's a mess. First off, layering issues. Pipes, cables, and disposals currently render over catwalks!  That's not great. Looking into it, it seems we've moved the `CATWALK_LAYER` below the `ABOVE_OPEN_TURF_LAYER`, where the catwalk layer is used for closed catwalks. https://github.com/tgstation/tgstation/blob/33e983ced1ac27143c4b87d8761277eea35a6d2a/code/__DEFINES/layers.dm#L148-L150 Which, well, we've *also* made it so all `undertile` stuff gets rendered at `ABOVE_OPEN_TURF_LAYER` when below a tile. So! Naively! We swap those around! Easy peasy lemon squeezy. ```dm #define ABOVE_OPEN_TURF_LAYER (12 + TOPDOWN_LAYER) #define CATWALK_LAYER (13 + TOPDOWN_LAYER) ``` And hey! Well!  It's progress! But as we can see in the bottom right catwalk tile, something's not rendering right when they're below the tile... Well, time to take a closer look at our `undertile` element... aaaaaand would you look at that: https://github.com/tgstation/tgstation/blob/74f9a4314138afcb04af3cfb452ff167105f022c/code/datums/elements/undertile.dm#L45-L48 We're setting EVERYTHING to the `FLOOR_PLANE` at `ABOVE_OPEN_TURF_LAYER`, even the stuff that was already on `FLOOR_PLANE` with its own layer like disposals or cables. Meaning, layering fuckery ensues, we can't see shit. So? We just make it only do that when we're not already on the floor plane. ```dm if(PLANE_TO_TRUE(source.plane) != FLOOR_PLANE) SET_PLANE_IMPLICIT(source, FLOOR_PLANE) source.layer = ABOVE_OPEN_TURF_LAYER ``` This solves it!  Progress!  ...Kind of. The _layering_ is solved, but unscrewing and rescrewing them seems to cause pipe caps to manifest out of nowhere! This _sucks_ for debugging, y'know? Anyhow, this is based on two different things: an order of operations issue and catwalks just not being accounted for. First off! Order of operations. On `Initialize(...)`, the base `/obj/machinery/atmospherics` registers a proc that updates pipe caps on `COMSIG_OBJ_HIDE`: https://github.com/tgstation/tgstation/blob/33e983ced1ac27143c4b87d8761277eea35a6d2a/code/modules/atmospherics/machinery/atmosmachinery.dm#L114-L115 Meanwhile, `/obj/machinery/atmospherics/pipe`, adds the `undertile` element on its `Initialize(...)`... AFTER calling the parent. https://github.com/tgstation/tgstation/blob/33e983ced1ac27143c4b87d8761277eea35a6d2a/code/modules/atmospherics/machinery/pipes/pipes.dm#L31-L35 ...Which then registers its own proc on `COMSIG_OBJ_HIDE`... https://github.com/tgstation/tgstation/blob/74f9a4314138afcb04af3cfb452ff167105f022c/code/datums/elements/undertile.dm#L26 This meant that, well, the proc that generates the caps was being called *before* undertile had a chance to chance to remove the `TRAIT_UNDERFLOOR` trait... which pipe caps use to work out when to generate. https://github.com/tgstation/tgstation/blob/33e983ced1ac27143c4b87d8761277eea35a6d2a/code/modules/atmospherics/machinery/atmosmachinery.dm#L650-L652 So, we swap this around by moving both to a `setup_hiding()` proc which allows the pipe to register its behaviours before calling the parent and it register its, without needing to register it before calling the parent `Initialize(...)`. Cause that's ugly. Now we're generating pipe caps on catwalks! But! That brings us perfectly to the next bit. Cause those pipe caps, even if shown when the tile is open, look *ugly*. Why, when we open a catwalk, are we having our pipes suddenly extend onto the neighbouring tiles and catwalks and going down into them from the top? Arguably, these should behave like they're below tiles, because they logically are even if not technically so. Well, actually, we already have a similar situation with bare plating. It's not applying `TRAIT_UNDERFLOOR`, but also the pipe caps shouldn't be behaving like they're above a tile, because that'd be ugly- and that's what it does! https://github.com/tgstation/tgstation/blob/33e983ced1ac27143c4b87d8761277eea35a6d2a/code/modules/atmospherics/machinery/atmosmachinery.dm#L654-L655 So, we just apply a second check there, `iscatwalkturf(...)` ```dm var/turf/node_turf = get_turf(node) if(isplatingturf(node_turf) || iscatwalkturf(node_turf)) continue ``` And? Well!    There we go! There's no weird layering, there's no pipe caps where there shouldn't be, pipes behave like those on catwalks are actually under a tile. It looks _clean_. ... Well, for however clean we can get it to be without making sprites for the opened catwalks but without the integrated plating so we can make an overlay and have the pipes/cables/disposals not spontaneously go over the edges of the catwalk when opened. Or making the under sprites only have the attachment points in the corners, so it looks like the pipes/cables/disposals are going over plating instead of what looks like a raised edge. ## Why It's Good For The Game Fixes tgstation#84789. Fixes tgstation#82622. Screwing open a catwalk suddenly generating pipecaps on neighbouring closed catwalks and tiles with pipes under them looks weird. ## Changelog :cl: fix: Fixed pipes/cables/disposals rendering above closed catwalks. fix: Fixed catwalks covering pipes generating illogical pipe caps when screwed. fix: Opened catwalks are no longer assumed to be above-floor for the sake of generating pipe caps. /:cl:
- Loading branch information