diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index cb13034af50..83076373e42 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -38,9 +38,9 @@ emp_act return -1 // complete projectile permutation //Shrapnel - if (P.can_embed()) + if(P.can_embed()) var/armor = getarmor_organ(organ, "bullet") - if(P.embed && prob(20 + max(P.damage - armor, -10))) + if(prob(20 + max(P.damage - armor, -10))) var/obj/item/weapon/shard/shrapnel/SP = new() SP.name = (P.name != "shrapnel")? "[P.name] shrapnel" : "shrapnel" SP.desc = "[SP.desc] It looks like it was fired from [P.shot_from]." diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index e25b4491da7..996a0a2bd38 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -66,14 +66,10 @@ return //Checks if the projectile is eligible for embedding. Not that it necessarily will. -//Mainly used to ensure that projectiles won't embed if they are penetrating the mob. /obj/item/projectile/proc/can_embed() //embed must be enabled and damage type must be brute if(!embed || damage_type != BRUTE) return 0 - //can't embed if the projectile is penetrating through the mob - if(penetrating > 0 && damage > 20 && prob(damage)) - return 0 return 1 //return 1 if the projectile should be allowed to pass through after all, 0 if not. @@ -206,9 +202,9 @@ for(var/mob/M in A) attack_mob(M, distance) - //penetrating projectiles can pass through things that otherwise would not let them + //penetrating projectiles can pass through things that otherwise would not let them if(!passthrough && penetrating > 0) - if(check_penetrate(A)) + if(check_penetrate(A)) passthrough = 1 penetrating-- @@ -311,4 +307,4 @@ trace.firer = user var/output = trace.process() //Test it! del(trace) //No need for it anymore - return output //Send it back to the gun! + return output //Send it back to the gun! \ No newline at end of file diff --git a/code/modules/projectiles/projectile/bullets.dm b/code/modules/projectiles/projectile/bullets.dm index 6e15021b44b..01454e4b8b1 100644 --- a/code/modules/projectiles/projectile/bullets.dm +++ b/code/modules/projectiles/projectile/bullets.dm @@ -7,23 +7,37 @@ check_armour = "bullet" embed = 1 sharp = 1 + var/mob_passthrough_check = 0 /obj/item/projectile/bullet/on_hit(var/atom/target, var/blocked = 0) if (..(target, blocked)) var/mob/living/L = target shake_camera(L, 3, 2) +/obj/item/projectile/bullet/attack_mob(var/mob/living/target_mob, var/distance, var/miss_modifier) + if(penetrating > 0 && damage > 20 && prob(damage)) + mob_passthrough_check = 1 + else + mob_passthrough_check = 0 + ..() + +/obj/item/projectile/bullet/can_embed() + //prevent embedding if the projectile is passing through the mob + if(mob_passthrough_check) + return 0 + return ..() + /obj/item/projectile/bullet/check_penetrate(var/atom/A) - if(!A || !A.density) return 1 //if whatever it was got destroyed when we hit it, then I guess we can just keep going + if(!A || !A.density) return 1 //if whatever it was got destroyed when we hit it, then I guess we can just keep going if(istype(A, /obj/mecha)) return 1 //mecha have their own penetration handling if(ismob(A)) + if (!mob_passthrough_check) + return 0 if(iscarbon(A)) - //squishy mobs absorb KE - if(can_embed()) return 0 - damage *= 0.7 + damage *= 0.7 //squishy mobs absorb KE return 1 var/chance = 0