allow resisting out of straight jackets (but you can break your arms doing it and broken arms let you do it faster) (#31195)

* allow resisting out of straight jackets

* with blackjack and hookers

* removed arms also help, robotic arms cannot be broken and never help
This commit is contained in:
DamianX
2021-11-11 00:16:06 +01:00
committed by GitHub
parent 8e4d47909a
commit b8dad0d4c9

View File

@@ -1124,125 +1124,90 @@ Thanks.
ExtinguishMob()
return
//breaking out of handcuffs
if(CM.handcuffed && CM.canmove)
if(isalienadult(CM) || (M_HULK in usr.mutations))//Don't want to do a lot of logic gating here.
CM.visible_message("<span class='danger'>[CM] is trying to break the handcuffs!</span>",
"<span class='warning'>You attempt to break your handcuffs. (This will take around five seconds and you will need to stand still).</span>")
spawn(0)
if(do_after(CM, CM, 50))
if(!CM.handcuffed || CM.locked_to)
return
CM.visible_message("<span class='danger'>[CM] manages to break \the [CM.handcuffed]!</span>",
"<span class='notice'>You successfully break \the [CM.handcuffed].</span>")
if(!isalien(CM))
CM.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
var/obj/item/cuffs = CM.handcuffed
CM.drop_from_inventory(cuffs)
if(!cuffs.gcDestroyed) //If these were not qdel'd already (exploding cuffs, anyone?)
qdel(cuffs)
else
to_chat(CM, "<span class='warning'>Your cuff breaking attempt was interrupted.</span>")
else
var/obj/item/HC = CM.handcuffed
var/resist_time = HC.restraint_resist_time
if(!(resist_time))
resist_time = 2 MINUTES //Default
CM.visible_message("<span class='danger'>[CM] attempts to remove \the [HC]!</span>",
"<span class='warning'>You attempt to remove \the [HC] (this will take around [(resist_time)/600] minutes and you need to stand still).</span>",
self_drugged_message="<span class='warning'>You attempt to regain control of your hands (this will take a while).</span>")
spawn(0)
if(do_after(CM,CM, resist_time))
if(!CM.handcuffed || CM.locked_to)
return // time leniency for lag which also might make this whole thing pointless but the server
CM.visible_message("<span class='danger'>[CM] manages to remove \the [HC]!</span>",
"<span class='notice'>You successfully remove \the [HC].</span>",
self_drugged_message="<span class='notice'>You successfully regain control of your hands.</span>")
CM.drop_from_inventory(HC)
else
CM.simple_message("<span class='warning'>Your attempt to remove \the [HC] was interrupted.</span>",
"<span class='warning'>Your attempt to regain control of your hands was interrupted. Damn it!</span>")
else if(CM.legcuffed && CM.canmove)
if(isalienadult(CM) || (M_HULK in usr.mutations))//Don't want to do a lot of logic gating here.
CM.visible_message("<span class='danger'>[CM] is trying to break the legcuffs!</span>",
"<span class='warning'>You attempt to break your legcuffs. (This will take around five seconds and you need to stand still).</span>")
spawn(0)
if(do_after(CM, CM, 50))
if(!CM.legcuffed || CM.locked_to)
return
CM.visible_message("<span class='danger'>[CM] manages to break the legcuffs!</span>",
"<span class='notice'>You successfully break your legcuffs.</span>")
if(!isalien(CM))
CM.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
qdel(CM.legcuffed)
CM.legcuffed = null
CM.update_inv_legcuffed()
else
to_chat(CM, "<span class='warning'>Your legcuffing breaking attempt was interrupted.</span>")
else
var/obj/item/weapon/legcuffs/HC = CM.legcuffed
var/breakouttime = HC.breakouttime
if(!(breakouttime))
breakouttime = 1200 //Default
CM.visible_message("<span class='danger'>[CM] attempts to remove [HC]!</span>",
"<span class='warning'>You attempt to remove [HC]. (This will take around [(breakouttime)/600] minutes and you need to stand still).</span>")
spawn(0)
if(do_after(CM, CM, breakouttime))
if(!CM.legcuffed || CM.locked_to)
return // time leniency for lag which also might make this whole thing pointless but the server
CM.visible_message("<span class='danger'>[CM] manages to remove [HC]!</span>",
"<span class='notice'>You successfully remove [HC].</span>")
CM.legcuffed.forceMove(usr.loc)
CM.legcuffed = null
CM.update_inv_legcuffed()
else
to_chat(CM, "<span class='warning'>Your unlegcuffing attempt was interrupted.</span>")
else if(CM.mutual_handcuffs && CM.canmove)
if(isalienadult(CM) || (M_HULK in usr.mutations))//Don't want to do a lot of logic gating here.
CM.visible_message("<span class='danger'>[CM] is trying to break the handcuffs!</span>",
"<span class='warning'>You attempt to break your handcuffs. (This will take around five seconds and you will need to stand still).</span>")
spawn(0)
if(do_after(CM, CM, 50))
if(!CM.mutual_handcuffs || CM.locked_to)
return
CM.visible_message("<span class='danger'>[CM] manages to break \the [CM.mutual_handcuffs]!</span>",
"<span class='notice'>You successfully break \the [CM.mutual_handcuffs].</span>")
if(!isalien(CM))
CM.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
var/obj/item/cuffs = CM.mutual_handcuffs
CM.drop_from_inventory(cuffs)
if(!cuffs.gcDestroyed) //If these were not qdel'd already (exploding cuffs, anyone?)
qdel(cuffs)
else
to_chat(CM, "<span class='warning'>Your cuff breaking attempt was interrupted.</span>")
else
var/obj/item/HC = CM.mutual_handcuffs
var/resist_time = 1 MINUTES // 1 minute since it's only one cuff
CM.visible_message("<span class='danger'>[CM] attempts to remove \the [HC]!</span>",
"<span class='warning'>You attempt to remove \the [HC] (this will take around [(resist_time)/600] minutes and you need to stand still).</span>",
self_drugged_message="<span class='warning'>You attempt to regain control of your hands (this will take a while).</span>")
spawn(0)
if(do_after(CM,CM, resist_time))
if(!CM.mutual_handcuffs || CM.locked_to)
return // time leniency for lag which also might make this whole thing pointless but the server
CM.visible_message("<span class='danger'>[CM] manages to remove \the [HC]!</span>",
"<span class='notice'>You successfully remove \the [HC].</span>",
self_drugged_message="<span class='notice'>You successfully regain control of your hands.</span>")
CM.drop_from_inventory(HC)
else
CM.simple_message("<span class='warning'>Your attempt to remove \the [HC] was interrupted.</span>",
"<span class='warning'>Your attempt to regain control of your hands was interrupted. Damn it!</span>")
CM.resist_restraints()
//unsticking from a rooting trap, such as a sticky web or a blood nail
if (istype(L.locked_to, /obj/effect/rooting_trap/))
var/obj/effect/rooting_trap/RT = L.locked_to
RT.unstick_attempt(L)
/mob/living/carbon/proc/resist_restraints()
if(!canmove)
return
var/is_hulk = isalienadult(src) || (M_HULK in mutations)
var/obj/item/cuffs
var/resist_time
var/var_to_check // TOOD: Improve this once Lummox releases pointers?
var/do_after_callback
if(handcuffed)
cuffs = handcuffed
resist_time = is_hulk ? 5 SECONDS : cuffs.restraint_resist_time
if(!resist_time)
resist_time = 2 MINUTES //Default
var_to_check = "handcuffed"
else if(legcuffed)
cuffs = legcuffed
var/obj/item/weapon/legcuffs/legcuffs = cuffs
resist_time = is_hulk ? 5 SECONDS : legcuffs.breakouttime
if(!resist_time)
resist_time = 2 MINUTES // Default
var_to_check = "legcuffed"
else if(mutual_handcuffs)
cuffs = mutual_handcuffs
resist_time = is_hulk ? 5 SECONDS : 1 MINUTES // 1 minute since it's only one cuff
var_to_check = "mutual_handcuffs"
else if(is_wearing_item(/obj/item/clothing/suit/straight_jacket, slot_wear_suit))
cuffs = get_item_by_slot(slot_wear_suit)
if(is_hulk)
resist_time = 5 SECONDS
else
do_after_callback = new /callback(GLOBAL_PROC, /proc/straight_jacket_resist_do_after)
resist_time = 2 MINUTES // Default
var/left_arm = get_organ(LIMB_LEFT_ARM)
var/right_arm = get_organ(LIMB_RIGHT_ARM)
for(var/datum/organ/external/arm in list(left_arm, right_arm))
if(!arm.is_existing() || arm.is_broken())
resist_time -= 30 SECONDS
var_to_check = "wear_suit"
else
return
visible_message("<span class='danger'>[src] attempts to [is_hulk ? "break" : "remove"] \the [cuffs]!</span>",
"<span class='warning'>You attempt to [is_hulk ? "break" : "remove"] \the [cuffs] (this will take around [resist_time / 10] seconds and you need to stand still).</span>",
self_drugged_message="<span class='warning'>You attempt to regain control of your hands (this will take a while).</span>")
spawn(0)
if(do_after(src, src, resist_time, custom_checks = do_after_callback))
if(vars[var_to_check] != cuffs || locked_to)
return
drop_from_inventory(cuffs)
if(is_hulk)
visible_message("<span class='danger'>[src] manages to break \the [cuffs]!</span>",
"<span class='notice'>You successfully break \the [cuffs].</span>")
if(!isalien(src))
say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
qdel(cuffs)
else
visible_message("<span class='danger'>[src] manages to remove \the [cuffs]!</span>",
"<span class='notice'>You successfully remove \the [cuffs].</span>",
self_drugged_message="<span class='notice'>You successfully regain control of your hands.</span>")
else
simple_message("<span class='warning'>Your attempt at [is_hulk ? "breaking" : "removing"] \the [cuffs] was interrupted.</span>",
"<span class='warning'>Your attempt to regain control of your hands was interrupted. Damn it!</span>")
/proc/straight_jacket_resist_do_after(mob/living/carbon/user)
var/left_arm = user.get_organ(LIMB_LEFT_ARM)
var/right_arm = user.get_organ(LIMB_RIGHT_ARM)
for(var/datum/organ/external/arm in list(left_arm, right_arm))
if(!arm)
// Not a humanoid or something
continue
if(!arm.is_existing() || arm.is_broken() || !arm.is_organic())
continue
if(prob(5))
arm.fracture()
return FALSE
return TRUE
/mob/living/verb/lay_down()
set name = "Rest"
set category = "IC"