From 72dfa3613d114adbd3f1d1d4e13cb15a11c65b46 Mon Sep 17 00:00:00 2001 From: Aneesh Dogra Date: Tue, 3 Dec 2024 02:26:15 +0100 Subject: [PATCH 1/2] Make Approach Duration a const so that its easily changeable. --- Core/Goals/ApproachTargetGoal.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Core/Goals/ApproachTargetGoal.cs b/Core/Goals/ApproachTargetGoal.cs index 216302b5..f8389bbb 100644 --- a/Core/Goals/ApproachTargetGoal.cs +++ b/Core/Goals/ApproachTargetGoal.cs @@ -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; @@ -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."); @@ -244,4 +246,4 @@ private void Log(string text) { logger.LogDebug(text); } -} \ No newline at end of file +} From 546b27a8071d4dbd1dea9bc8b2bfe614739cdcae Mon Sep 17 00:00:00 2001 From: Aneesh Dogra Date: Tue, 3 Dec 2024 02:28:25 +0100 Subject: [PATCH 2/2] Make Max Pull Duration a constant --- Core/Goals/PullTargetGoal.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/Goals/PullTargetGoal.cs b/Core/Goals/PullTargetGoal.cs index b1ca67e4..5c054cc7 100644 --- a/Core/Goals/PullTargetGoal.cs +++ b/Core/Goals/PullTargetGoal.cs @@ -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 logger; private readonly ConfigurableInput input; private readonly ClassConfiguration classConfig; @@ -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!"); @@ -289,4 +289,4 @@ private void Log(string text) { logger.LogInformation(text); } -} \ No newline at end of file +}