Make Disarm opt-in (#7811)

This commit is contained in:
Júlio César Ueti
2022-04-30 18:29:13 -03:00
committed by GitHub
parent 6bf2f659a6
commit 2881cd4020
10 changed files with 23 additions and 1 deletions

View File

@@ -30,6 +30,9 @@ namespace Content.Shared.CombatMode
[DataField("disarmActionId", customTypeSerializer:typeof(PrototypeIdSerializer<EntityTargetActionPrototype>))] [DataField("disarmActionId", customTypeSerializer:typeof(PrototypeIdSerializer<EntityTargetActionPrototype>))]
public readonly string DisarmActionId = "Disarm"; 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. [DataField("disarmAction")] // must be a data-field to properly save cooldown when saving game state.
public EntityTargetAction? DisarmAction; public EntityTargetAction? DisarmAction;

View File

@@ -33,12 +33,13 @@ namespace Content.Shared.CombatMode
_actionsSystem.AddAction(uid, component.CombatToggleAction, null); _actionsSystem.AddAction(uid, component.CombatToggleAction, null);
if (component.DisarmAction == null if (component.DisarmAction == null
&& component.CanDisarm
&& _protoMan.TryIndex(component.DisarmActionId, out EntityTargetActionPrototype? disarmProto)) && _protoMan.TryIndex(component.DisarmActionId, out EntityTargetActionPrototype? disarmProto))
{ {
component.DisarmAction = new(disarmProto); component.DisarmAction = new(disarmProto);
} }
if (component.DisarmAction != null) if (component.DisarmAction != null && component.CanDisarm)
_actionsSystem.AddAction(uid, component.DisarmAction, null); _actionsSystem.AddAction(uid, component.DisarmAction, null);
} }

View File

@@ -580,6 +580,8 @@
id: MobKangarooBoxer id: MobKangarooBoxer
description: A large marsupial herbivore. It has powerful hind legs and... boxing gloves? description: A large marsupial herbivore. It has powerful hind legs and... boxing gloves?
components: components:
- type: CombatMode
canDisarm: true
- type: Sprite - type: Sprite
drawdepth: Mobs drawdepth: Mobs
layers: layers:
@@ -612,6 +614,8 @@
parent: SimpleMobBase parent: SimpleMobBase
description: New church of neo-darwinists actually believe that EVERY animal evolved from a monkey. Tastes like pork, and killing them is both fun and relaxing. description: New church of neo-darwinists actually believe that EVERY animal evolved from a monkey. Tastes like pork, and killing them is both fun and relaxing.
components: components:
- type: CombatMode
canDisarm: true
- type: NameIdentifier - type: NameIdentifier
group: Monkey group: Monkey
- type: SentienceTarget - type: SentienceTarget

View File

@@ -5,6 +5,8 @@
parent: SimpleSpaceMobBase parent: SimpleSpaceMobBase
description: They mostly come at night. Mostly. description: They mostly come at night. Mostly.
components: components:
- type: CombatMode
canDisarm: true
- type: UtilityAI - type: UtilityAI
behaviorSets: behaviorSets:
- Idle - Idle

View File

@@ -5,6 +5,8 @@
id: MobDwarf id: MobDwarf
description: A miserable pile of secrets. description: A miserable pile of secrets.
components: components:
- type: CombatMode
canDisarm: true
- type: InteractionPopup - type: InteractionPopup
successChance: 1 successChance: 1
interactSuccessString: hugging-success-generic interactSuccessString: hugging-success-generic

View File

@@ -5,6 +5,8 @@
id: MobHuman id: MobHuman
description: A miserable pile of secrets. description: A miserable pile of secrets.
components: components:
- type: CombatMode
canDisarm: true
- type: InteractionPopup - type: InteractionPopup
successChance: 1 successChance: 1
interactSuccessString: hugging-success-generic interactSuccessString: hugging-success-generic

View File

@@ -5,6 +5,8 @@
id: MobReptilian id: MobReptilian
description: A miserable pile of scales. description: A miserable pile of scales.
components: components:
- type: CombatMode
canDisarm: true
- type: InteractionPopup - type: InteractionPopup
successChance: 1 successChance: 1
interactSuccessString: hugging-success-generic interactSuccessString: hugging-success-generic

View File

@@ -3,6 +3,8 @@
abstract: true abstract: true
id: PlayerSiliconBase #for player controlled silicons id: PlayerSiliconBase #for player controlled silicons
components: components:
- type: CombatMode
canDisarm: true
- type: Reactive - type: Reactive
groups: groups:
Acidic: [Touch] Acidic: [Touch]

View File

@@ -3,6 +3,8 @@
parent: MobSlimePersonBase parent: MobSlimePersonBase
id: MobSlimePerson id: MobSlimePerson
components: components:
- type: CombatMode
canDisarm: true
- type: InteractionPopup - type: InteractionPopup
successChance: 1 successChance: 1
interactSuccessString: hugging-success-generic interactSuccessString: hugging-success-generic

View File

@@ -4,6 +4,8 @@
parent: MobVoxBase parent: MobVoxBase
id: MobVox id: MobVox
components: components:
- type: CombatMode
canDisarm: true
- type: InteractionPopup - type: InteractionPopup
successChance: 1 successChance: 1
interactSuccessString: hugging-success-generic interactSuccessString: hugging-success-generic