From 35eac280cc79de27f3c51072fed7f13446a815d2 Mon Sep 17 00:00:00 2001 From: Cekis Date: Fri, 27 May 2016 15:45:22 +0100 Subject: [PATCH] Fixed issue where capitol ship could not be destroyed if attacker location was bad (possibly due to ai issue). --- .../compiled/game/script/library/space_combat.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sku.0/sys.server/compiled/game/script/library/space_combat.java b/sku.0/sys.server/compiled/game/script/library/space_combat.java index 8fa6509ff..5c26e65f0 100755 --- a/sku.0/sys.server/compiled/game/script/library/space_combat.java +++ b/sku.0/sys.server/compiled/game/script/library/space_combat.java @@ -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)