Fixed issue where capitol ship could not be destroyed if attacker location was bad (possibly due to ai issue).

This commit is contained in:
Cekis
2016-05-27 15:45:22 +01:00
parent 7e343bb664
commit 35eac280cc
@@ -3699,7 +3699,13 @@ public class space_combat extends script.base_script
{
location locDefender = getLocation(objDefender);
location locAttacker = isIdValid(objAttacker) ? getLocation(objAttacker) : locDefender;
vector up_w = new vector(locAttacker.x - locDefender.x, locAttacker.y - locDefender.y, locAttacker.z - locDefender.z);
vector up_w;
if(locDefender == null || locAttacker == null){
up_w = new vector(0,0,0);
}
else {
up_w = new vector(locAttacker.x - locDefender.x, locAttacker.y - locDefender.y, locAttacker.z - locDefender.z);
}
float integrity = fltChassisHitPoints / fltMaximumChassisHitPoints;
float previousIntegrity = (fltChassisHitPoints + fltDamage) / fltMaximumChassisHitPoints;
if (Math.abs(integrity - previousIntegrity) > 0.01f)