Better logic related to selecting / deselecting target-based actions (#2962)
This commit is contained in:
@@ -184,8 +184,10 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
|
||||
// only do something for actual target-based actions
|
||||
if (_ui?.SelectingTargetFor?.Action == null ||
|
||||
(_ui.SelectingTargetFor.Action.BehaviorType != BehaviorType.TargetEntity &&
|
||||
_ui.SelectingTargetFor.Action.BehaviorType != BehaviorType.TargetPoint)) return false;
|
||||
(!_ui.SelectingTargetFor.Action.IsTargetAction)) return false;
|
||||
|
||||
// do nothing if we know it's on cooldown
|
||||
if (_ui.SelectingTargetFor.IsOnCooldown) return false;
|
||||
|
||||
var attempt = _ui.SelectingTargetFor.ActionAttempt();
|
||||
if (attempt == null)
|
||||
@@ -217,6 +219,13 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// we are supposed to target an entity but we didn't click it
|
||||
case BehaviorType.TargetEntity when args.EntityUid == EntityUid.Invalid:
|
||||
{
|
||||
if (attempt.Action.DeselectWhenEntityNotClicked)
|
||||
_ui.StopTargeting();
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
_ui.StopTargeting();
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user