diff --git a/code/game/mecha/equipment/tools/medical_tools.dm b/code/game/mecha/equipment/tools/medical_tools.dm
index bf4568703ce..f566b41bf2a 100644
--- a/code/game/mecha/equipment/tools/medical_tools.dm
+++ b/code/game/mecha/equipment/tools/medical_tools.dm
@@ -198,7 +198,7 @@
update_equip_info()
return
- proc/on_resist(var/mob/living/L)
+ container_resist(var/mob/living/L)
go_out()
update_equip_info()
diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm
index bc65d324d82..a6e8ef3ca57 100644
--- a/code/game/objects/objs.dm
+++ b/code/game/objects/objs.dm
@@ -256,3 +256,6 @@ a {
anchored = 0
step_towards(src,S)
else step_towards(src,S)
+
+/obj/proc/container_resist(var/mob/living)
+ return
diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm
index 1c8498c6cee..752d3dcb083 100644
--- a/code/game/objects/structures/crates_lockers/closets.dm
+++ b/code/game/objects/structures/crates_lockers/closets.dm
@@ -365,3 +365,42 @@
open()
if(AM.loc == src) return 0
return 1
+
+/obj/structure/closet/container_resist(var/mob/living/L)
+ var/breakout_time = 2 //2 minutes by default
+ if(opened)
+ if (L.loc == src)
+ L.forceMove(get_turf(src)) // Let's just be safe here
+ return //Door's open... wait, why are you in it's contents then?
+ if(!welded)
+ return //closed but not welded...
+ // else Meh, lets just keep it at 2 minutes for now
+ // breakout_time++ //Harder to get out of welded lockers than locked lockers
+
+ //okay, so the closet is either welded or locked... resist!!!
+ L.changeNext_move(CLICK_CD_BREAKOUT)
+ L.last_special = world.time + CLICK_CD_BREAKOUT
+ L << "You lean on the back of \the [src] and start pushing the door open. (this will take about [breakout_time] minutes)"
+ for(var/mob/O in viewers(usr.loc))
+ O.show_message("The [src] begins to shake violently!", 1)
+
+
+ spawn(0)
+ if(do_after(L,(breakout_time*60*10), target = src)) //minutes * 60seconds * 10deciseconds
+ if(!src || !L || L.stat != CONSCIOUS || L.loc != src || opened) //closet/user destroyed OR user dead/unconcious OR user no longer in closet OR closet opened
+ return
+
+ //Perform the same set of checks as above for weld and lock status to determine if there is even still a point in 'resisting'...
+ if(!welded)
+ return
+
+ //Well then break it!
+ welded = 0
+ update_icon()
+ usr << "You successfully break out!"
+ for(var/mob/O in viewers(L.loc))
+ O.show_message("\the [usr] successfully broke out of \the [src]!", 1)
+ if(istype(src.loc, /obj/structure/bigDelivery)) //nullspace ect.. read the comment above
+ var/obj/structure/bigDelivery/BD = src.loc
+ BD.attack_hand(usr)
+ open()
\ No newline at end of file
diff --git a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm
index db95e1d7b3c..1c2a34c719d 100644
--- a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm
+++ b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm
@@ -127,4 +127,49 @@
if(welded)
overlays += "welded"
else
- icon_state = icon_opened
\ No newline at end of file
+ icon_state = icon_opened
+
+/obj/structure/closet/secure_closet/container_resist(var/mob/living/L)
+ var/breakout_time = 2 //2 minutes by default
+ if(opened)
+ if (L.loc == src)
+ L.forceMove(get_turf(src)) // Let's just be safe here
+ return //Door's open... wait, why are you in it's contents then?
+ if(!locked && !welded)
+ return //It's a secure closet, but isn't locked. Easily escapable from, no need to 'resist'
+
+ //okay, so the closet is either welded or locked... resist!!!
+ L.changeNext_move(CLICK_CD_BREAKOUT)
+ L.last_special = world.time + CLICK_CD_BREAKOUT
+ L << "You lean on the back of \the [src] and start pushing the door open. (this will take about [breakout_time] minutes)"
+ for(var/mob/O in viewers(src))
+ O.show_message("The [src] begins to shake violently!", 1)
+
+
+ spawn(0)
+ if(do_after(usr,(breakout_time*60*10), target = src)) //minutes * 60seconds * 10deciseconds
+ if(!src || !L || L.stat != CONSCIOUS || L.loc != src || opened) //closet/user destroyed OR user dead/unconcious OR user no longer in closet OR closet opened
+ return
+
+ //Perform the same set of checks as above for weld and lock status to determine if there is even still a point in 'resisting'...
+ if(!locked && !welded)
+ return
+
+ //Well then break it!
+ desc = "It appears to be broken."
+ icon_state = icon_off
+ flick(icon_broken, src)
+ sleep(10)
+ flick(icon_broken, src)
+ sleep(10)
+ broken = 1
+ locked = 0
+ welded = 0
+ update_icon()
+ usr << "\red You successfully break out!"
+ for(var/mob/O in viewers(L.loc))
+ O.show_message("\the [usr] successfully broke out of \the [src]!", 1)
+ if(istype(src.loc, /obj/structure/bigDelivery)) //Do this to prevent contents from being opened into nullspace (read: bluespace)
+ var/obj/structure/bigDelivery/BD = src.loc
+ BD.attack_hand(usr)
+ open()
\ No newline at end of file
diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm
index d23de20410c..fedce12962c 100644
--- a/code/game/objects/structures/morgue.dm
+++ b/code/game/objects/structures/morgue.dm
@@ -143,6 +143,16 @@
connected = null
return ..()
+/obj/structure/morgue/container_resist(var/mob/living/L)
+ var/mob/living/carbon/CM = L
+ if(!istype(CM))
+ return
+ if (CM.stat || CM.restrained())
+ return
+
+ CM << "You attempt to slide yourself out of \the [src]..."
+ src.attack_hand(CM)
+
/*
* Morgue tray
@@ -314,12 +324,12 @@
if(contents.len <= 0)
for (var/mob/M in viewers(src))
- M.show_message("\red You hear a hollow crackle.", 1)
+ M.show_message("You hear a hollow crackle.", 1)
return
else
for (var/mob/M in viewers(src))
- M.show_message("\red You hear a roar as the crematorium activates.", 1)
+ M.show_message("You hear a roar as the crematorium activates.", 1)
cremating = 1
locked = 1
@@ -355,6 +365,15 @@
connected = null
return ..()
+/obj/structure/crematorium/container_resist(var/mob/living/L)
+ var/mob/living/carbon/CM = L
+ if(!istype(CM))
+ return
+ if (CM.stat || CM.restrained())
+ return
+
+ CM << "You attempt to slide yourself out of \the [src]..."
+ src.attack_hand(CM)
/*
* Crematorium tray
diff --git a/code/modules/mob/holder.dm b/code/modules/mob/holder.dm
index 20f82d3a0bc..6b4de5b9c50 100644
--- a/code/modules/mob/holder.dm
+++ b/code/modules/mob/holder.dm
@@ -34,6 +34,25 @@
for(var/mob/living/M in contents)
M.show_message(message,m_type)
+/obj/item/weapon/holder/container_resist(var/mob/living/L)
+ var/mob/M = src.loc //Get our mob holder (if any).
+
+ if(istype(M))
+ M.unEquip(src)
+ M << "[src] wriggles out of your grip!"
+ src << "You wriggle out of [M]'s grip!"
+ else if(istype(src.loc,/obj/item))
+ src << "You struggle free of [src.loc]."
+ src.forceMove(get_turf(src))
+
+ if(istype(M))
+ for(var/atom/A in M.contents)
+ if(istype(A,/mob/living/simple_animal/borer) || istype(A,/obj/item/weapon/holder))
+ return
+ M.status_flags &= ~PASSEMOTES
+
+ return
+
//Mob procs and vars for scooping up
/mob/living/var/holder_type
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index d4d3ca1fdb3..1826658faba 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -499,10 +499,6 @@
var/mob/living/L = usr
- //Getting out of someone's inventory.
- if(istype(src.loc,/obj/item/weapon/holder))
- resist_holder()
-
//Resisting control by an alien mind.
if(istype(src.loc,/mob/living/simple_animal/borer))
resist_borer()
@@ -511,21 +507,15 @@
if ((!(L.stat) && !(L.restrained())))
resist_grab(L) //this passes L because the proc requires a typecasted mob/living instead of just 'src'
- // Sliding out of a morgue/crematorium
- if(loc && (istype(loc, /obj/structure/morgue) || istype(loc, /obj/structure/crematorium)))
- resist_tray(L)
-
- // The doctor left the odysseus unlocked again
- if(src.loc && (istype(loc, /obj/item/mecha_parts/mecha_equipment/tool/sleeper)))
- resist_mecha()
-
//unbuckling yourself
if(L.buckled && (L.last_special <= world.time) )
resist_buckle(L) //this passes L because the proc requires a typecasted mob/living instead of just 'src'
- //Breaking out of a locker?
- else if(src.loc && (istype(src.loc, /obj/structure/closet)))
- resist_closet()
+ //Breaking out of an object?
+ else if(src.loc && istype(src.loc, /obj) && (!isturf(src.loc)))
+ if(stat == CONSCIOUS && !stunned && !weakened && !paralysis)
+ var/obj/C = loc
+ C.container_resist(L)
//breaking out of handcuffs
else if(iscarbon(L))
@@ -544,28 +534,6 @@
RESIST SUBPROCS
*/////////////////////
-/* resist_holder allows small mobs that can be picked up to get out of their holder, so they aren't stuck forever.
-*/////
-/mob/living/proc/resist_holder()
- var/obj/item/weapon/holder/H = src.loc //Get our item holder.
- var/mob/M = H.loc //Get our mob holder (if any).
-
- if(istype(M))
- M.unEquip(H)
- M << "[H] wriggles out of your grip!"
- src << "You wriggle out of [M]'s grip!"
- else if(istype(H.loc,/obj/item))
- src << "You struggle free of [H.loc]."
- H.forceMove(get_turf(H))
-
- if(istype(M))
- for(var/atom/A in M.contents)
- if(istype(A,/mob/living/simple_animal/borer) || istype(A,/obj/item/weapon/holder))
- return
- M.status_flags &= ~PASSEMOTES
-
- return
-
/* resist_borer allows a mob to regain control of their body after a borer has assumed control.
*/////
/mob/living/proc/resist_borer()
@@ -625,17 +593,6 @@
for(var/mob/O in viewers(usr, null))
O.show_message(text("\red [] resists!", L), 1)
-/*
-resist_mecha allows a mob to attempt to escape an exosuit's equipment
-if the doctor let a graytide get in the odysseus, for example
-*/
-/mob/living/proc/resist_mecha()
- // I don't like anything so special-case as this, but I'll try to leave it as extensible as I can
- // --Crazylemon
- if(istype(src.loc, /obj/item/mecha_parts/mecha_equipment/tool/sleeper))
- var/obj/item/mecha_parts/mecha_equipment/tool/sleeper/prison = src.loc
- prison.on_resist(src)
-
/* resist_buckle allows a mob that is bucklecuffed to break free of the chair/bed/whatever
*/////
/mob/living/proc/resist_buckle(var/mob/living/L)
@@ -662,87 +619,6 @@ if the doctor let a graytide get in the odysseus, for example
else
L.buckled.user_unbuckle_mob(L,L)
-/* resist_closet() allows a mob to break out of a welded/locked closet
-*/////
-/mob/living/proc/resist_closet()
- var/breakout_time = 2 //2 minutes by default
- var/mob/living/L = src
- var/obj/structure/closet/C = L.loc
- if(C.opened)
- return //Door's open... wait, why are you in it's contents then?
- if(istype(L.loc, /obj/structure/closet/secure_closet))
- var/obj/structure/closet/secure_closet/SC = L.loc
- if(!SC.locked && !SC.welded)
- return //It's a secure closet, but isn't locked. Easily escapable from, no need to 'resist'
- else
- if(!C.welded)
- return //closed but not welded...
- // else Meh, lets just keep it at 2 minutes for now
- // breakout_time++ //Harder to get out of welded lockers than locked lockers
-
- //okay, so the closet is either welded or locked... resist!!!
- L.changeNext_move(CLICK_CD_BREAKOUT)
- L.last_special = world.time + CLICK_CD_BREAKOUT
- L << "\red You lean on the back of \the [C] and start pushing the door open. (this will take about [breakout_time] minutes)"
- for(var/mob/O in viewers(usr.loc))
- O.show_message("\red The [L.loc] begins to shake violently!", 1)
-
-
- spawn(0)
- if(do_after(usr,(breakout_time*60*10), target = C)) //minutes * 60seconds * 10deciseconds
- if(!C || !L || L.stat != CONSCIOUS || L.loc != C || C.opened) //closet/user destroyed OR user dead/unconcious OR user no longer in closet OR closet opened
- return
-
- //Perform the same set of checks as above for weld and lock status to determine if there is even still a point in 'resisting'...
- if(istype(L.loc, /obj/structure/closet/secure_closet))
- var/obj/structure/closet/secure_closet/SC = L.loc
- if(!SC.locked && !SC.welded)
- return
- else
- if(!C.welded)
- return
-
- //Well then break it!
- if(istype(usr.loc, /obj/structure/closet/secure_closet))
- var/obj/structure/closet/secure_closet/SC = L.loc
- SC.desc = "It appears to be broken."
- SC.icon_state = SC.icon_off
- flick(SC.icon_broken, SC)
- sleep(10)
- flick(SC.icon_broken, SC)
- sleep(10)
- SC.broken = 1
- SC.locked = 0
- SC.update_icon()
- usr << "\red You successfully break out!"
- for(var/mob/O in viewers(L.loc))
- O.show_message("\red \the [usr] successfully broke out of \the [SC]!", 1)
- if(istype(SC.loc, /obj/structure/bigDelivery)) //Do this to prevent contents from being opened into nullspace (read: bluespace)
- var/obj/structure/bigDelivery/BD = SC.loc
- BD.attack_hand(usr)
- SC.open()
- else
- C.welded = 0
- C.update_icon()
- usr << "\red You successfully break out!"
- for(var/mob/O in viewers(L.loc))
- O.show_message("\red \the [usr] successfully broke out of \the [C]!", 1)
- if(istype(C.loc, /obj/structure/bigDelivery)) //nullspace ect.. read the comment above
- var/obj/structure/bigDelivery/BD = C.loc
- BD.attack_hand(usr)
- C.open()
-
-// resist_tray allows a mob to slide themselves out of a morgue or crematorium
-/mob/living/proc/resist_tray(var/mob/living/carbon/CM)
- if(!istype(CM))
- return
- if (usr.stat || usr.restrained())
- return
-
- usr << "You attempt to slide yourself out of \the [loc]..."
- var/obj/structure/S = loc
- S.attack_hand(src)
-
/* resist_stop_drop_roll allows a mob to stop, drop, and roll in order to put out a fire burning on them.
*/////
/mob/living/proc/resist_stop_drop_roll(var/mob/living/carbon/CM)