From afdafb3862ad0b5d88207fcdaad023c5d53d4b4f Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Fri, 5 Feb 2016 10:37:09 +0100 Subject: [PATCH 1/2] Makes the into-resist proc solely responsible for checking click delays. Because it sets the click cooldown itself downstream procs fail when they in turn check the click delay. Fixes #11839. Fixes #12062. Fixes #12114. --- code/game/objects/structures/crates_lockers/closets.dm | 3 --- code/modules/mob/living/carbon/resist.dm | 3 --- code/modules/mob/living/living.dm | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index b9b71491968..1bea9dfe15a 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -331,9 +331,6 @@ if(!req_breakout()) return - if(!escapee.canClick()) - return - escapee.setClickCooldown(100) //okay, so the closet is either welded or locked... resist!!! diff --git a/code/modules/mob/living/carbon/resist.dm b/code/modules/mob/living/carbon/resist.dm index 8bd8822132f..eb15ced89b0 100644 --- a/code/modules/mob/living/carbon/resist.dm +++ b/code/modules/mob/living/carbon/resist.dm @@ -155,9 +155,6 @@ return ..() /mob/living/carbon/escape_buckle() - if(!canClick()) - return - setClickCooldown(100) if(!buckled) return diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index a5503146570..374ade2f219 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -580,7 +580,7 @@ default behaviour is: set name = "Resist" set category = "IC" - if(!(stat || next_move > world.time)) + if(!stat && canClick()) setClickCooldown(20) resist_grab() if(!weakened) From 36c99aecaeb1cafad4217400fd3010e7973c6277 Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Sun, 21 Feb 2016 14:22:43 +0100 Subject: [PATCH 2/2] Closet breakout no longer failes early. Caused by req_breakout() always making us quit early if we're already breaking out. Breakout sound/animation now play after the checks. Fixes the secure locker break_open() override, which wouldn't update the welded flag and thus keep you imprisoned. Fixes a couple of bad macros. --- .../structures/crates_lockers/closets.dm | 17 ++++++++--------- .../closets/secure/secure_closets.dm | 19 +++++-------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 1bea9dfe15a..546621024eb 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -317,8 +317,6 @@ return 1 /obj/structure/closet/proc/req_breakout() - if(breakout) - return 0 //Already breaking out. if(opened) return 0 //Door's open... wait, why are you in it's contents then? if(!welded) @@ -328,7 +326,7 @@ /obj/structure/closet/proc/mob_breakout(var/mob/living/escapee) var/breakout_time = 2 //2 minutes by default - if(!req_breakout()) + if(breakout || !req_breakout()) return escapee.setClickCooldown(100) @@ -336,17 +334,14 @@ //okay, so the closet is either welded or locked... resist!!! escapee << "You lean on the back of \the [src] and start pushing the door open. (this will take about [breakout_time] minutes)" - visible_message("The [src] begins to shake violently!") + visible_message("\The [src] begins to shake violently!") breakout = 1 //can't think of a better way to do this right now. for(var/i in 1 to (6*breakout_time * 2)) //minutes * 6 * 5seconds * 2 - playsound(src.loc, 'sound/effects/grillehit.ogg', 100, 1) - animate_shake() - if(!do_after(escapee, 50)) //5 seconds breakout = 0 return - if(!escapee || escapee.stat || escapee.loc != src) + if(!escapee || escapee.incapacitated() || escapee.loc != src) breakout = 0 return //closet/user destroyed OR user dead/unconcious OR user no longer in closet OR closet opened //Perform the same set of checks as above for weld and lock status to determine if there is even still a point in 'resisting'... @@ -354,10 +349,14 @@ breakout = 0 return + playsound(src.loc, 'sound/effects/grillehit.ogg', 100, 1) + animate_shake() + add_fingerprint(escapee) + //Well then break it! breakout = 0 escapee << "You successfully break out!" - visible_message("\the [escapee] successfully broke out of \the [src]!") + visible_message("\The [escapee] successfully broke out of \the [src]!") playsound(src.loc, 'sound/effects/grillehit.ogg', 100, 1) break_open() animate_shake() 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 395eb13df04..e3ea31375e2 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 @@ -129,8 +129,11 @@ /obj/structure/closet/secure_closet/update_icon()//Putting the welded stuff in updateicon() so it's easy to overwrite for special cases (Fridges, cabinets, and whatnot) overlays.Cut() + if(!opened) - if(locked) + if(broken) + icon_state = icon_off + else if(locked) icon_state = icon_locked else icon_state = icon_closed @@ -139,24 +142,12 @@ else icon_state = icon_opened - /obj/structure/closet/secure_closet/req_breakout() if(!opened && locked) return 1 return ..() //It's a secure closet, but isn't locked. /obj/structure/closet/secure_closet/break_open() desc += " It appears to be broken." - icon_state = icon_off - spawn() - flick(icon_broken, src) - sleep(10) - flick(icon_broken, src) - sleep(10) broken = 1 locked = 0 - update_icon() - //Do this to prevent contents from being opened into nullspace (read: bluespace) - if(istype(loc, /obj/structure/bigDelivery)) - var/obj/structure/bigDelivery/BD = loc - BD.unwrap() - open() \ No newline at end of file + ..()