[MIRROR] BSbodybags inherit heaviest item weight + Easier to escape the disarm/BSbodybag combo (#1229)

* 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>
This commit is contained in:
SkyratBot
2020-10-10 00:30:06 +01:00
committed by GitHub
co-authored by girl
parent 54916b8b81
commit c1c3fb93da
2 changed files with 78 additions and 39 deletions
@@ -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, "<span class='notice'>You cut the tag off [src].</span>")
@@ -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, "<span class='warning'>You wrestle with [src], but it won't fold while unzipped.</span>")
return
if(contents.len)
to_chat(usr, "<span class='warning'>There are too many things inside of [src] to fold it up!</span>")
return
visible_message("<span class='notice'>[usr] folds up [src].</span>")
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, "<span class='warning'>You wrestle with [src], but it won't fold while unzipped.</span>")
return
if(contents.len)
to_chat(the_folder, "<span class='warning'>There are too many things inside of [src] to fold it up!</span>")
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("<span class='notice'>[usr] folds up [src].</span>")
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, "<span class='warning'>You wrestle with [src], but it won't fold while unzipped.</span>")
return
if(contents.len >= mob_storage_capacity / 2)
to_chat(usr, "<span class='warning'>There are too many things inside of [src] to fold it up!</span>")
return
for(var/obj/item/bodybag/bluespace/B in src)
to_chat(usr, "<span class='warning'>You can't recursively fold bluespace body bags!</span>" )
return
visible_message("<span class='notice'>[usr] folds up [src].</span>")
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, "<span class='userdanger'>You're suddenly forced into a tiny, compressed space!</span>")
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, "<span class='warning'>You wrestle with [src], but it won't fold while unzipped.</span>")
return
//end copypaste zone
if(contents.len >= mob_storage_capacity / 2)
to_chat(usr, "<span class='warning'>There are too many things inside of [src] to fold it up!</span>")
return
for(var/obj/item/bodybag/bluespace/B in src)
to_chat(usr, "<span class='warning'>You can't recursively fold bluespace body bags!</span>" )
return
return TRUE
/obj/structure/closet/body_bag/bluespace/perform_fold(mob/living/carbon/human/the_folder)
visible_message("<span class='notice'>[usr] folds up [src].</span>")
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, "<span class='userdanger'>You're suddenly forced into a tiny, compressed space!</span>")
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)