From 8a20610ce81d812d23cc64efc732a4e4fe8a4d02 Mon Sep 17 00:00:00 2001 From: AlaunusLux <89751433+AlaunusLux@users.noreply.github.com> Date: Sun, 24 Nov 2024 11:42:33 -0600 Subject: [PATCH] Bodybag and buckling layer fixes (#20174) This PR is mostly about fixing body/cryo bag layering issues. Currently live and annoying to try and treat around: ![image](https://github.com/user-attachments/assets/b867af9a-8ab1-42cc-8503-bb252a3a86c7) Currently, bags are are below roller beds when first deployed. If buckled and unbuckled, they are then above, because of the + 0.1 on buckling. If buckled on a roller bed, dragged, and then unbuckled, they are then above player mobs, because of the `layer + 1` on roller bed `Move()` proc, which also doesn't get reset. I removed this +1 on Move() because it was older than the +0.1 and seems to serve the same purpose. The +0.1 did not have a method of reverting to the original buckled atom's layer, so I added a var and check to handle that. I also changed bullet casing's layer to `BELOW_TABLE_LAYER` with the intent of not having them on top of stasis bags and roller beds, because it causes issues as someone trying to treat wounded after a firefight. Changing bullet casing's layer does have a consequence of putting bullets underneath, for example, the soil in the public garden. Putting the soil on `BELOW_TABLE_LAYER` would fix this, but with the consequence of having the bushes be on top, making clicking the soil difficult for farming purposes. Adding bushes to that layer causes consequences with side window layering (like on deck three outside the public lounge.) For this PR I only adjusted the bullet casing layer. I'm sure it has other unintended layering interactions. Let me know if it would be better to leave them where they are or on some other layer. Current changes in PR: Bullets under soil/roller beds/stasis bags. ![image](https://github.com/user-attachments/assets/b56b768f-b9d6-4aca-ad2a-cfc30fe6e66a) (Example of why making bullets on top of soil is difficult) Screenshot shows both bullets and the soil being `BELOW_TABLE_LAYER` with bushes on top, as a reference. PR Currently has bullets underneath soil. ![image](https://github.com/user-attachments/assets/8cbf4b6d-8023-4138-86f1-f4cac106f647) --- code/__DEFINES/layers.dm | 1 + code/game/objects/buckling.dm | 4 ++ code/game/objects/items/bodybag.dm | 1 + code/game/objects/objs.dm | 8 +++ .../structures/stool_bed_chair_nest/bed.dm | 1 - code/modules/projectiles/ammunition.dm | 1 + ...usLux-bodybag-and-buckling-layer-fixes.yml | 61 +++++++++++++++++++ 7 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 html/changelogs/AlaunusLux-bodybag-and-buckling-layer-fixes.yml diff --git a/code/__DEFINES/layers.dm b/code/__DEFINES/layers.dm index 49aec27f2fa..cd4bff185f1 100644 --- a/code/__DEFINES/layers.dm +++ b/code/__DEFINES/layers.dm @@ -85,6 +85,7 @@ #define ABOVE_WINDOW_LAYER 2.78 #define BELOW_OBJ_LAYER 2.89 #define STRUCTURE_LAYER 2.9 + #define ABOVE_STRUCTURE_LAYER 2.91 //OBJ_LAYER 3 #define ABOVE_OBJ_LAYER 3.01 #define MOB_SHADOW_LAYER 3.011 diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index 15bae559e97..1bf2e09d833 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -55,6 +55,7 @@ buckling_atom.anchored = TRUE post_buckle(buckling_atom) + buckled_original_layer = buckling_atom.layer buckling_atom.layer = layer + 0.1 return TRUE @@ -63,6 +64,9 @@ if(MA && MA.buckled_to == src) . = MA MA.buckled_to = null + if(buckled_original_layer) + MA.layer = buckled_original_layer + buckled_original_layer = null MA.anchored = initial(MA.anchored) buckled = null if(istype(MA, /mob/living)) diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm index b7a0e9a296c..f8c9d66801a 100644 --- a/code/game/objects/items/bodybag.dm +++ b/code/game/objects/items/bodybag.dm @@ -53,6 +53,7 @@ icon_state = "bodybag" open_sound = 'sound/items/zip.ogg' close_sound = 'sound/items/zip.ogg' + layer = ABOVE_STRUCTURE_LAYER density = FALSE storage_capacity = 30 var/item_path = /obj/item/bodybag diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 5ffd74be80b..c4d5c0d7142 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -49,6 +49,14 @@ var/buckle_lying = -1 //bed-like behavior, forces mob.lying = buckle_lying if != -1 var/buckle_require_restraints = 0 //require people to be handcuffed before being able to buckle. eg: pipes var/atom/movable/buckled = null + /** + * Stores the original layer of a buckled atom. + * + * Set in `/obj/proc/buckle` when the atom's layer is adjusted. + * + * Used in `/unbuckle()` to restore the original layer. + */ + var/buckled_original_layer = null var/buckle_delay = 0 //How much extra time to buckle someone to this object. /* END BUCKLING VARS */ diff --git a/code/game/objects/structures/stool_bed_chair_nest/bed.dm b/code/game/objects/structures/stool_bed_chair_nest/bed.dm index 635bc2a4bc6..31238406d76 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -523,7 +523,6 @@ if(buckled) if(buckled.buckled_to == src) buckled.forceMove(src.loc) - buckled.layer = src.layer + 1 else buckled = null diff --git a/code/modules/projectiles/ammunition.dm b/code/modules/projectiles/ammunition.dm index 9398bf85a35..da1a6706149 100644 --- a/code/modules/projectiles/ammunition.dm +++ b/code/modules/projectiles/ammunition.dm @@ -7,6 +7,7 @@ obj_flags = OBJ_FLAG_CONDUCTABLE slot_flags = SLOT_BELT | SLOT_EARS throwforce = 1 + layer = BELOW_TABLE_LAYER w_class = WEIGHT_CLASS_TINY var/leaves_residue = 1 diff --git a/html/changelogs/AlaunusLux-bodybag-and-buckling-layer-fixes.yml b/html/changelogs/AlaunusLux-bodybag-and-buckling-layer-fixes.yml new file mode 100644 index 00000000000..96c44f07a84 --- /dev/null +++ b/html/changelogs/AlaunusLux-bodybag-and-buckling-layer-fixes.yml @@ -0,0 +1,61 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: AlaunusLux + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Body/Cryo bags will now be above roller beds when deployed." + - bugfix: "Body/Cryo bags will no longer be above player mobs after being buckled and dragged." + - bugfix: "Bullets will no longer be on top of roller beds and body/cryo bags." + - bugfix: "A buckled atom's layer will now be reset upon being unbuckled."