Unlocking secure lockers (#5305)

This makes personal closet not being able to lock/unlock from the inside. Fixes #5302
This commit is contained in:
Mykhailo Bykhovtsev
2018-09-30 00:55:23 +03:00
committed by Erki
parent ca00c3f467
commit d37b8248bd
3 changed files with 33 additions and 18 deletions
@@ -53,10 +53,13 @@
else
user.drop_item()
else if(W.GetID())
if(user.loc == src)
to_chat(user, "<span class='notice'>You can't reach the lock from inside.</span>")
return
var/obj/item/weapon/card/id/I = W.GetID()
if(broken)
user << "<span class='warning'>It appears to be broken.</span>"
to_chat(user, "<span class='warning'>It appears to be broken.</span>")
return
if(!I || !I.registered_name) return
if(allowed(user) || !registered_name || (istype(I) && (registered_name == I.registered_name)))
@@ -69,14 +72,14 @@
registered_name = I.registered_name
desc = "Owned by [I.registered_name]."
else
user << "<span class='warning'>Access Denied</span>"
to_chat(user, "<span class='warning'>Access Denied</span>")
else if(istype(W, /obj/item/weapon/melee/energy/blade))
if(emag_act(INFINITY, user, "The locker has been sliced open by [user] with \an [W]!", "You hear metal being sliced and sparks flying."))
W:spark_system.queue()
playsound(loc, 'sound/weapons/blade1.ogg', 50, 1)
playsound(loc, "sparks", 50, 1)
else
user << "<span class='warning'>Access Denied</span>"
to_chat(user, "<span class='warning'>Access Denied</span>")
return
/obj/structure/closet/secure_closet/personal/emag_act(var/remaining_charges, var/mob/user, var/visual_feedback, var/audible_feedback)
@@ -50,13 +50,13 @@
/obj/structure/closet/secure_closet/proc/togglelock(mob/user as mob)
if(opened)
user << "<span class='notice'>Close the locker first.</span>"
to_chat(user, "<span class='notice'>Close the locker first.</span>")
return
if(broken)
user << "<span class='warning'>The locker appears to be broken.</span>"
to_chat(user, "<span class='warning'>The locker appears to be broken.</span>")
return
if(user.loc == src)
user << "<span class='notice'>You can't reach the lock from inside.</span>"
to_chat(user, "<span class='notice'>You can't reach the lock from inside.</span>")
return
if(allowed(user))
locked = !locked
@@ -65,7 +65,7 @@
O << "<span class='notice'>The locker has been [locked ? null : "un"]locked by [user].</span>"
update_icon()
else
user << "<span class='notice'>Access Denied</span>"
to_chat(user, "<span class='notice'>Access Denied</span>")
/obj/structure/closet/secure_closet/proc/CanChainsaw(var/obj/item/weapon/material/twohanded/chainsaw/ChainSawVar)
return (ChainSawVar.powered && !opened && !broken)
@@ -77,7 +77,7 @@
if(large)
MouseDrop_T(G.affecting, user) //act like they were dragged onto the closet
else
user << "<span class='notice'>The locker is too small to stuff [G.affecting] into!</span>"
to_chat(user, "<span class='notice'>The locker is too small to stuff [G.affecting] into!</span>")
if(iswelder(W))
var/obj/item/weapon/weldingtool/WT = W
if(WT.isOn())
@@ -90,7 +90,7 @@
if (!do_after(user, 2 SECONDS, act_target = src, extra_checks = CALLBACK(src, .proc/is_open)))
return
if(!WT.remove_fuel(0,user))
user << "<span class='notice'>You need more welding fuel to complete this task.</span>"
to_chat(user, "<span class='notice'>You need more welding fuel to complete this task.</span>")
return
else
new /obj/item/stack/material/steel(loc)
@@ -110,33 +110,33 @@
user.drop_item()
else if(isscrewdriver(W) && canbemoved)
if(screwed)
user << "<span class='notice'>You start to unscrew the locker from the floor...</span>"
to_chat(user, "<span class='notice'>You start to unscrew the locker from the floor...</span>")
playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1)
if (do_after(user, 10 SECONDS, act_target = src))
user << "<span class='notice'>You unscrew the locker!</span>"
to_chat(user, "<span class='notice'>You unscrew the locker!</span>")
playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1)
screwed = 0
else if(!screwed && wrenched)
user << "<span class='notice'>You start to screw the locker to the floor...</span>"
to_chat(user, "<span class='notice'>You start to screw the locker to the floor...</span>")
playsound(src, 'sound/items/Welder.ogg', 80, 1)
if (do_after(user, 15, act_target = src))
user << "<span class='notice'>You screw the locker!</span>"
to_chat(user, "<span class='notice'>You screw the locker!</span>")
playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1)
screwed = 1
else if(iswrench(W) && canbemoved)
if(wrenched && !screwed)
user << "<span class='notice'>You start to unfasten the bolts holding the locker in place...</span>"
to_chat(user, "<span class='notice'>You start to unfasten the bolts holding the locker in place...</span>")
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
if (do_after(user, 15 SECONDS, act_target = src))
user << "<span class='notice'>You unfasten the locker's bolts!</span>"
to_chat(user, "<span class='notice'>You unfasten the locker's bolts!</span>")
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
wrenched = 0
anchored = 0
else if(!wrenched)
user << "<span class='notice'>You start to fasten the bolts holding the locker in place...</span>"
to_chat(user, "<span class='notice'>You start to fasten the bolts holding the locker in place...</span>")
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
if (do_after(user, 15, act_target = src))
user << "<span class='notice'>You fasten the locker's bolts!</span>"
to_chat(user, "<span class='notice'>You fasten the locker's bolts!</span>")
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
wrenched = 1
anchored = 1
@@ -175,7 +175,7 @@
if (!do_after(user, 2 SECONDS, act_target = src, extra_checks = CALLBACK(src, .proc/is_closed)))
return
if(!WT.remove_fuel(0,user))
user << "<span class='notice'>You need more welding fuel to complete this task.</span>"
to_chat(user, "<span class='notice'>You need more welding fuel to complete this task.</span>")
return
welded = !welded
update_icon()