Handcuff refactor, IV drip fix

This commit is contained in:
Markolie
2015-02-14 04:35:32 +01:00
parent e15975e008
commit 9fed8135d4
49 changed files with 250 additions and 230 deletions
+2 -2
View File
@@ -465,13 +465,13 @@
if(slot_handcuffed)
if(H.handcuffed)
return 0
if(!istype(src, /obj/item/weapon/handcuffs))
if(!istype(src, /obj/item/weapon/restraints/handcuffs))
return 0
return 1
if(slot_legcuffed)
if(H.legcuffed)
return 0
if(!istype(src, /obj/item/weapon/legcuffs))
if(!istype(src, /obj/item/weapon/restraints/legcuffs))
return 0
return 1
if(slot_in_backpack)
+145 -75
View File
@@ -1,4 +1,4 @@
/obj/item/weapon/handcuffs
/obj/item/weapon/restraints/handcuffs
name = "handcuffs"
desc = "Use this to keep prisoners in line."
gender = PLURAL
@@ -12,132 +12,117 @@
throw_range = 5
m_amt = 500
origin_tech = "materials=1"
var/dispenser = 0
var/breakouttime = 600 //Deciseconds = 60s = 1 minutes
var/cuffsound = 'sound/weapons/handcuffs.ogg'
var/trashtype = null //For disposable cuffs
/obj/item/weapon/handcuffs/attack(mob/living/carbon/C, mob/user)
/obj/item/weapon/restraints/handcuffs/attack(mob/living/carbon/C, mob/user)
if(M_CLUMSY in user.mutations && prob(50))
user << "<span class='warning'>Uh... how do those things work?!</span>"
if(!C.handcuffed)
user.drop_item()
loc = C
C.handcuffed = src
C.update_inv_handcuffed()
return
var/cable = 0
if(istype(src, /obj/item/weapon/handcuffs/cable))
cable = 1
apply_cuffs(user,user)
if(!C.handcuffed)
C.visible_message("<span class='danger'>[user] is trying to put handcuffs on [C]!</span>", \
"<span class='danger'>[user] is trying to put handcuffs on [C]!</span>")
if(cable)
playsound(loc, 'sound/weapons/cablecuff.ogg', 30, 1, -2)
else
playsound(loc, 'sound/weapons/handcuffs.ogg', 30, 1, -2)
C.visible_message("<span class='danger'>[user] is trying to put [src.name] on [C]!</span>", \
"<span class='userdanger'>[user] is trying to put [src.name] on [C]!</span>")
playsound(loc, cuffsound, 30, 1, -2)
if(do_mob(user, C, 30))
if(C.handcuffed)
return
user.drop_item()
loc = C
C.handcuffed = src
C.update_inv_handcuffed()
if(cable)
apply_cuffs(C,user)
user << "<span class='notice'>You handcuff [C].</span>"
if(istype(src, /obj/item/weapon/restraints/handcuffs/cable))
feedback_add_details("handcuffs","C")
else
feedback_add_details("handcuffs","H")
add_logs(C, user, "handcuffed")
add_logs(user, C, "handcuffed")
else
user << "<span class='warning'>You fail to handcuff [C].</span>"
/obj/item/weapon/restraints/handcuffs/proc/apply_cuffs(mob/living/carbon/target, mob/user)
if(!target.handcuffed)
user.drop_item()
if(trashtype)
target.handcuffed = new trashtype(target)
qdel(src)
else
loc = target
target.handcuffed = src
target.update_inv_handcuffed(1)
return
var/last_chew = 0
/mob/living/carbon/human/RestrainedClickOn(var/atom/A)
if (A != src) return ..()
if (last_chew + 26 > world.time) return
if (A != src)
return ..()
if (last_chew + 26 > world.time)
return
var/mob/living/carbon/human/H = A
if (!H.handcuffed) return
if (H.a_intent != "harm") return
if (H.zone_sel.selecting != "mouth") return
if (H.wear_mask) return
if (istype(H.wear_suit, /obj/item/clothing/suit/straight_jacket)) return
if (!H.handcuffed)
return
if (H.a_intent != "harm")
return
if (H.zone_sel.selecting != "mouth")
return
if (H.wear_mask)
return
if (istype(H.wear_suit, /obj/item/clothing/suit/straight_jacket))
return
var/datum/organ/external/O = H.organs_by_name[H.hand?"l_hand":"r_hand"]
if (!O) return
var/datum/organ/external/O = H.organs_by_name[H.hand ? "l_hand" : "r_hand"]
if (!O)
return
var/s = "\red [H.name] chews on \his [O.display_name]!"
H.visible_message(s, "\red You chew on your [O.display_name]!")
var/s = "<span class='danger'>[H.name] chews on \his [O.display_name]!</span>"
H.visible_message(s, "<span class='userdanger'>You chew on your [O.display_name]!</span>")
H.attack_log += text("\[[time_stamp()]\] <font color='red'>[s] ([H.ckey])</font>")
log_attack("[s] ([H.ckey])")
if(O.take_damage(3,0,1,1,"teeth marks"))
H:UpdateDamageIcon()
H.UpdateDamageIcon()
if(prob(10))
O.droplimb()
last_chew = world.time
/obj/item/weapon/handcuffs/cable
/obj/item/weapon/restraints/handcuffs/cable
name = "cable restraints"
desc = "Looks like some cables tied together. Could be used to tie something up."
icon_state = "cuff_red"
item_state = "coil_red"
breakouttime = 300 //Deciseconds = 30s
cuffsound = 'sound/weapons/cablecuff.ogg'
/obj/item/weapon/handcuffs/cable/red
/obj/item/weapon/restraints/handcuffs/cable/red
icon_state = "cuff_red"
/obj/item/weapon/handcuffs/cable/yellow
/obj/item/weapon/restraints/handcuffs/cable/yellow
icon_state = "cuff_yellow"
/obj/item/weapon/handcuffs/cable/blue
/obj/item/weapon/restraints/handcuffs/cable/blue
icon_state = "cuff_blue"
/obj/item/weapon/handcuffs/cable/green
/obj/item/weapon/restraints/handcuffs/cable/green
icon_state = "cuff_green"
/obj/item/weapon/handcuffs/cable/pink
/obj/item/weapon/restraints/handcuffs/cable/pink
icon_state = "cuff_pink"
/obj/item/weapon/handcuffs/cable/orange
/obj/item/weapon/restraints/handcuffs/cable/orange
icon_state = "cuff_orange"
/obj/item/weapon/handcuffs/cable/cyan
/obj/item/weapon/restraints/handcuffs/cable/cyan
icon_state = "cuff_cyan"
/obj/item/weapon/handcuffs/cable/white
/obj/item/weapon/restraints/handcuffs/cable/white
icon_state = "cuff_white"
/obj/item/weapon/handcuffs/cyborg
dispenser = 1
/obj/item/weapon/handcuffs/cyborg/attack(mob/living/carbon/C as mob, mob/user as mob)
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)
user.visible_message("\red <B>[user] is trying to put handcuffs on [C]!</B>")
if (ishuman(C))
var/mob/living/carbon/human/H = C
if (!H.has_organ_for_slot(slot_handcuffed))
user << "\red \The [H] needs at least two wrists before you can cuff them together!"
return
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()
/obj/item/weapon/handcuffs/pinkcuffs
/obj/item/weapon/restraints/handcuffs/pinkcuffs
name = "fluffy pink handcuffs"
desc = "Use this to keep prisoners in line. Or you know, your significant other."
icon_state = "pinkcuffs"
/obj/item/weapon/handcuffs/cable/attackby(var/obj/item/I, mob/user as mob)
/obj/item/weapon/restraints/handcuffs/cable/attackby(var/obj/item/I, mob/user as mob)
..()
if(istype(I, /obj/item/stack/rods))
var/obj/item/stack/rods/R = I
@@ -146,7 +131,92 @@ var/last_chew = 0
user.u_equip(src)
user.put_in_hands(W)
user << "<span class='notice'>You wrap the cable restraint around the top of the rod.</span>"
del(src)
qdel(src)
else
user << "<span class='warning'>You need one rod to make a wired rod.</span>"
return
/obj/item/weapon/restraints/handcuffs/cable/zipties
name = "zipties"
desc = "Plastic, disposable zipties that can be used to restrain temporarily but are destroyed after use."
icon_state = "cuff_white"
breakouttime = 450 //Deciseconds = 45s
trashtype = /obj/item/weapon/restraints/handcuffs/cable/zipties/used
/obj/item/weapon/restraints/handcuffs/cable/zipties/cyborg/attack(mob/living/carbon/C, mob/user)
if(isrobot(user))
if(!C.handcuffed)
playsound(loc, 'sound/weapons/cablecuff.ogg', 30, 1, -2)
C.visible_message("<span class='danger'>[user] is trying to put zipties on [C]!</span>", \
"<span class='userdanger'>[user] is trying to put zipties on [C]!</span>")
if(do_mob(user, C, 30))
if(!C.handcuffed)
C.handcuffed = new /obj/item/weapon/restraints/handcuffs/cable/zipties/used(C)
C.update_inv_handcuffed(1)
user << "<span class='notice'>You handcuff [C].</span>"
add_logs(user, C, "handcuffed")
else
user << "<span class='warning'>You fail to handcuff [C].</span>"
/obj/item/weapon/restraints/handcuffs/cable/zipties/used/attack()
return
//Legcuffs
/obj/item/weapon/restraints/legcuffs
name = "leg cuffs"
desc = "Use this to keep prisoners in line."
gender = PLURAL
icon = 'icons/obj/items.dmi'
icon_state = "handcuff"
flags = CONDUCT
throwforce = 0
w_class = 3.0
origin_tech = "materials=1"
slowdown = 7
var/breakouttime = 300 //Deciseconds = 30s = 0.5 minute
/obj/item/weapon/restraints/legcuffs/beartrap
name = "bear trap"
throw_speed = 1
throw_range = 1
icon_state = "beartrap0"
desc = "A trap used to catch bears and other legged creatures."
var/armed = 0
/obj/item/weapon/restraints/legcuffs/beartrap/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is sticking \his head in the [src.name]! It looks like \he's trying to commit suicide.</span>")
playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
return (BRUTELOSS)
/obj/item/weapon/restraints/legcuffs/beartrap/attack_self(mob/user as mob)
..()
if(ishuman(user) && !user.stat && !user.restrained())
armed = !armed
icon_state = "beartrap[armed]"
user << "<span class='notice'>[src] is now [armed ? "armed" : "disarmed"]</span>"
/obj/item/weapon/restraints/legcuffs/beartrap/Crossed(AM as mob|obj)
if(armed && isturf(src.loc))
if( (iscarbon(AM) || isanimal(AM)) && !istype(AM, /mob/living/simple_animal/parrot) && !istype(AM, /mob/living/simple_animal/construct) && !istype(AM, /mob/living/simple_animal/shade) && !istype(AM, /mob/living/simple_animal/hostile/viscerator))
var/mob/living/L = AM
armed = 0
icon_state = "beartrap0"
playsound(src.loc, 'sound/effects/snap.ogg', 50, 1)
L.visible_message("<span class='danger'>[L] triggers \the [src].</span>", \
"<span class='userdanger'>You trigger \the [src]!</span>")
if(ishuman(AM))
var/mob/living/carbon/H = AM
if(H.lying)
H.apply_damage(20,BRUTE,"chest")
else
H.apply_damage(20,BRUTE,(pick("l_leg", "r_leg")))
if(!H.legcuffed) //beartrap can't cuff you leg if there's already a beartrap or legcuffs.
H.legcuffed = src
src.loc = H
H.update_inv_legcuffed(0)
feedback_add_details("handcuffs","B") //Yes, I know they're legcuffs. Don't change this, no need for an extra variable. The "B" is used to tell them apart.
else
L.apply_damage(20,BRUTE)
..()
@@ -110,7 +110,7 @@
"/obj/item/weapon/grenade/flashbang",
"/obj/item/weapon/grenade/chem_grenade/teargas",
"/obj/item/weapon/reagent_containers/spray/pepper",
"/obj/item/weapon/handcuffs",
"/obj/item/weapon/restraints/handcuffs",
"/obj/item/device/flash",
"/obj/item/clothing/glasses",
"/obj/item/ammo_casing/shotgun",
@@ -413,7 +413,7 @@
new /obj/item/device/multitool(src)
new /obj/item/stack/cable_coil(src)
new /obj/item/weapon/handcuffs(src)
new /obj/item/weapon/restraints/handcuffs(src)
new /obj/item/weapon/dnainjector/xraymut(src)
new /obj/item/weapon/dnainjector/firemut(src)
new /obj/item/weapon/dnainjector/telemut(src)
@@ -445,13 +445,13 @@
New()
..()
new /obj/item/weapon/handcuffs(src)
new /obj/item/weapon/handcuffs(src)
new /obj/item/weapon/handcuffs(src)
new /obj/item/weapon/handcuffs(src)
new /obj/item/weapon/handcuffs(src)
new /obj/item/weapon/handcuffs(src)
new /obj/item/weapon/handcuffs(src)
new /obj/item/weapon/restraints/handcuffs(src)
new /obj/item/weapon/restraints/handcuffs(src)
new /obj/item/weapon/restraints/handcuffs(src)
new /obj/item/weapon/restraints/handcuffs(src)
new /obj/item/weapon/restraints/handcuffs(src)
new /obj/item/weapon/restraints/handcuffs(src)
new /obj/item/weapon/restraints/handcuffs(src)
/obj/item/weapon/storage/box/fakesyndiesuit
name = "boxed space suit and helmet"
+1 -1
View File
@@ -118,7 +118,7 @@
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)))
if((C.handcuffed) && (istype(C.handcuffed, /obj/item/weapon/restraints/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.")
@@ -240,7 +240,7 @@
new /obj/item/weapon/storage/belt/security(src)
new /obj/item/weapon/grenade/flashbang(src)
new /obj/item/device/flash(src)
new /obj/item/weapon/handcuffs(src)
new /obj/item/weapon/restraints/handcuffs(src)
new /obj/item/weapon/melee/baton/loaded(src)
new /obj/item/clothing/glasses/sunglasses(src)
new /obj/item/clothing/glasses/hud/health_advanced
@@ -1,4 +1,5 @@
//Alium nests. Essentially beds with an unbuckle delay that only aliums can buckle mobs to.
#define NEST_RESIST_TIME 1200
/obj/structure/stool/bed/nest
name = "alien nest"
@@ -16,15 +17,20 @@
"<span class='notice'>[user.name] pulls you free from the gelatinous resin.</span>",\
"<span class='notice'>You hear squelching...</span>")
buckled_mob.pixel_y = 0
buckled_mob.old_y = 0
unbuckle()
else
if(world.time <= buckled_mob.last_special+NEST_RESIST_TIME)
return
buckled_mob.visible_message(\
"<span class='warning'>[buckled_mob.name] struggles to break free of the gelatinous resin...</span>",\
"<span class='warning'>You struggle to break free from the gelatinous resin...</span>",\
"<span class='notice'>You hear squelching...</span>")
spawn(600)
spawn(NEST_RESIST_TIME)
if(user && buckled_mob && user.buckled == src)
buckled_mob.last_special = world.time
buckled_mob.pixel_y = 0
buckled_mob.old_y = 0
unbuckle()
src.add_fingerprint(user)
return
@@ -70,8 +76,7 @@
var/aforce = W.force
health = max(0, health - aforce)
playsound(loc, 'sound/effects/attackblob.ogg', 100, 1)
for(var/mob/M in viewers(src, 7))
M.show_message("<span class='warning'>[user] hits [src] with [W]!</span>", 1)
visible_message("<span class='warning'>[user] hits [src] with [W]!</span>", 1)
healthcheck()
/obj/structure/stool/bed/nest/proc/healthcheck()