(2ffcd0a06) Retry writing files in SaveUtil.DecompressFile up to 4 times (in case the file is being used by another process), fixed DecompressFiletoStream "retrying" 4 times even if the first try succeeds
This commit is contained in:
@@ -427,6 +427,18 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
closestButton.Item.TryInteract(character, false, true, false);
|
||||
buttonPressCooldown = ButtonPressInterval;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!door.HasRequiredItems(character, false) && shouldBeOpen)
|
||||
{
|
||||
currentPath.Unreachable = true;
|
||||
return;
|
||||
}
|
||||
|
||||
door.Item.TryInteract(character, false, true, true);
|
||||
buttonPressCooldown = ButtonPressInterval;
|
||||
break;
|
||||
|
||||
@@ -32,6 +32,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).
|
||||
|
||||
@@ -80,6 +80,16 @@ namespace Barotrauma
|
||||
unreachable.Clear();
|
||||
}
|
||||
|
||||
if (unreachableClearTimer > 0)
|
||||
{
|
||||
unreachableClearTimer -= deltaTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
unreachableClearTimer = clearUnreachableInterval;
|
||||
unreachable.Clear();
|
||||
}
|
||||
|
||||
if (searchHullTimer > 0.0f)
|
||||
{
|
||||
unreachableClearTimer = clearUnreachableInterval;
|
||||
|
||||
@@ -43,10 +43,18 @@ namespace Barotrauma
|
||||
return ignore;
|
||||
}
|
||||
|
||||
public override bool IsDuplicate(AIObjective otherObjective) => otherObjective is AIObjectiveFixLeaks;
|
||||
protected override float TargetEvaluation() => targets.Max(t => GetLeakSeverity(t));
|
||||
protected override IEnumerable<Gap> GetList() => Gap.GapList;
|
||||
protected override AIObjective ObjectiveConstructor(Gap gap) => new AIObjectiveFixLeak(gap, character, objectiveManager, PriorityModifier);
|
||||
private float GetGapFixPriority(Gap gap)
|
||||
{
|
||||
if (gap == null) return 0.0f;
|
||||
|
||||
//larger gap -> higher priority
|
||||
float gapPriority = (gap.IsHorizontal ? gap.Rect.Width : gap.Rect.Height) * gap.Open;
|
||||
|
||||
//prioritize gaps that are close
|
||||
gapPriority /= Math.Max(Vector2.Distance(character.WorldPosition, gap.WorldPosition), 1.0f);
|
||||
|
||||
//gaps to outside are much higher priority
|
||||
if (!gap.IsRoomToRoom) gapPriority *= 10.0f;
|
||||
|
||||
return gapPriority;
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace Barotrauma
|
||||
|
||||
private AIObjectiveFindDivingGear findDivingGear;
|
||||
|
||||
private AIObjectiveFindDivingGear findDivingGear;
|
||||
|
||||
private AIObjectiveFindDivingGear findDivingGear;
|
||||
private Vector2 targetPos;
|
||||
private bool repeat;
|
||||
@@ -85,6 +87,8 @@ namespace Barotrauma
|
||||
|
||||
public bool FollowControlledCharacter;
|
||||
|
||||
public bool FollowControlledCharacter;
|
||||
|
||||
public AIObjectiveGoTo(Entity target, Character character, AIObjectiveManager objectiveManager, bool repeat = false, bool getDivingGearIfNeeded = true, float priorityModifier = 1)
|
||||
: base (character, objectiveManager, priorityModifier)
|
||||
{
|
||||
@@ -217,7 +221,7 @@ namespace Barotrauma
|
||||
|
||||
private void CalculateCloseEnough()
|
||||
{
|
||||
float interactionDistance = Target is Item i ? ConvertUnits.ToSimUnits(i.InteractDistance * 0.9f) : 0;
|
||||
float interactionDistance = Target is Item i ? ConvertUnits.ToSimUnits(i.InteractDistance) : 0;
|
||||
CloseEnough = Math.Max(interactionDistance, CloseEnough);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Barotrauma
|
||||
private readonly List<Hull> targetHulls = new List<Hull>(20);
|
||||
private readonly List<float> hullWeights = new List<float>(20);
|
||||
|
||||
public AIObjectiveIdle(Character character, AIObjectiveManager objectiveManager, float priorityModifier = 1) : base(character, objectiveManager, priorityModifier)
|
||||
public AIObjectiveIdle(Character character) : base(character, "")
|
||||
{
|
||||
standStillTimer = Rand.Range(-10.0f, 10.0f);
|
||||
walkDuration = Rand.Range(0.0f, 10.0f);
|
||||
@@ -38,6 +38,9 @@ namespace Barotrauma
|
||||
public override bool IsCompleted() => false;
|
||||
public override bool CanBeCompleted => true;
|
||||
|
||||
public override bool IsCompleted() => false;
|
||||
public override bool CanBeCompleted => true;
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
if (objectiveManager.CurrentObjective == this)
|
||||
@@ -92,9 +95,6 @@ namespace Barotrauma
|
||||
bool currentTargetIsInvalid = currentTarget == null || IsForbidden(currentTarget) ||
|
||||
(PathSteering.CurrentPath != null && PathSteering.CurrentPath.Nodes.Any(n => HumanAIController.UnsafeHulls.Contains(n.CurrentHull)));
|
||||
|
||||
bool currentTargetIsInvalid = currentTarget == null || IsForbidden(currentTarget) ||
|
||||
(PathSteering.CurrentPath != null && PathSteering.CurrentPath.Nodes.Any(n => HumanAIController.UnsafeHulls.Contains(n.CurrentHull)));
|
||||
|
||||
if (currentTargetIsInvalid || (currentTarget == null && currentHullForbidden))
|
||||
{
|
||||
newTargetTimer = 0;
|
||||
|
||||
+6
-6
@@ -28,6 +28,10 @@ namespace Barotrauma
|
||||
|
||||
private AIObjectiveGoTo gotoObjective;
|
||||
|
||||
private bool useController;
|
||||
|
||||
private AIObjectiveGoTo gotoObjective;
|
||||
|
||||
public override bool CanBeCompleted
|
||||
{
|
||||
get
|
||||
@@ -47,6 +51,8 @@ namespace Barotrauma
|
||||
|
||||
public ItemComponent Component => component;
|
||||
|
||||
public ItemComponent Component => component;
|
||||
|
||||
public override float GetPriority(AIObjectiveManager objectiveManager)
|
||||
{
|
||||
if (gotoObjective != null && !gotoObjective.CanBeCompleted) { return 0; }
|
||||
@@ -116,12 +122,6 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
else if (!character.Inventory.Items.Contains(component.Item))
|
||||
{
|
||||
//controller/target can't be selected and the item cannot be picked -> objective can't be completed
|
||||
canBeCompleted = false;
|
||||
return;
|
||||
}
|
||||
else if (!character.Inventory.Items.Contains(component.Item))
|
||||
{
|
||||
//controller/target can't be selected and the item cannot be picked -> objective can't be completed
|
||||
abandon = true;
|
||||
|
||||
Reference in New Issue
Block a user