diff --git a/code/game/objects/items/weapons/handcuffs.dm b/code/game/objects/items/weapons/handcuffs.dm index dbaf66fbbe7..fa7ab4774dd 100644 --- a/code/game/objects/items/weapons/handcuffs.dm +++ b/code/game/objects/items/weapons/handcuffs.dm @@ -12,85 +12,44 @@ throw_range = 5 m_amt = 500 origin_tech = "materials=1" - var/dispenser = 0 var/breakouttime = 1200 //Deciseconds = 120s = 2 minutes -/obj/item/weapon/handcuffs/attack(mob/living/carbon/C as mob, mob/user as mob) - if(istype(src, /obj/item/weapon/handcuffs/cyborg) && isrobot(user)) + +/obj/item/weapon/handcuffs/attack(mob/living/carbon/C, mob/user) + if(CLUMSY in user.mutations && prob(50)) + user << "Uh... how do those things work?!" if(!C.handcuffed) - var/turf/p_loc = user.loc - var/turf/p_loc_m = C.loc - playsound(src.loc, 'sound/weapons/handcuffs.ogg', 30, 1, -2) - for(var/mob/O in viewers(user, null)) - O.show_message("\red [user] is trying to put handcuffs on [C]!", 1) - spawn(30) - if(!C) return - if(p_loc == user.loc && p_loc_m == C.loc) - C.handcuffed = new /obj/item/weapon/handcuffs(C) - C.update_inv_handcuffed(0) + user.drop_item() + loc = C + C.handcuffed = src + C.update_inv_handcuffed(0) + return - else - if ((CLUMSY in usr.mutations) && prob(50)) - usr << "\red Uh ... how do those things work?!" - if (istype(C, /mob/living/carbon/human)) - if(!C.handcuffed) - var/obj/effect/equip_e/human/O = new /obj/effect/equip_e/human( ) - O.source = user - O.target = user - O.item = user.get_active_hand() - O.s_loc = user.loc - O.t_loc = user.loc - O.place = "handcuff" - C.requests += O - spawn( 0 ) - O.process() + if(!C.handcuffed) + C.visible_message("[user] is trying to put handcuffs on [C]!", \ + "[user] is trying to put handcuffs on [C]!") + + var/turf/user_loc = user.loc + var/turf/C_loc = C.loc + if(do_after(user, 50)) + if(!C || C.handcuffed) return - return - if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey") - usr << "\red You don't have the dexterity to do this!" - return - if (istype(C, /mob/living/carbon/human)) - if(!C.handcuffed) - C.attack_log += text("\[[time_stamp()]\] Has been handcuffed (attempt) by [user.name] ([user.ckey])") - user.attack_log += text("\[[time_stamp()]\] Attempted to handcuff [C.name] ([C.ckey])") + if(user_loc == user.loc && C_loc == C.loc) + user.drop_item() + loc = C + C.handcuffed = src + C.update_inv_handcuffed(0) + if(istype(src, /obj/item/weapon/handcuffs/cable)) + feedback_add_details("handcuffs","C") + playsound(loc, 'sound/weapons/cablecuff.ogg', 30, 1, -2) + else + feedback_add_details("handcuffs","H") + playsound(loc, 'sound/weapons/handcuffs.ogg', 30, 1, -2) - log_attack("[user.name] ([user.ckey]) Attempted to handcuff [C.name] ([C.ckey])") + C.attack_log += text("\[[time_stamp()]\] Has been handcuffed (attempt) by [user.name] ([user.ckey])") + user.attack_log += text("\[[time_stamp()]\] Attempted to handcuff [C.name] ([C.ckey])") + log_attack("[user.name] ([user.ckey]) Attempted to handcuff [C.name] ([C.ckey])") - var/obj/effect/equip_e/human/O = new /obj/effect/equip_e/human( ) - O.source = user - O.target = C - O.item = user.get_active_hand() - O.s_loc = user.loc - O.t_loc = C.loc - O.place = "handcuff" - C.requests += O - spawn( 0 ) - if(istype(src, /obj/item/weapon/handcuffs/cable)) - feedback_add_details("handcuffs","C") - playsound(src.loc, 'sound/weapons/cablecuff.ogg', 30, 1, -2) - else - feedback_add_details("handcuffs","H") - playsound(src.loc, 'sound/weapons/handcuffs.ogg', 30, 1, -2) - O.process() - return - else - if(!C.handcuffed) - var/obj/effect/equip_e/monkey/O = new /obj/effect/equip_e/monkey( ) - O.source = user - O.target = C - O.item = user.get_active_hand() - O.s_loc = user.loc - O.t_loc = C.loc - O.place = "handcuff" - C.requests += O - spawn( 0 ) - if(istype(src, /obj/item/weapon/handcuffs/cable)) - playsound(src.loc, 'sound/weapons/cablecuff.ogg', 30, 1, -2) - else - playsound(src.loc, 'sound/weapons/handcuffs.ogg', 30, 1, -2) - O.process() - return - return /obj/item/weapon/handcuffs/cable name = "cable restraints" @@ -122,5 +81,18 @@ /obj/item/weapon/handcuffs/cable/white icon_state = "cuff_white" -/obj/item/weapon/handcuffs/cyborg - dispenser = 1 \ No newline at end of file + +/obj/item/weapon/handcuffs/cyborg/attack(mob/living/carbon/C, mob/user) + if(isrobot(user)) + if(!C.handcuffed) + var/turf/user_loc = user.loc + var/turf/C_loc = C.loc + playsound(loc, 'sound/weapons/handcuffs.ogg', 30, 1, -2) + C.visible_message("[user] is trying to put handcuffs on [C]!", \ + "[user] is trying to put handcuffs on [C]!") + if(do_after(user, 30)) + if(!C || C.handcuffed) + return + if(user_loc == user.loc && C_loc == C.loc) + C.handcuffed = new /obj/item/weapon/handcuffs(C) + C.update_inv_handcuffed(0) \ No newline at end of file diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index ec57ee9fcde..a72a899ef8e 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -112,11 +112,9 @@ icon_state = "cutters-y" item_state = "cutters_yellow" -/obj/item/weapon/wirecutters/attack(mob/living/carbon/C as mob, mob/user as mob) - if((C.handcuffed) && (istype(C.handcuffed, /obj/item/weapon/handcuffs/cable))) - usr.visible_message("\The [usr] cuts \the [C]'s restraints with \the [src]!",\ - "You cut \the [C]'s restraints with \the [src]!",\ - "You hear cable being cut.") +/obj/item/weapon/wirecutters/attack(mob/living/carbon/C, mob/user) + if(C.handcuffed && istype(C.handcuffed, /obj/item/weapon/handcuffs/cable)) + user.visible_message("[user] cuts [C]'s restraints with [src]!") C.handcuffed = null C.update_inv_handcuffed(0) return