Breaking out of lockers now has a progress bar + breaking out of lockers now visibly shakes the locker and makes noise (#33180)

* closets

* Update __compile_options.dm

* fix

* fixes

* 2
This commit is contained in:
gurfan
2022-09-01 21:34:18 -05:00
committed by GitHub
parent 8b951338ec
commit ff5b9d7a08
2 changed files with 15 additions and 22 deletions

View File

@@ -627,30 +627,20 @@
return 0
return 1
/obj/structure/closet/container_resist(mob/user)
var/breakout_time = 2 //2 minutes by default
/obj/structure/closet/proc/on_do_after(mob/user, use_user_turf, user_original_location, atom/target, target_original_location, needhand, obj/item/originally_held_item)
. = do_after_default_checks(arglist(args))
if(.)
shake_closet()
if(opened || (!welded && !locked))
return //Door's open, not locked or welded, no point in resisting.
//okay, so the closet is either welded or locked... resist!!!
user.delayNext(DELAY_ALL,100)
/obj/structure/closet/proc/shake_closet()
shake_animation(3, 3, 0.2, 15)
playsound(src, 'sound/effects/grillehit.ogg', 50, 1)
spawn(2)
playsound(src, 'sound/effects/grillehit.ogg', 50, 1)
spawn(2)
playsound(src, 'sound/effects/grillehit.ogg', 50, 1)
to_chat(user, "<span class='notice'>You lean on the back of [src] and start pushing the door open. (this will take about [breakout_time] minutes.)</span>")
for(var/mob/O in viewers(src))
to_chat(O, "<span class='warning'>[src] begins to shake violently!</span>")
var/turf/T = get_turf(src) //Check for moved locker
if(do_after(user, src, (breakout_time*60*10))) //minutes * 60seconds * 10deciseconds
if(!user || user.stat != CONSCIOUS || user.loc != src || opened || (!locked && !welded) || T != get_turf(src))
return
//we check after a while whether there is a point of resisting anymore and whether the user is capable of resisting
welded = 0 //applies to all lockers lockers
locked = 0 //applies to critter crates and secure lockers only
broken = 1 //applies to secure lockers only
visible_message("<span class='danger'>[user] successfully broke out of [src]!</span>")
to_chat(user, "<span class='notice'>You successfully break out of [src]!</span>")
open(user)
/obj/structure/closet/send_to_past(var/duration)
..()
@@ -673,6 +663,9 @@
to_chat(ghost, "It contains: <span class='info'>[counted_english_list(contents)]</span>.")
investigation_log(I_GHOST, "|| had its contents checked by [key_name(ghost)][ghost.locked_to ? ", who was haunting [ghost.locked_to]" : ""]")
// -- Vox raiders.
/obj/structure/closet/loot

View File

@@ -1024,7 +1024,7 @@ Thanks.
L.visible_message("<span class='danger'>The [C] begins to shake violenty!</span>",
"<span class='warning'>You lean on the back of [C] and start pushing the door open (this will take about [breakout_time] minutes).</span>")
spawn(0)
if(do_after(usr,src,breakout_time * 60 * 10)) //minutes * 60seconds * 10deciseconds
if(do_after(usr, C, breakout_time * 60 * 10, 30, custom_checks = new /callback(C, /obj/structure/closet/proc/on_do_after))) //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