(a73e09604) Fixed inventory locking up when rewiring items with a Controller component (e.g. periscopes). Don't open the health interface by clicking on the healthbar when using a controller.

This commit is contained in:
Joonas Rikkonen
2019-05-16 05:39:42 +03:00
parent 3575c8df52
commit 704e0731c9
17 changed files with 200 additions and 276 deletions
@@ -28,6 +28,10 @@ namespace Barotrauma
protected IndoorsSteeringManager PathSteering => HumanAIController.PathSteering;
protected SteeringManager SteeringManager => HumanAIController.SteeringManager;
protected HumanAIController HumanAIController => character.AIController as HumanAIController;
protected IndoorsSteeringManager PathSteering => HumanAIController.PathSteering;
protected SteeringManager SteeringManager => HumanAIController.SteeringManager;
/// <summary>
/// Run the main objective with all subobjectives concurrently?
/// If false, the main objective will continue only when all the subobjectives have been removed (done).
@@ -32,7 +32,7 @@ namespace Barotrauma
public override bool IsCompleted() => false;
public override bool CanBeCompleted => true;
public override void Update(float deltaTime)
protected override void Act(float deltaTime)
{
var currentHull = character.AnimController.CurrentHull;
if (HumanAIController.NeedsDivingGear(currentHull) && divingGearObjective == null)
@@ -14,7 +14,7 @@ namespace Barotrauma
public AIObjectiveFixLeaks(Character character) : base (character, "") { }
protected override bool Filter(Gap gap)
protected override void FindTargets()
{
if (character.Submarine == null) { return 0; }
if (targets.None()) { return 0; }
@@ -224,6 +224,8 @@ namespace Barotrauma
targetItem = item;
moveToTarget = rootContainer ?? item;
}
}
//if searched through all the items and a target wasn't found, can't be completed
if (currSearchIndex >= Item.ItemList.Count - 1 && targetItem == null)
@@ -11,6 +11,8 @@ namespace Barotrauma
private AIObjectiveFindDivingGear findDivingGear;
private AIObjectiveFindDivingGear findDivingGear;
private AIObjectiveFindDivingGear findDivingGear;
private Vector2 targetPos;
private bool repeat;
@@ -224,5 +226,11 @@ namespace Barotrauma
float interactionDistance = Target is Item i ? ConvertUnits.ToSimUnits(i.InteractDistance) : 0;
CloseEnough = Math.Max(interactionDistance, CloseEnough);
}
private void CalculateCloseEnough()
{
float interactionDistance = Target is Item i ? ConvertUnits.ToSimUnits(i.InteractDistance) : 0;
CloseEnough = Math.Max(interactionDistance, CloseEnough);
}
}
}
@@ -53,21 +53,6 @@ namespace Barotrauma
}
}
public override void Update(float deltaTime)
{
if (objectiveManager.CurrentObjective == this)
{
if (randomTimer > 0)
{
randomTimer -= deltaTime;
}
else
{
SetRandom();
}
}
}
public override bool IsCompleted() => false;
public override bool CanBeCompleted => true;
@@ -24,6 +24,10 @@ namespace Barotrauma
private AIObjectiveGoTo gotoObjective;
private bool useController;
private AIObjectiveGoTo gotoObjective;
public override bool CanBeCompleted
{
get
@@ -41,6 +45,8 @@ namespace Barotrauma
public ItemComponent Component => component;
public ItemComponent Component => component;
public override float GetPriority(AIObjectiveManager objectiveManager)
{
if (gotoObjective != null && !gotoObjective.CanBeCompleted) { return 0; }