From dabcce81edcd07deeef03421de3bc29a939bcf20 Mon Sep 17 00:00:00 2001 From: coiax Date: Thu, 22 Dec 2016 20:31:55 +0000 Subject: [PATCH] CTF guns only hurt mobs with CTF armor (#22284) * CTF guns only hurt mobs with CTF armor This is moving towards the possiblity of spawning CTF spawns and flag spawns onto the station without people being caught in the crossfire. * Debug messages are bad --- code/modules/awaymissions/capture_the_flag.dm | 31 ++++++++++++++++++- .../mob/living/carbon/human/species.dm | 1 - code/modules/projectiles/projectile.dm | 6 ++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm index 491d21155c7..08b17ec5ddb 100644 --- a/code/modules/awaymissions/capture_the_flag.dm +++ b/code/modules/awaymissions/capture_the_flag.dm @@ -334,6 +334,7 @@ /obj/item/weapon/gun/ballistic/automatic/pistol/deagle/ctf desc = "This looks like it could really hurt in melee." force = 75 + mag_type = /obj/item/ammo_box/magazine/m50/ctf /obj/item/weapon/gun/ballistic/automatic/pistol/deagle/ctf/dropped() . = ..() @@ -343,6 +344,20 @@ if(isturf(loc)) qdel(src) +/obj/item/ammo_box/magazine/m50/ctf + ammo_type = /obj/item/ammo_casing/a50/ctf + +/obj/item/ammo_casing/a50/ctf + projectile_type = /obj/item/projectile/bullet/ctf + +/obj/item/projectile/bullet/ctf + damage = 0 + +/obj/item/projectile/bullet/ctf/prehit(atom/target) + if(is_ctf_target(target)) + damage = 60 + . = ..() + /obj/item/weapon/gun/ballistic/automatic/laser/ctf mag_type = /obj/item/ammo_box/magazine/recharge/ctf desc = "This looks like it could really hurt in melee." @@ -364,9 +379,23 @@ projectile_type = /obj/item/projectile/beam/ctf /obj/item/projectile/beam/ctf - damage = 150 + damage = 0 icon_state = "omnilaser" +/obj/item/projectile/beam/ctf/prehit(atom/target) + if(is_ctf_target(target)) + damage = 150 + . = ..() + +/proc/is_ctf_target(atom/target) + . = FALSE + if(istype(target, /obj/structure/barricade/security/ctf)) + . = TRUE + if(ishuman(target)) + var/mob/living/carbon/human/H = target + if(istype(H.wear_suit, /obj/item/clothing/suit/space/hardsuit/shielded/ctf)) + . = TRUE + // RED TEAM GUNS /obj/item/weapon/gun/ballistic/automatic/laser/ctf/red diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index e3fed94d8a5..cfaf52e21f9 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1234,7 +1234,6 @@ H.show_message("The radiation beam dissipates harmlessly through your body.") if(/obj/item/projectile/energy/florayield) H.show_message("The radiation beam dissipates harmlessly through your body.") - return /datum/species/proc/bullet_act(obj/item/projectile/P, mob/living/carbon/human/H) // called before a projectile hit diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index b508fb85957..51799b0d8d5 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -74,6 +74,9 @@ else //when a limb is missing the damage is actually passed to the chest return "chest" +/obj/item/projectile/proc/prehit(atom/target) + return + /obj/item/projectile/proc/on_hit(atom/target, blocked = 0) var/turf/target_loca = get_turf(target) if(!isliving(target)) @@ -145,6 +148,7 @@ var/turf/target_turf = get_turf(A) + prehit(A) var/permutation = A.bullet_act(src, def_zone) // searches for return value, could be deleted after run so check A isn't null if(permutation == -1 || forcedodge)// the bullet passes through a dense object! loc = target_turf @@ -158,6 +162,7 @@ mobs_list += L if(mobs_list.len) var/mob/living/picked_mob = pick(mobs_list) + prehit(picked_mob) picked_mob.bullet_act(src, def_zone) qdel(src) @@ -168,6 +173,7 @@ if(!log_override && firer && original) add_logs(firer, original, "fired at", src, " [get_area(src)]") if(direct_target) + prehit(direct_target) direct_target.bullet_act(src, def_zone) qdel(src) return