diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 76eac1b6b43..c78754c7ed5 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -67,22 +67,29 @@ //Flimsy grilles aren't so great at stopping projectiles. However they can absorb some of the impact var/damage = Proj.damage - var/passthrough - if(damage > 30) - passthrough = 1 - if(prob(20)) - Proj.damage *= 0.5 //weaken the projectile - else - //weaker bullets are affected to a greater extent - if(prob(20)) - passthrough = 0 - else - Proj.damage *= 0.5 //weaken the projectile - passthrough = 1 + var/passthrough = 0 + + //20% chance that the grille provides a bit more cover than usual. Support structure for example might take up 20% of the grille's area. + //If they click on the grille itself then we assume they are aiming at the grille itself and the extra cover behaviour is always used. + switch(Proj.damage_type) + if(BRUTE) + //bullets + if(Proj.original == src || prob(20)) + Proj.damage *= between(0, Proj.damage/60, 0.5) + if(prob(max((damage-10)/25, 0))*100) + passthrough = 1 + else + Proj.damage *= between(0, Proj.damage/60, 1) + passthrough = 1 + if(BURN) + //beams and other projectiles are either blocked completely by grilles or stop half the damage. + if(!(Proj.original == src || prob(20))) + Proj.damage *= 0.5 + passthrough = 1 if(passthrough) . = -1 - damage *= 0.1 //if the bullet passes through then the grille avoids most of the damage + damage = between(0, (damage - Proj.damage)*(Proj.damage_type == BRUTE? 0.4 : 1), 10) //if the bullet passes through then the grille avoids most of the damage src.health -= damage*0.2 spawn(0) healthcheck() //spawn to make sure we return properly if the grille is deleted