Skip to content

Commit

Permalink
Bodybag and buckling layer fixes (#20174)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
AlaunusLux authored Nov 24, 2024
1 parent b5064af commit 8a20610
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 1 deletion.
1 change: 1 addition & 0 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions code/game/objects/buckling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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))
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/bodybag.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
1 change: 0 additions & 1 deletion code/game/objects/structures/stool_bed_chair_nest/bed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@
if(buckled)
if(buckled.buckled_to == src)
buckled.forceMove(src.loc)
buckled.layer = src.layer + 1
else
buckled = null

Expand Down
1 change: 1 addition & 0 deletions code/modules/projectiles/ammunition.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
61 changes: 61 additions & 0 deletions html/changelogs/AlaunusLux-bodybag-and-buckling-layer-fixes.yml
Original file line number Diff line number Diff line change
@@ -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."

0 comments on commit 8a20610

Please sign in to comment.