(fc5e081d3) Fixed: Hull names not saving properly in submarineditor

This commit is contained in:
Joonas Rikkonen
2019-05-16 06:31:32 +03:00
parent 50dc08fb56
commit fc22eb5088
24 changed files with 350 additions and 782 deletions
@@ -16,11 +16,6 @@ namespace Barotrauma
private float waitUntilPathUnreachable;
private bool getDivingGearIfNeeded;
public Func<bool> customCondition;
/// <summary>
/// Sim units
/// </summary>
public float CloseEnough { get; set; } = 0.5f;
public bool IgnoreIfTargetDead { get; set; }
public bool AllowGoingOutside { get; set; }
@@ -181,35 +176,19 @@ namespace Barotrauma
private bool isCompleted;
public override bool IsCompleted()
{
// First check the distance
// Then the custom condition
// And finally check if can interact (heaviest)
if (repeat) { return false; }
if (isCompleted) { return true; }
bool closeEnough = Vector2.DistanceSquared(Target != null ? Target.SimPosition : targetPos, character.SimPosition) < CloseEnough * CloseEnough;
if (closeEnough)
bool completed = false;
if (Target is Item item)
{
if (customCondition == null || customCondition())
{
if (Target is Item item)
{
if (character.CanInteractWith(item, out _, checkLinked: false)) { isCompleted = true; }
}
else if (Target is Character targetCharacter)
{
if (character.CanInteractWith(targetCharacter, ConvertUnits.ToDisplayUnits(CloseEnough))) { isCompleted = true; }
}
else
{
isCompleted = true;
}
}
if (item.IsInsideTrigger(character.WorldPosition)) { completed = true; }
}
if (isCompleted)
else if (Target is Character targetCharacter)
{
character.AIController.SteeringManager.Reset();
if (character.CanInteractWith(targetCharacter)) { completed = true; }
}
return isCompleted;
completed = completed || Vector2.DistanceSquared(Target != null ? Target.SimPosition : targetPos, character.SimPosition) < CloseEnough * CloseEnough;
if (completed) { character.AIController.SteeringManager.Reset(); }
return completed;
}
public override bool IsDuplicate(AIObjective otherObjective)