From 29fab3038471dd26779d4d077d3dd6b72944fb1a Mon Sep 17 00:00:00 2001 From: Chinsky Date: Wed, 31 Oct 2012 13:04:34 +0400 Subject: [PATCH 1/3] Added 40% chance of gun in active hand going off if someone tries to disarm holder. There is also 10% chance that gun in off hand will go off. --- .../mob/living/carbon/human/human_attackhand.dm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 5fed311fda0..b5413729ee8 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -191,6 +191,21 @@ if(w_uniform) w_uniform.add_fingerprint(M) var/datum/organ/external/affecting = get_organ(ran_zone(M.zone_sel.selecting)) + + if (istype(l_hand,/obj/item/weapon/gun)) + var/obj/item/weapon/gun/W = l_hand + var/chance = hand ? 40 : 10 + if (prob(chance)) + visible_message("[src]'s [W] goes off during struggle!") + return W.afterattack(M,src) + + if (istype(r_hand,/obj/item/weapon/gun)) + var/obj/item/weapon/gun/W = r_hand + var/chance = !hand ? 40 : 10 + if (prob(chance)) + visible_message("[src]'s [W] goes off during struggle!") + return W.afterattack(M,src) + var/randn = rand(1, 100) if (randn <= 25) apply_effect(4, WEAKEN, run_armor_check(affecting, "melee")) From e1c087c594ee501a6aa7c14577a307f3036969d1 Mon Sep 17 00:00:00 2001 From: Chinsky Date: Wed, 31 Oct 2012 14:34:52 +0400 Subject: [PATCH 2/3] Added small probality of gun owner getting shot. --- .../mob/living/carbon/human/human_attackhand.dm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index b5413729ee8..769bb70d5a1 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -197,14 +197,20 @@ var/chance = hand ? 40 : 10 if (prob(chance)) visible_message("[src]'s [W] goes off during struggle!") - return W.afterattack(M,src) + if (prob(5)) + return W.afterattack(src,src) + else + return W.afterattack(M,src) if (istype(r_hand,/obj/item/weapon/gun)) var/obj/item/weapon/gun/W = r_hand var/chance = !hand ? 40 : 10 if (prob(chance)) visible_message("[src]'s [W] goes off during struggle!") - return W.afterattack(M,src) + if (prob(5)) + return W.afterattack(src,src) + else + return W.afterattack(M,src) var/randn = rand(1, 100) if (randn <= 25) From b9d942cfddb4f7c07d6284824ab7cfc44c692982 Mon Sep 17 00:00:00 2001 From: Chinsky Date: Thu, 1 Nov 2012 04:14:23 +0400 Subject: [PATCH 3/3] Gun goes off in random direction instead of always on assiliant. --- .../living/carbon/human/human_attackhand.dm | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 769bb70d5a1..96df8c88465 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -192,25 +192,25 @@ w_uniform.add_fingerprint(M) var/datum/organ/external/affecting = get_organ(ran_zone(M.zone_sel.selecting)) - if (istype(l_hand,/obj/item/weapon/gun)) - var/obj/item/weapon/gun/W = l_hand - var/chance = hand ? 40 : 10 - if (prob(chance)) - visible_message("[src]'s [W] goes off during struggle!") - if (prob(5)) - return W.afterattack(src,src) - else - return W.afterattack(M,src) + if (istype(r_hand,/obj/item/weapon/gun) || istype(l_hand,/obj/item/weapon/gun)) + var/obj/item/weapon/gun/W = null + var/chance = 0 + + if (istype(l_hand,/obj/item/weapon/gun)) + W = l_hand + chance = hand ? 40 : 20 + + if (istype(r_hand,/obj/item/weapon/gun)) + W = r_hand + chance = !hand ? 40 : 20 - if (istype(r_hand,/obj/item/weapon/gun)) - var/obj/item/weapon/gun/W = r_hand - var/chance = !hand ? 40 : 10 if (prob(chance)) visible_message("[src]'s [W] goes off during struggle!") - if (prob(5)) - return W.afterattack(src,src) - else - return W.afterattack(M,src) + var/list/turfs = list() + for(var/turf/T in view()) + turfs += T + var/turf/target = pick(turfs) + return W.afterattack(target,src) var/randn = rand(1, 100) if (randn <= 25)