Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Approach and Pull Max duration to constants #630

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
}