autotargetting disengagment fix

This commit is contained in:
2025-08-25 13:19:18 +02:00
parent b89a397ea5
commit cecd6cea77
6 changed files with 26 additions and 11 deletions

View File

@@ -347,9 +347,23 @@ namespace Beyond
public void ClearTarget(bool findNewOneImmediately)
{
SetNewTarget(null, true);
// --- FIX APPLIED HERE ---
// 1. Explicitly tell the lock-on system to unlock immediately.
// This is the crucial step that resets the 'isLockingOn' flag to false.
if (targetLockSystem != null)
{
targetLockSystem.SetLockOn(false);
}
// 2. Deselect the current target and remove its highlight.
SetNewTarget(null);
// 3. If requested, immediately find a new target.
if (findNewOneImmediately && _gameStateManager != null && _gameStateManager.CurrentState == GameStateManager.State.COMBAT)
{
// Now, when UpdateTarget() runs, 'isLockingOn' will be correctly set to false,
// forcing the system to use the stricter 'autoLockOnDistance' for the new candidate.
if (!_manualSwitchCooldownActive)
{
UpdateTarget();