From 3dffd7b8d4ef9c71ce424990b0a2e1ff7620f046 Mon Sep 17 00:00:00 2001 From: forest2001 Date: Sat, 10 Feb 2024 21:28:52 +0000 Subject: [PATCH] wor --- code/game/objects/items/legcuffs.dm | 57 ++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items/legcuffs.dm b/code/game/objects/items/legcuffs.dm index c0dfe44728f0..b7201937a290 100644 --- a/code/game/objects/items/legcuffs.dm +++ b/code/game/objects/items/legcuffs.dm @@ -8,7 +8,57 @@ throwforce = 0 w_class = SIZE_MEDIUM - var/breakouttime = 15 SECONDS + var/breakouttime = 1 MINUTES + /// how many deciseconds it takes to cuff someone + var/cuff_delay = 4 SECONDS + /// If can be applied to people manually + var/manual = TRUE + +/obj/item/legcuffs/attack(mob/living/carbon/C, mob/user) + if(!istype(C) || !manual) + return ..() + if (!istype(user, /mob/living/carbon/human)) + to_chat(user, SPAN_DANGER("You don't have the dexterity to do this!")) + return + if(!C.legcuffed) + apply_legcuffs(C, user) + +/obj/item/legcuffs/proc/apply_legcuffs(mob/living/carbon/target, mob/user) + playsound(src.loc, 'sound/weapons/handcuffs.ogg', 25, 1, 4) + + if(user.action_busy) + return FALSE + + if (ishuman(target)) + var/mob/living/carbon/human/H = target + + if (!H.has_limb_for_slot(WEAR_LEGCUFFS)) + to_chat(user, SPAN_DANGER("\The [H] needs two ankles before you can cuff them together!")) + return FALSE + + H.attack_log += text("\[[time_stamp()]\] Has been legcuffed (attempt) by [key_name(user)]") + user.attack_log += text("\[[time_stamp()]\] Attempted to legcuff [key_name(H)]") + msg_admin_attack("[key_name(user)] attempted to legcuff [key_name(H)] in [get_area(src)] ([src.loc.x],[src.loc.y],[src.loc.z]).", src.loc.x, src.loc.y, src.loc.z) + + user.visible_message(SPAN_NOTICE("[user] tries to put [src] on [H].")) + if(do_after(user, cuff_delay, INTERRUPT_MOVED, BUSY_ICON_HOSTILE, H, INTERRUPT_MOVED, BUSY_ICON_GENERIC)) + if(src == user.get_active_hand() && !H.legcuffed && Adjacent(user)) + if(iscarbon(H)) + if(istype(H.buckled, /obj/structure/bed/roller)) + to_chat(user, SPAN_DANGER("You cannot legcuff someone who is buckled onto a roller bed.")) + return FALSE + if(H.has_limb_for_slot(WEAR_LEGCUFFS)) + user.drop_inv_item_on_ground(src) + H.equip_to_slot_if_possible(src, WEAR_LEGCUFFS, 1, 0, 1, 1) + user.count_niche_stat(STATISTICS_NICHE_HANDCUFF) + + else if (ismonkey(target)) + user.visible_message(SPAN_NOTICE("[user] tries to put [src] on [target].")) + if(do_after(user, 30, INTERRUPT_MOVED, BUSY_ICON_HOSTILE, target, INTERRUPT_MOVED, BUSY_ICON_GENERIC)) + if(src == user.get_active_hand() && !target.legcuffed && Adjacent(user)) + user.drop_inv_item_on_ground(src) + target.equip_to_slot_if_possible(src, WEAR_LEGCUFFS, 1, 0, 1, 1) + return TRUE /obj/item/legcuffs/beartrap name = "bear trap" @@ -16,7 +66,12 @@ throw_range = 1 icon_state = "beartrap0" desc = "A trap used to catch bears and other legged creatures." + breakouttime = 20 SECONDS var/armed = FALSE + manual = FALSE + +/obj/item/legcuffs/beartrap/apply_legcuffs(mob/living/carbon/target, mob/user) + return FALSE /obj/item/legcuffs/beartrap/attack_self(mob/user as mob) ..()