This commit is contained in:
EvilFactory
2025-04-29 07:27:36 -03:00
26 changed files with 198 additions and 76 deletions
@@ -550,14 +550,14 @@ namespace Barotrauma
if (subObjective.IsCompleted)
{
#if DEBUG
DebugConsole.NewMessage($"{character.Name}: Removing SUBobjective {subObjective.DebugTag} of {DebugTag}, because it is completed.", Color.LightGreen);
DebugConsole.NewMessage($"{character.Name}: Removing subObjective \"{subObjective.DebugTag}\" of \"{DebugTag}\", because it is completed.", Color.LightGreen);
#endif
subObjectives.Remove(subObjective);
}
else if (!subObjective.CanBeCompleted)
{
#if DEBUG
DebugConsole.NewMessage($"{character.Name}: Removing SUBobjective {subObjective.DebugTag} of {DebugTag}, because it cannot be completed.", Color.Red);
DebugConsole.NewMessage($"{character.Name}: Removing subObjective \"{subObjective.DebugTag}\" of \"{DebugTag}\", because it cannot be completed.", Color.Red);
#endif
subObjectives.Remove(subObjective);
if (AbandonWhenCannotCompleteSubObjectives)
@@ -12,6 +12,7 @@ namespace Barotrauma
class AIObjectiveGetItem : AIObjective
{
public override Identifier Identifier { get; set; } = "get item".ToIdentifier();
public override string DebugTag => $"{Identifier} ({(IdentifiersOrTags == null || IdentifiersOrTags.None() ? "none" : string.Join(", ", IdentifiersOrTags))})";
public override bool AbandonWhenCannotCompleteSubObjectives => false;
public override bool AllowMultipleInstances => true;
@@ -10,6 +10,7 @@ namespace Barotrauma
class AIObjectiveGoTo : AIObjective
{
public override Identifier Identifier { get; set; } = "go to".ToIdentifier();
public override string DebugTag => $"{Identifier} ({Target?.ToString() ?? "none"})";
public override bool KeepDivingGearOn => GetTargetHull() == null;
@@ -10,7 +10,7 @@ namespace Barotrauma
class AIObjectiveOperateItem : AIObjective
{
public override Identifier Identifier { get; set; } = "operate item".ToIdentifier();
public override string DebugTag => $"{Identifier} {component.Name}";
public override string DebugTag => $"{Identifier} ({component.Name})";
public override bool AllowAutomaticItemUnequipping => true;
public override bool AllowMultipleInstances => true;
@@ -10,6 +10,8 @@ namespace Barotrauma
{
public override Identifier Identifier { get; set; } = "repair item".ToIdentifier();
public override string DebugTag => $"{Identifier} ({Item?.Name ?? "null"})";
protected override bool AllowInFriendlySubs => true;
public override bool KeepDivingGearOn => Item?.CurrentHull == null;
protected override bool AllowWhileHandcuffed => false;
@@ -206,19 +206,21 @@ namespace Barotrauma
{
float xDiff = Math.Abs(start.X - node.TempPosition.X);
float yDiff = Math.Abs(start.Y - node.TempPosition.Y);
//higher cost for vertical movement when inside the sub
if (InsideSubmarine && !(node.Waypoint.Submarine?.Info?.IsRuin ?? false))
{
//higher cost for vertical movement when inside the sub
if (yDiff > 1.0f && node.Waypoint.Ladders == null && node.Waypoint.Stairs == null)
{
yDiff += 10.0f;
}
node.TempDistance = xDiff + yDiff * 10.0f;
}
else
{
node.TempDistance = xDiff + yDiff;
//only apply the higher cost for vertical movement if it's more than a meter
//(small differences can be caused by non-meaningful variance in the vertical position of the waypoint, we only care about actually going up/down e.g. ladders or stairs)
if (Math.Abs(yDiff) > 1.0f)
{
yDiff *= 10.0f;
}
}
node.TempDistance = xDiff + yDiff;
//much higher cost to waypoints that are outside
if (node.Waypoint.CurrentHull == null && ApplyPenaltyToOutsideNodes) { node.TempDistance *= 10.0f; }