(f6c34b377) Fix crawlers not reacting to any targets if properly latched on walls.

This commit is contained in:
Joonas Rikkonen
2019-04-11 18:26:42 +03:00
parent 9b0e0ab278
commit a57b7184fb
9 changed files with 41 additions and 41 deletions
@@ -487,7 +487,7 @@ namespace Barotrauma
}
else
{
if (!IsProperlyLatched)
if (!IsProperlyLatchedOnSub)
{
UpdateWallTarget();
}
@@ -1003,11 +1003,12 @@ namespace Barotrauma
private void UpdateEating(float deltaTime)
{
if (SelectedAiTarget == null)
if (SelectedAiTarget == null) //SelectedAiTarget.Entity is Character c && !c.IsDead
{
State = AIState.Idle;
return;
}
Character targetChar = SelectedAiTarget.Entity as Character;
Limb mouthLimb = Array.Find(Character.AnimController.Limbs, l => l != null && l.MouthPos.HasValue);
if (mouthLimb == null) mouthLimb = Character.AnimController.GetLimb(LimbType.Head);
@@ -1039,14 +1040,14 @@ namespace Barotrauma
#region Targeting
private bool IsProperlyLatched => LatchOntoAI != null && LatchOntoAI.IsAttached && SelectedAiTarget?.Entity == wallTarget?.Structure;
private bool IsProperlyLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub && SelectedAiTarget?.Entity == wallTarget?.Structure;
//goes through all the AItargets, evaluates how preferable it is to attack the target,
//whether the Character can see/hear the target and chooses the most preferable target within
//sight/hearing range
public AITarget UpdateTargets(Character character, out TargetingPriority priority)
{
if (IsProperlyLatched)
if (IsProperlyLatchedOnSub)
{
// If attached to a valid target, just keep the target.
// Priority not used in this case.