Add off icon for disarm, allow off/on icons for Target actions (#5360)

This commit is contained in:
Clyybber
2021-11-16 06:03:34 +01:00
committed by GitHub
parent cc41896836
commit 665cc259c5
3 changed files with 11 additions and 11 deletions

View File

@@ -97,7 +97,7 @@ namespace Content.Shared.Actions.Prototypes
/// True if this is an action that requires selecting a target /// True if this is an action that requires selecting a target
/// </summary> /// </summary>
public bool IsTargetAction => public bool IsTargetAction =>
BehaviorType == BehaviorType.TargetEntity || BehaviorType == BehaviorType.TargetPoint; BehaviorType is BehaviorType.TargetEntity or BehaviorType.TargetPoint;
public virtual void AfterDeserialization() public virtual void AfterDeserialization()
{ {
@@ -106,20 +106,19 @@ namespace Content.Shared.Actions.Prototypes
if (BehaviorType == BehaviorType.None) if (BehaviorType == BehaviorType.None)
{ {
Logger.ErrorS("action", "Missing behaviorType for action with name {0}", Name); Logger.ErrorS("action", $"Missing behaviorType for action with name {Name}");
} }
if (BehaviorType != BehaviorType.Toggle && IconOn != SpriteSpecifier.Invalid) if (BehaviorType is not (BehaviorType.Toggle or BehaviorType.TargetEntity or BehaviorType.TargetPoint) && IconOn != SpriteSpecifier.Invalid)
{ {
Logger.ErrorS("action", "for action {0}, iconOn was specified but behavior" + Logger.ErrorS("action", $"for action {Name}, iconOn was specified but behavior" +
" type was {1}. iconOn is only supported for Toggle behavior type.", Name); " $type was {BehaviorType}. iconOn is only supported for Toggle behavior type.");
} }
if (Repeat && BehaviorType != BehaviorType.TargetEntity && BehaviorType != BehaviorType.TargetPoint) if (Repeat && BehaviorType != BehaviorType.TargetEntity && BehaviorType != BehaviorType.TargetPoint)
{ {
Logger.ErrorS("action", " action named {0} used repeat: true, but this is only supported for" + Logger.ErrorS("action", $" action named {Name} used repeat: true, but this is only supported for" +
" TargetEntity and TargetPoint behaviorType and its behaviorType is {1}", " $TargetEntity and TargetPoint behaviorType and its behaviorType is {BehaviorType}");
Name, BehaviorType);
} }
} }
@@ -127,8 +126,8 @@ namespace Content.Shared.Actions.Prototypes
{ {
if (BehaviorType != expected) if (BehaviorType != expected)
{ {
Logger.ErrorS("action", "for action named {0}, behavior implements " + Logger.ErrorS("action", $"for action named {Name}, behavior implements " +
"{1}, so behaviorType should be {2} but was {3}", Name, actualInterface.Name, expected, BehaviorType); $"{actualInterface.Name}, so behaviorType should be {expected} but was {BehaviorType}");
} }
} }
} }

View File

@@ -11,7 +11,8 @@
- type: action - type: action
actionType: Disarm actionType: Disarm
icon: Interface/Actions/disarm.png icon: Interface/Actions/disarmOff.png
iconOn: Interface/Actions/disarm.png
name: "[color=red]Disarm[/color]" name: "[color=red]Disarm[/color]"
description: "Attempt to [color=red]disarm[/color] someone." description: "Attempt to [color=red]disarm[/color] someone."
filters: filters:

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B