mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 23:58:07 +01:00
Merge pull request #32 from Petethegoat/issue_1376_fix
Rewrote how handcuffs work. Fixes gcode issue 1376.
This commit is contained in:
@@ -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 << "<span class='warning'>Uh... how do those things work?!</span>"
|
||||
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 <B>[user] is trying to put handcuffs on [C]!</B>", 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("<span class='danger'>[user] is trying to put handcuffs on [C]!</span>", \
|
||||
"<span class='userdanger'>[user] is trying to put handcuffs on [C]!</span>")
|
||||
|
||||
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()]\] <font color='orange'>Has been handcuffed (attempt) by [user.name] ([user.ckey])</font>")
|
||||
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to handcuff [C.name] ([C.ckey])</font>")
|
||||
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("<font color='red'>[user.name] ([user.ckey]) Attempted to handcuff [C.name] ([C.ckey])</font>")
|
||||
C.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been handcuffed (attempt) by [user.name] ([user.ckey])</font>")
|
||||
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to handcuff [C.name] ([C.ckey])</font>")
|
||||
log_attack("<font color='red'>[user.name] ([user.ckey]) Attempted to handcuff [C.name] ([C.ckey])</font>")
|
||||
|
||||
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
|
||||
|
||||
/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("<span class='danger'>[user] is trying to put handcuffs on [C]!</span>", \
|
||||
"<span class='userdanger'>[user] is trying to put handcuffs on [C]!</span>")
|
||||
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)
|
||||
@@ -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("<span class='notice'>[user] cuts [C]'s restraints with [src]!</span>")
|
||||
C.handcuffed = null
|
||||
C.update_inv_handcuffed(0)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user