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

@@ -53,8 +53,10 @@ namespace Content.Client.UserInterface.Controls
/// <summary>
/// Is there an action in the slot that can currently be used?
/// Target-basedActions on cooldown can still be selected / deselected if they've been configured as such
/// </summary>
public bool CanUseAction => HasAssignment && ActionEnabled && !IsOnCooldown;
public bool CanUseAction => Action != null && ActionEnabled &&
(!IsOnCooldown || (Action.IsTargetAction && !Action.DeselectOnCooldown));
/// <summary>
/// Item the action is provided by, only valid if Action is an ItemActionPrototype. May be null
@@ -340,8 +342,10 @@ namespace Content.Client.UserInterface.Controls
/// </summary>
public void Depress(bool depress)
{
// action can still be toggled if it's allowed to stay selected
if (!CanUseAction) return;
if (_depressed && !depress)
{
// fire the action