Make Disarm opt-in (#7811)
This commit is contained in:
@@ -30,6 +30,9 @@ namespace Content.Shared.CombatMode
|
||||
[DataField("disarmActionId", customTypeSerializer:typeof(PrototypeIdSerializer<EntityTargetActionPrototype>))]
|
||||
public readonly string DisarmActionId = "Disarm";
|
||||
|
||||
[DataField("canDisarm")]
|
||||
public bool CanDisarm;
|
||||
|
||||
[DataField("disarmAction")] // must be a data-field to properly save cooldown when saving game state.
|
||||
public EntityTargetAction? DisarmAction;
|
||||
|
||||
|
||||
@@ -33,12 +33,13 @@ namespace Content.Shared.CombatMode
|
||||
_actionsSystem.AddAction(uid, component.CombatToggleAction, null);
|
||||
|
||||
if (component.DisarmAction == null
|
||||
&& component.CanDisarm
|
||||
&& _protoMan.TryIndex(component.DisarmActionId, out EntityTargetActionPrototype? disarmProto))
|
||||
{
|
||||
component.DisarmAction = new(disarmProto);
|
||||
}
|
||||
|
||||
if (component.DisarmAction != null)
|
||||
if (component.DisarmAction != null && component.CanDisarm)
|
||||
_actionsSystem.AddAction(uid, component.DisarmAction, null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user