Fixed crashes caused by characters with no AI config due to missing SteeringManagers. Closes #469

This commit is contained in:
Joonas Rikkonen
2018-07-13 11:01:42 +03:00
parent ce88519c13
commit 4f874a276b
@@ -78,6 +78,10 @@ namespace Barotrauma
public EnemyAIController(Character c, string file) : base(c) public EnemyAIController(Character c, string file) : base(c)
{ {
targetMemories = new Dictionary<AITarget, AITargetMemory>(); targetMemories = new Dictionary<AITarget, AITargetMemory>();
outsideSteering = new SteeringManager(this);
insideSteering = new IndoorsSteeringManager(this, false);
steeringManager = outsideSteering;
state = AIState.None;
XDocument doc = XMLExtensions.TryLoadXml(file); XDocument doc = XMLExtensions.TryLoadXml(file);
if (doc == null || doc.Root == null) return; if (doc == null || doc.Root == null) return;
@@ -103,13 +107,6 @@ namespace Barotrauma
fleeHealthThreshold = aiElement.GetAttributeFloat("fleehealththreshold", 0.0f); fleeHealthThreshold = aiElement.GetAttributeFloat("fleehealththreshold", 0.0f);
attachToWalls = aiElement.GetAttributeBool("attachtowalls", false); attachToWalls = aiElement.GetAttributeBool("attachtowalls", false);
outsideSteering = new SteeringManager(this);
insideSteering = new IndoorsSteeringManager(this, false);
steeringManager = outsideSteering;
state = AIState.None;
} }
public override void SelectTarget(AITarget target) public override void SelectTarget(AITarget target)