Merge pull request #8259 from mwerezak/gun-rewrite

Gun fixes
This commit is contained in:
PsiOmegaDelta
2015-02-25 07:21:29 +01:00
13 changed files with 145 additions and 64 deletions
@@ -54,7 +54,7 @@
new /obj/item/weapon/storage/box/ids(src)
new /obj/item/weapon/storage/box/ids( src )
new /obj/item/weapon/gun/energy/gun(src)
new /obj/item/weapon/gun/projectile/colt/flash(src)
new /obj/item/weapon/gun/projectile/sec/flash(src)
new /obj/item/device/flash(src)
return
+20 -13
View File
@@ -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