Better logic related to selecting / deselecting target-based actions (#2962)

This commit is contained in:
chairbender
2021-01-10 06:27:55 -08:00
committed by GitHub
parent aeb3c1832e
commit ee6c28aede
5 changed files with 42 additions and 11 deletions

View File

@@ -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;