Fixed crashes caused by characters with no AI config due to missing SteeringManagers. Closes #469
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user