Skip to content

Commit

Permalink
Merge pull request #630 from lionaneesh/patch-approach-target-goal
Browse files Browse the repository at this point in the history
Add Approach and Pull Max duration to constants
  • Loading branch information
Xian55 authored Dec 3, 2024
2 parents 25a63cf + 546b27a commit 7e31a1a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions Core/Goals/ApproachTargetGoal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public sealed class ApproachTargetGoal : GoapGoal, IGoapEventListener
{
private const bool debug = true;
private const double STUCK_INTERVAL_MS = 400; // cant be lower than Approach.Cooldown
private const double MAX_APPROACH_DURATION_MS = 15_000; // max time to chase to pull


public override float Cost => 8f;

Expand Down Expand Up @@ -166,7 +168,7 @@ private void NonCombatApproach()
}
}

if (ApproachDurationMs > 15_000)
if (ApproachDurationMs > MAX_APPROACH_DURATION_MS)
{
if (debug)
Log("Too long time. Clear Target. Turn away.");
Expand Down Expand Up @@ -244,4 +246,4 @@ private void Log(string text)
{
logger.LogDebug(text);
}
}
}
6 changes: 3 additions & 3 deletions Core/Goals/PullTargetGoal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public sealed class PullTargetGoal : GoapGoal, IGoapEventListener
public override float Cost => 7f;

private const int AcquireTargetTimeMs = 5000;

private const int MAX_PULL_DURATION = 15_000;
private readonly ILogger<PullTargetGoal> logger;
private readonly ConfigurableInput input;
private readonly ClassConfiguration classConfig;
Expand Down Expand Up @@ -144,7 +144,7 @@ public override void Update()
return;
}

if (PullDurationMs > 15_000)
if (PullDurationMs > MAX_PULL_DURATION)
{
input.PressClearTarget();
Log("Pull taking too long. Clear target and face away!");
Expand Down Expand Up @@ -289,4 +289,4 @@ private void Log(string text)
{
logger.LogInformation(text);
}
}
}

0 comments on commit 7e31a1a

Please sign in to comment.