mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 11:13:16 +00:00
Fixes projectiles embedding in mobs that they pass through
This commit is contained in:
@@ -38,9 +38,9 @@ emp_act
|
|||||||
return -1 // complete projectile permutation
|
return -1 // complete projectile permutation
|
||||||
|
|
||||||
//Shrapnel
|
//Shrapnel
|
||||||
if (P.damage_type == BRUTE)
|
if (P.can_embed())
|
||||||
var/armor = getarmor_organ(organ, "bullet")
|
var/armor = getarmor_organ(organ, "bullet")
|
||||||
if((P.embed && prob(20 + max(P.damage - armor, -10))))
|
if(P.embed && prob(20 + max(P.damage - armor, -10)))
|
||||||
var/obj/item/weapon/shard/shrapnel/SP = new()
|
var/obj/item/weapon/shard/shrapnel/SP = new()
|
||||||
SP.name = (P.name != "shrapnel")? "[P.name] shrapnel" : "shrapnel"
|
SP.name = (P.name != "shrapnel")? "[P.name] shrapnel" : "shrapnel"
|
||||||
SP.desc = "[SP.desc] It looks like it was fired from [P.shot_from]."
|
SP.desc = "[SP.desc] It looks like it was fired from [P.shot_from]."
|
||||||
|
|||||||
@@ -65,8 +65,19 @@
|
|||||||
/obj/item/projectile/proc/on_impact(var/atom/A)
|
/obj/item/projectile/proc/on_impact(var/atom/A)
|
||||||
return
|
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.
|
//return 1 if the projectile should be allowed to pass through after all, 0 if not.
|
||||||
/obj/item/projectile/proc/on_penetrate(var/atom/A)
|
/obj/item/projectile/proc/check_penetrate(var/atom/A)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/obj/item/projectile/proc/check_fire(atom/target as mob, var/mob/living/user as mob) //Checks if you can hit them or not.
|
/obj/item/projectile/proc/check_fire(atom/target as mob, var/mob/living/user as mob) //Checks if you can hit them or not.
|
||||||
@@ -197,7 +208,7 @@
|
|||||||
|
|
||||||
//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(!passthrough && penetrating > 0)
|
||||||
if(on_penetrate(A))
|
if(check_penetrate(A))
|
||||||
passthrough = 1
|
passthrough = 1
|
||||||
penetrating--
|
penetrating--
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
var/mob/living/L = target
|
var/mob/living/L = target
|
||||||
shake_camera(L, 3, 2)
|
shake_camera(L, 3, 2)
|
||||||
|
|
||||||
/obj/item/projectile/bullet/on_penetrate(var/atom/A)
|
/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))
|
if(istype(A, /obj/mecha))
|
||||||
@@ -21,8 +21,9 @@
|
|||||||
|
|
||||||
if(ismob(A))
|
if(ismob(A))
|
||||||
if(iscarbon(A))
|
if(iscarbon(A))
|
||||||
if (damage <= 20 && !prob(damage)) return 0
|
//squishy mobs absorb KE
|
||||||
damage *= 0.7 //squishy mobs absorb KE
|
if(can_embed()) return 0
|
||||||
|
damage *= 0.7
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
var/chance = 0
|
var/chance = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user