diff --git a/code/game/objects/items/lockpicks.dm b/code/game/objects/items/lockpicks.dm index 843b0608deb..de8f31e29c0 100644 --- a/code/game/objects/items/lockpicks.dm +++ b/code/game/objects/items/lockpicks.dm @@ -1,4 +1,5 @@ //For bypassing locked /obj/structure/simple_doors +//now with added fence gate support /obj/item/lockpick name = "set of lockpicks" @@ -30,6 +31,23 @@ if(do_after(user, pick_time * D.lock_difficulty)) to_chat(user, span_notice("Success!")) D.locked = FALSE + if(istype(A, /obj/structure/fence/door)) + var/obj/structure/fence/door/D = A + if(!D.locked) //you can pick your nose, but you can't pick an unlocked door + to_chat(user, span_notice("\The [D] isn't locked.")) + return + else if(D.lock_type != pick_type) //make sure our types match + to_chat(user, span_warning("\The [src] can't pick \the [D]. Another tool might work?")) + return + else if(!D.can_pick) //make sure we're actually allowed to bypass it at all + to_chat(user, span_warning("\The [D] can't be [pick_verb]ed.")) + return + else //finally, we can assume that they do match + to_chat(user, span_notice("You start to [pick_verb] the lock on \the [D]...")) + playsound(src, D.keysound,100, 1) + if(do_after(user, pick_time * D.lock_difficulty)) + to_chat(user, span_notice("Success!")) + D.locked = FALSE else if(ishuman(A)) //you can pick your friends, and you can pick your nose, but you can't pick your friend's nose var/mob/living/carbon/human/H = A if(user.zone_sel.selecting == BP_HEAD) diff --git a/code/game/objects/random/misc.dm b/code/game/objects/random/misc.dm index 12ca6d276f4..44e85abefff 100644 --- a/code/game/objects/random/misc.dm +++ b/code/game/objects/random/misc.dm @@ -269,6 +269,7 @@ prob(1);/obj/item/beartrap, prob(1);/obj/item/handcuffs, prob(1);/obj/item/handcuffs/legcuffs, + prob(1);/obj/item/lockpick, prob(2);/obj/item/reagent_containers/syringe/drugs, prob(1);/obj/item/reagent_containers/syringe/steroid) diff --git a/code/game/objects/structures/fence.dm b/code/game/objects/structures/fence.dm index 0237f0c20a9..ca764fa85c4 100644 --- a/code/game/objects/structures/fence.dm +++ b/code/game/objects/structures/fence.dm @@ -69,6 +69,7 @@ return ..() /obj/structure/fence/attackby(obj/item/W, mob/user) + user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) if(W.has_tool_quality(TOOL_WIRECUTTER)) if(!cuttable) to_chat(user, span_warning("This section of the fence can't be cut.")) @@ -122,6 +123,11 @@ cuttable = FALSE var/open = FALSE var/locked = FALSE + var/lock_id = null //does the door have an associated key? + var/lock_type = "simple" //string matched to "pick_type" on /obj/item/lockpick + var/can_pick = TRUE //can it be picked/bypassed? + var/lock_difficulty = 1 //multiplier to picking/bypassing time + var/keysound = 'sound/items/toolbelt_equip.ogg' /obj/structure/fence/door/Initialize() update_door_status() @@ -144,6 +150,23 @@ return TRUE +/obj/structure/fence/door/attackby(obj/item/W as obj, mob/user as mob) + user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) + if(istype(W,/obj/item/simple_key)) + var/obj/item/simple_key/key = W + if(open) + to_chat(user,span_notice("\The [src] must be closed in order for you to lock it.")) + else if(key.key_id != src.lock_id) + to_chat(user,span_warning("The [key] doesn't fit \the [src]'s lock!")) + else if(key.key_id == src.lock_id) + visible_message(span_notice("[user] [key.keyverb] \the [key] and [locked ? "unlocks" : "locks"] \the [src].")) + locked = !locked + playsound(src, keysound,100, 1) + return + else + attack_hand(user) + return + /obj/structure/fence/door/proc/toggle(mob/user) switch(open) if(FALSE) diff --git a/icons/obj/lockpicks.dmi b/icons/obj/lockpicks.dmi index 11880cd0f52..13a284098b8 100644 Binary files a/icons/obj/lockpicks.dmi and b/icons/obj/lockpicks.dmi differ