From ad8b82ce0538bc2a8590b09b3ed215a2bc66b4b6 Mon Sep 17 00:00:00 2001
From: Novacat <35587478+Novacat@users.noreply.github.com>
Date: Mon, 15 Feb 2021 20:32:27 -0500
Subject: [PATCH] Merge pull request #9727 from VOREStation/upstream-merge-7844
[MIRROR] Makes wrenches only anchor lockers if they're open
---
.../structures/crates_lockers/__closets.dm | 26 ++++++++++---------
.../closets/secure/secure_closets.dm | 26 ++++++++++---------
2 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/code/game/objects/structures/crates_lockers/__closets.dm b/code/game/objects/structures/crates_lockers/__closets.dm
index 2706e11bd3..f7e399a267 100644
--- a/code/game/objects/structures/crates_lockers/__closets.dm
+++ b/code/game/objects/structures/crates_lockers/__closets.dm
@@ -260,7 +260,20 @@
return
/obj/structure/closet/attackby(obj/item/weapon/W as obj, mob/user as mob)
- if(opened)
+ if(W.is_wrench())
+ if(opened)
+ if(anchored)
+ user.visible_message("\The [user] begins unsecuring \the [src] from the floor.", "You start unsecuring \the [src] from the floor.")
+ else
+ user.visible_message("\The [user] begins securing \the [src] to the floor.", "You start securing \the [src] to the floor.")
+ if(do_after(user, 20 * W.toolspeed))
+ if(!src) return
+ to_chat(user, "You [anchored? "un" : ""]secured \the [src]!")
+ anchored = !anchored
+ return
+ else
+ to_chat(user, "You can't reach the anchoring bolts when the door is closed!")
+ else if(opened)
if(istype(W, /obj/item/weapon/grab))
var/obj/item/weapon/grab/G = W
MouseDrop_T(G.affecting, user) //act like they were dragged onto the closet
@@ -316,17 +329,6 @@
update_icon()
for(var/mob/M in viewers(src))
M.show_message("[src] has been [sealed?"sealed":"unsealed"] by [user.name].", 3)
- else if(W.is_wrench())
- if(sealed)
- if(anchored)
- user.visible_message("\The [user] begins unsecuring \the [src] from the floor.", "You start unsecuring \the [src] from the floor.")
- else
- user.visible_message("\The [user] begins securing \the [src] to the floor.", "You start securing \the [src] to the floor.")
- playsound(src, W.usesound, 50)
- if(do_after(user, 20 * W.toolspeed))
- if(!src) return
- to_chat(user, "You [anchored? "un" : ""]secured \the [src]!")
- anchored = !anchored
else
attack_hand(user)
return
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 e5fc47c64a..9fae830b44 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
@@ -54,7 +54,20 @@
to_chat(user, "Access Denied")
/obj/structure/closet/secure_closet/attackby(obj/item/weapon/W as obj, mob/user as mob)
- if(opened)
+ if(W.is_wrench())
+ if(opened)
+ if(anchored)
+ user.visible_message("\The [user] begins unsecuring \the [src] from the floor.", "You start unsecuring \the [src] from the floor.")
+ else
+ user.visible_message("\The [user] begins securing \the [src] to the floor.", "You start securing \the [src] to the floor.")
+ if(do_after(user, 20 * W.toolspeed))
+ if(!src) return
+ to_chat(user, "You [anchored? "un" : ""]secured \the [src]!")
+ anchored = !anchored
+ return
+ else
+ to_chat(user, "You can't reach the anchoring bolts when the door is closed!")
+ else if(opened)
if(istype(W, /obj/item/weapon/storage/laundry_basket))
return ..(W,user)
if(istype(W, /obj/item/weapon/grab))
@@ -77,17 +90,6 @@
spark_system.start()
playsound(src, 'sound/weapons/blade1.ogg', 50, 1)
playsound(src, "sparks", 50, 1)
- else if(W.is_wrench())
- if(sealed)
- if(anchored)
- user.visible_message("\The [user] begins unsecuring \the [src] from the floor.", "You start unsecuring \the [src] from the floor.")
- else
- user.visible_message("\The [user] begins securing \the [src] to the floor.", "You start securing \the [src] to the floor.")
- if(do_after(user, 20 * W.toolspeed))
- if(!src) return
- to_chat(user, "You [anchored? "un" : ""]secured \the [src]!")
- anchored = !anchored
- return
else if(istype(W,/obj/item/weapon/packageWrap) || istype(W,/obj/item/weapon/weldingtool))
return ..(W,user)
else