Fix armor piercing not working against buildings (#8150)

This commit is contained in:
MEEPofFaith 2023-01-11 06:06:44 -08:00 committed by GitHub
parent b2bb6136de
commit 6eeb49bb37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1597,7 +1597,12 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
public boolean collision(Bullet other){
boolean wasDead = health <= 0;
damage(other.team, other.damage() * other.type().buildingDamageMultiplier);
float damage = other.damage() * other.type().buildingDamageMultiplier;
if(!other.type.pierceArmor){
damage = Damage.applyArmor(damage, block.armor);
}
damage(other.team, damage);
Events.fire(bulletDamageEvent.set(self(), other));
if(health <= 0 && !wasDead){
@ -1853,7 +1858,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
if(Mathf.zero(dm)){
damage = health + 1;
}else{
damage = Damage.applyArmor(damage, block.armor) / dm;
damage /= dm;
}
//TODO handle this better on the client.