From c1c3fb93da2ddd80a94c82c746d46c0c062ee757 Mon Sep 17 00:00:00 2001
From: SkyratBot <59378654+SkyratBot@users.noreply.github.com>
Date: Sat, 10 Oct 2020 01:30:06 +0200
Subject: [PATCH] [MIRROR] BSbodybags inherit heaviest item weight + Easier to
escape the disarm/BSbodybag combo (#1229)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* BSbodybags inherit heaviest item weight + Easier to escape the disarm/BSbodybag combo (#54065)
Bodybags now inherit the weight of their heaviest item. If it doesn't have a weight (people), we assume bulky since things like people can be firecarried or whatever.
It now takes less time to get out of a bag (20 > 12 secs), and the progress bar is unbreakable unless you get incapacitated. This means people interested in using it to kidnap can still do so but it requires considerably more effort that isnt based on a latency difference and a quick disarm. The timer still runs down if you open the bag and try to put them back in but good attempt😏.
This also fixes an issue with the BSB where it was picking up or otherwise doublecalling checks from inheritance.
* BSbodybags inherit heaviest item weight + Easier to escape the disarm/BSbodybag combo
Co-authored-by: girl <11748095+ExcessiveUseOfCobblestone@users.noreply.github.com>
---
code/game/objects/items/bodybag.dm | 15 ++-
.../crates_lockers/closets/bodybag.dm | 102 ++++++++++++------
2 files changed, 78 insertions(+), 39 deletions(-)
diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm
index b72954eac9b..6df651a7467 100644
--- a/code/game/objects/items/bodybag.dm
+++ b/code/game/objects/items/bodybag.dm
@@ -77,8 +77,13 @@
user.last_special = world.time + CLICK_CD_BREAKOUT
to_chat(user, "You claw at the fabric of [src], trying to tear it open...")
to_chat(loc, "Someone starts trying to break free of [src]!")
- if(!do_after(user, 200, target = src))
- to_chat(loc, "The pressure subsides. It seems that they've stopped resisting...")
- return
- loc.visible_message("[user] suddenly appears in front of [loc]!", "[user] breaks free of [src]!")
- qdel(src)
+ if(do_after_mob(user, src, 12 SECONDS, TRUE))
+ if(user.loc != src)
+ return
+ // you are still in the bag? time to go unless you KO'd, honey!
+ // if they escape during this time and you rebag them the timer is still clocking down and does NOT reset so they can very easily get out.
+ if(user.incapacitated())
+ to_chat(loc, "The pressure subsides. It seems that they've stopped resisting...")
+ return
+ loc.visible_message("[user] suddenly appears in front of [loc]!", "[user] breaks free of [src]!")
+ qdel(src)
diff --git a/code/game/objects/structures/crates_lockers/closets/bodybag.dm b/code/game/objects/structures/crates_lockers/closets/bodybag.dm
index 2502d6eee8c..915f1088600 100644
--- a/code/game/objects/structures/crates_lockers/closets/bodybag.dm
+++ b/code/game/objects/structures/crates_lockers/closets/bodybag.dm
@@ -37,11 +37,11 @@
if(!user.canUseTopic(src, BE_CLOSE))
return
if(t)
- name = "body bag - [t]"
+ name = "[initial(name)] - [t]"
tagged = TRUE
update_icon()
else
- name = "body bag"
+ name = initial(name)
return
else if(I.tool_behaviour == TOOL_WIRECUTTER)
to_chat(user, "You cut the tag off [src].")
@@ -68,19 +68,40 @@
/obj/structure/closet/body_bag/MouseDrop(over_object, src_location, over_location)
. = ..()
if(over_object == usr && Adjacent(usr) && (in_range(src, usr) || usr.contents.Find(src)))
- if(!ishuman(usr))
+ if(!attempt_fold(usr))
return
- if(opened)
- to_chat(usr, "You wrestle with [src], but it won't fold while unzipped.")
- return
- if(contents.len)
- to_chat(usr, "There are too many things inside of [src] to fold it up!")
- return
- visible_message("[usr] folds up [src].")
- var/obj/item/bodybag/B = foldedbag_instance || new foldedbag_path
- usr.put_in_hands(B)
+ perform_fold(usr)
qdel(src)
+ /**
+ * Checks to see if we can fold. Return TRUE to actually perform the fold and delete.
+ *
+ * Arguments:
+ * * the_folder - over_object of MouseDrop aka usr
+ */
+/obj/structure/closet/body_bag/proc/attempt_fold(mob/living/carbon/human/the_folder)
+ . = FALSE
+ if(!istype(the_folder))
+ return
+ if(opened)
+ to_chat(the_folder, "You wrestle with [src], but it won't fold while unzipped.")
+ return
+ if(contents.len)
+ to_chat(the_folder, "There are too many things inside of [src] to fold it up!")
+ return
+ // toto we made it!
+ return TRUE
+
+ /**
+ * Performs the actual folding. Deleting is automatic, please do not include.
+ *
+ * Arguments:
+ * * the_folder - over_object of MouseDrop aka usr
+ */
+/obj/structure/closet/body_bag/proc/perform_fold(mob/living/carbon/human/the_folder)
+ visible_message("[usr] folds up [src].")
+ var/obj/item/bodybag/B = foldedbag_instance || new foldedbag_path
+ the_folder.put_in_hands(B)
/obj/structure/closet/body_bag/bluespace
name = "bluespace body bag"
@@ -91,25 +112,38 @@
mob_storage_capacity = 15
max_mob_size = MOB_SIZE_LARGE
-/obj/structure/closet/body_bag/bluespace/MouseDrop(over_object, src_location, over_location)
- . = ..()
- if(over_object == usr && Adjacent(usr) && (in_range(src, usr) || usr.contents.Find(src)))
- if(!ishuman(usr))
- return
- if(opened)
- to_chat(usr, "You wrestle with [src], but it won't fold while unzipped.")
- return
- if(contents.len >= mob_storage_capacity / 2)
- to_chat(usr, "There are too many things inside of [src] to fold it up!")
- return
- for(var/obj/item/bodybag/bluespace/B in src)
- to_chat(usr, "You can't recursively fold bluespace body bags!" )
- return
- visible_message("[usr] folds up [src].")
- var/obj/item/bodybag/B = foldedbag_instance || new foldedbag_path
- usr.put_in_hands(B)
- for(var/atom/movable/A in contents)
- A.forceMove(B)
- if(isliving(A))
- to_chat(A, "You're suddenly forced into a tiny, compressed space!")
- qdel(src)
+/obj/structure/closet/body_bag/bluespace/attempt_fold(mob/living/carbon/human/the_folder)
+ . = FALSE
+ //copypaste zone, we do not want the content check so we don't want inheritance
+ if(!istype(the_folder))
+ return
+ if(opened)
+ to_chat(the_folder, "You wrestle with [src], but it won't fold while unzipped.")
+ return
+ //end copypaste zone
+ if(contents.len >= mob_storage_capacity / 2)
+ to_chat(usr, "There are too many things inside of [src] to fold it up!")
+ return
+ for(var/obj/item/bodybag/bluespace/B in src)
+ to_chat(usr, "You can't recursively fold bluespace body bags!" )
+ return
+ return TRUE
+
+/obj/structure/closet/body_bag/bluespace/perform_fold(mob/living/carbon/human/the_folder)
+ visible_message("[usr] folds up [src].")
+ var/obj/item/bodybag/B = foldedbag_instance || new foldedbag_path
+ var/max_weight_of_contents = initial(B.w_class)
+ for(var/am in contents)
+ var/atom/movable/content = am
+ content.forceMove(B)
+ if(isliving(content))
+ to_chat(content, "You're suddenly forced into a tiny, compressed space!")
+ if(!isitem(content))
+ max_weight_of_contents = max(WEIGHT_CLASS_BULKY, max_weight_of_contents)
+ continue
+ var/obj/item/A_is_item = content
+ if(A_is_item.w_class < max_weight_of_contents)
+ continue
+ max_weight_of_contents = A_is_item.w_class
+ B.w_class = max_weight_of_contents
+ usr.put_in_hands(B)