]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Remove combat mode component reference (#15206)
authorDrSmugleaf <DrSmugleaf@users.noreply.github.com>
Sat, 8 Apr 2023 20:16:48 +0000 (13:16 -0700)
committerGitHub <noreply@github.com>
Sat, 8 Apr 2023 20:16:48 +0000 (13:16 -0700)
29 files changed:
Content.Client/CombatMode/CombatModeComponent.cs [deleted file]
Content.Client/CombatMode/CombatModeSystem.cs
Content.Client/ContextMenu/UI/ContextMenuUIController.cs
Content.Client/Weapons/Melee/MeleeWeaponSystem.cs
Content.Server/CombatMode/CombatModeComponent.cs [deleted file]
Content.Server/CombatMode/CombatModeSystem.cs
Content.Server/NPC/Systems/NPCCombatSystem.Melee.cs
Content.Server/NPC/Systems/NPCCombatSystem.Ranged.cs
Content.Server/NPC/Systems/NPCSteeringSystem.Obstacles.cs
Content.Server/NPC/Systems/NPCSteeringSystem.cs
Content.Server/Strip/StrippableSystem.cs
Content.Server/Weapons/Melee/MeleeWeaponSystem.cs
Content.Server/Zombies/ZombifyOnDeathSystem.cs
Content.Shared/CombatMode/CombatModeComponent.cs [moved from Content.Shared/CombatMode/SharedCombatModeComponent.cs with 81% similarity]
Content.Shared/CombatMode/Pacification/PacificationSystem.cs
Content.Shared/CombatMode/SharedCombatModeSystem.cs
Content.Shared/Interaction/SharedInteractionSystem.cs
Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
Resources/Prototypes/Entities/Mobs/NPCs/bear.yml
Resources/Prototypes/Entities/Mobs/NPCs/carp.yml
Resources/Prototypes/Entities/Mobs/NPCs/flesh.yml
Resources/Prototypes/Entities/Mobs/NPCs/spacetick.yml
Resources/Prototypes/Entities/Mobs/NPCs/xeno.yml
Resources/Prototypes/Entities/Mobs/Player/dragon.yml
Resources/Prototypes/Entities/Mobs/Player/dwarf.yml
Resources/Prototypes/Entities/Mobs/Player/human.yml
Resources/Prototypes/Entities/Mobs/Player/reptilian.yml
Resources/Prototypes/Entities/Mobs/Player/slime.yml
Resources/Prototypes/Entities/Mobs/Player/vox.yml

diff --git a/Content.Client/CombatMode/CombatModeComponent.cs b/Content.Client/CombatMode/CombatModeComponent.cs
deleted file mode 100644 (file)
index 441a9eb..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-using Content.Client.ContextMenu.UI;
-using Content.Client.Verbs;
-using Content.Shared.CombatMode;
-using Content.Shared.Targeting;
-using Robust.Client.Player;
-using Robust.Client.UserInterface;
-
-namespace Content.Client.CombatMode
-{
-    [RegisterComponent]
-    [ComponentReference(typeof(SharedCombatModeComponent))]
-    public sealed class CombatModeComponent : SharedCombatModeComponent
-    {
-        [Dependency] private readonly IPlayerManager _playerManager = default!;
-
-        public override bool IsInCombatMode
-        {
-            get => base.IsInCombatMode;
-            set
-            {
-                base.IsInCombatMode = value;
-                UpdateHud();
-            }
-        }
-
-        public override TargetingZone ActiveZone
-        {
-            get => base.ActiveZone;
-            set
-            {
-                base.ActiveZone = value;
-                UpdateHud();
-            }
-        }
-
-        private void UpdateHud()
-        {
-            if (Owner != _playerManager.LocalPlayer?.ControlledEntity)
-            {
-                return;
-            }
-
-            IoCManager.Resolve<IUserInterfaceManager>().GetUIController<ContextMenuUIController>().Close();
-        }
-    }
-}
index 6c9de790dc08e828b8a52e02bcea4f026b89ae58..63792385c10b04dd538be3a4439f58fc407b68df 100644 (file)
@@ -12,27 +12,36 @@ namespace Content.Client.CombatMode
     {
         [Dependency] private readonly IPlayerManager _playerManager = default!;
 
+        public event Action? LocalPlayerCombatModeUpdated;
+
         public override void Initialize()
         {
             base.Initialize();
 
-            SubscribeLocalEvent<SharedCombatModeComponent, ComponentHandleState>(OnHandleState);
+            SubscribeLocalEvent<CombatModeComponent, ComponentHandleState>(OnHandleState);
         }
 
-        private void OnHandleState(EntityUid uid, SharedCombatModeComponent component, ref ComponentHandleState args)
+        private void OnHandleState(EntityUid uid, CombatModeComponent component, ref ComponentHandleState args)
         {
             if (args.Current is not CombatModeComponentState state)
                 return;
 
             component.IsInCombatMode = state.IsInCombatMode;
             component.ActiveZone = state.TargetingZone;
+            UpdateHud(uid);
         }
+
         public override void Shutdown()
         {
             CommandBinds.Unregister<CombatModeSystem>();
             base.Shutdown();
         }
 
+        private void OnTargetingZoneChanged(TargetingZone obj)
+        {
+            EntityManager.RaisePredictiveEvent(new CombatModeSystemMessages.SetTargetZoneMessage(obj));
+        }
+
         public bool IsInCombatMode()
         {
             var entity = _playerManager.LocalPlayer?.ControlledEntity;
@@ -43,9 +52,26 @@ namespace Content.Client.CombatMode
             return IsInCombatMode(entity.Value);
         }
 
-        private void OnTargetingZoneChanged(TargetingZone obj)
+        public override void SetInCombatMode(EntityUid entity, bool inCombatMode, CombatModeComponent? component = null)
         {
-            EntityManager.RaisePredictiveEvent(new CombatModeSystemMessages.SetTargetZoneMessage(obj));
+            base.SetInCombatMode(entity, inCombatMode, component);
+            UpdateHud(entity);
+        }
+
+        public override void SetActiveZone(EntityUid entity, TargetingZone zone, CombatModeComponent? component = null)
+        {
+            base.SetActiveZone(entity, zone, component);
+            UpdateHud(entity);
+        }
+
+        private void UpdateHud(EntityUid entity)
+        {
+            if (entity != _playerManager.LocalPlayer?.ControlledEntity)
+            {
+                return;
+            }
+
+            LocalPlayerCombatModeUpdated?.Invoke();
         }
     }
 }
index 8544b17b1457a874b779782123b73c773bec63e2..b6737b9768cec2fc589bbbdec1e7e38846da42c1 100644 (file)
@@ -1,8 +1,10 @@
 using System.Threading;
+using Content.Client.CombatMode;
 using Content.Client.Gameplay;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.Controllers;
 using Timer = Robust.Shared.Timing.Timer;
+
 namespace Content.Client.ContextMenu.UI
 {
     /// <summary>
@@ -13,7 +15,7 @@ namespace Content.Client.ContextMenu.UI
     /// <remarks>
     ///     This largely involves setting up timers to open and close sub-menus when hovering over other menu elements.
     /// </remarks>
-    public sealed class ContextMenuUIController : UIController, IOnStateEntered<GameplayState>, IOnStateExited<GameplayState>
+    public sealed class ContextMenuUIController : UIController, IOnStateEntered<GameplayState>, IOnStateExited<GameplayState>, IOnSystemChanged<CombatModeSystem>
     {
         public static readonly TimeSpan HoverDelay = TimeSpan.FromSeconds(0.2);
 
@@ -206,5 +208,20 @@ namespace Content.Client.ContextMenu.UI
 
             menu.InvalidateMeasure();
         }
+
+        private void OnCombatModeUpdated()
+        {
+            Close();
+        }
+
+        public void OnSystemLoaded(CombatModeSystem system)
+        {
+            system.LocalPlayerCombatModeUpdated += OnCombatModeUpdated;
+        }
+
+        public void OnSystemUnloaded(CombatModeSystem system)
+        {
+            system.LocalPlayerCombatModeUpdated -= OnCombatModeUpdated;
+        }
     }
 }
index 52e6386bbababf524a8475288a15f4d2e273b513..91ac67bedafd04859a2e34186cd9ea0b9b54edf1 100644 (file)
@@ -1,5 +1,5 @@
-using Content.Client.CombatMode;
 using Content.Client.Gameplay;
+using Content.Shared.CombatMode;
 using Content.Shared.Hands.Components;
 using Content.Shared.Mobs.Components;
 using Content.Shared.StatusEffect;
diff --git a/Content.Server/CombatMode/CombatModeComponent.cs b/Content.Server/CombatMode/CombatModeComponent.cs
deleted file mode 100644 (file)
index 9467441..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-using Content.Shared.CombatMode;
-
-namespace Content.Server.CombatMode
-{
-    /// <summary>
-    ///     Stores whether an entity is in "combat mode"
-    ///     This is used to differentiate between regular item interactions or
-    ///     using *everything* as a weapon.
-    /// </summary>
-    [RegisterComponent]
-    [ComponentReference(typeof(SharedCombatModeComponent))]
-    public sealed class CombatModeComponent : SharedCombatModeComponent
-    {
-    }
-}
index b539f55254146915c7e22f32cc7f0c64e55e9c7d..3ad2e5aa19bc17771401394d0b9e2e5d4b0386c6 100644 (file)
@@ -11,10 +11,10 @@ namespace Content.Server.CombatMode
         {
             base.Initialize();
 
-            SubscribeLocalEvent<SharedCombatModeComponent, ComponentGetState>(OnGetState);
+            SubscribeLocalEvent<CombatModeComponent, ComponentGetState>(OnGetState);
         }
 
-        private void OnGetState(EntityUid uid, SharedCombatModeComponent component, ref ComponentGetState args)
+        private void OnGetState(EntityUid uid, CombatModeComponent component, ref ComponentGetState args)
         {
             args.State = new CombatModeComponentState(component.IsInCombatMode, component.ActiveZone);
         }
index d8b0902ad36caaf1e56cf1306d9593f239064c41..4b2560f236bcc029655f611b972bec48e07e0f43 100644 (file)
@@ -1,6 +1,6 @@
-using Content.Server.CombatMode;
 using Content.Server.NPC.Components;
 using Content.Server.NPC.Events;
+using Content.Shared.CombatMode;
 using Content.Shared.NPC;
 using Content.Shared.Weapons.Melee;
 using Robust.Shared.Map;
@@ -69,7 +69,7 @@ public sealed partial class NPCCombatSystem
     {
         if (TryComp<CombatModeComponent>(uid, out var combatMode))
         {
-            combatMode.IsInCombatMode = false;
+            _combat.SetInCombatMode(uid, false, combatMode);
         }
 
         _steering.Unregister(component.Owner);
@@ -79,7 +79,7 @@ public sealed partial class NPCCombatSystem
     {
         if (TryComp<CombatModeComponent>(uid, out var combatMode))
         {
-            combatMode.IsInCombatMode = true;
+            _combat.SetInCombatMode(uid, true, combatMode);
         }
 
         // TODO: Cleanup later, just looking for parity for now.
index 19367703b9710097ffab15d20d5bf880df4ae28b..eeec0383c6ea2ef17064fb6f7952e5479c68fe3e 100644 (file)
@@ -8,6 +8,7 @@ namespace Content.Server.NPC.Systems;
 
 public sealed partial class NPCCombatSystem
 {
+    [Dependency] private readonly SharedCombatModeSystem _combat = default!;
     [Dependency] private readonly RotateToFaceSystem _rotate = default!;
 
     // TODO: Don't predict for hitscan
@@ -26,9 +27,9 @@ public sealed partial class NPCCombatSystem
 
     private void OnRangedStartup(EntityUid uid, NPCRangedCombatComponent component, ComponentStartup args)
     {
-        if (TryComp<SharedCombatModeComponent>(uid, out var combat))
+        if (TryComp<CombatModeComponent>(uid, out var combat))
         {
-            combat.IsInCombatMode = true;
+            _combat.SetInCombatMode(uid, true, combat);
         }
         else
         {
@@ -38,9 +39,9 @@ public sealed partial class NPCCombatSystem
 
     private void OnRangedShutdown(EntityUid uid, NPCRangedCombatComponent component, ComponentShutdown args)
     {
-        if (TryComp<SharedCombatModeComponent>(uid, out var combat))
+        if (TryComp<CombatModeComponent>(uid, out var combat))
         {
-            combat.IsInCombatMode = false;
+            _combat.SetInCombatMode(uid, false, combat);
         }
     }
 
@@ -48,7 +49,7 @@ public sealed partial class NPCCombatSystem
     {
         var bodyQuery = GetEntityQuery<PhysicsComponent>();
         var xformQuery = GetEntityQuery<TransformComponent>();
-        var combatQuery = GetEntityQuery<SharedCombatModeComponent>();
+        var combatQuery = GetEntityQuery<CombatModeComponent>();
         var query = EntityQueryEnumerator<NPCRangedCombatComponent, TransformComponent>();
 
         while (query.MoveNext(out var uid, out var comp, out var xform))
@@ -73,7 +74,7 @@ public sealed partial class NPCCombatSystem
 
             if (combatQuery.TryGetComponent(uid, out var combatMode))
             {
-                combatMode.IsInCombatMode = true;
+                _combat.SetInCombatMode(uid, true, combatMode);
             }
 
             if (!_gun.TryGetGun(uid, out var gunUid, out var gun))
index 526eaab55af6da60d9ada43948ae3ef916a8dd76..8fd83e5162332d22898dcd7c27c7c1a6f7a88669 100644 (file)
@@ -1,7 +1,7 @@
-using Content.Server.CombatMode;
 using Content.Server.Destructible;
 using Content.Server.NPC.Components;
 using Content.Server.NPC.Pathfinding;
+using Content.Shared.CombatMode;
 using Content.Shared.Doors.Components;
 using Content.Shared.NPC;
 using Robust.Shared.Physics;
@@ -115,7 +115,7 @@ public sealed partial class NPCSteeringSystem
             {
                 if (_melee.TryGetWeapon(uid, out var meleeUid, out var meleeWeapon) && meleeWeapon.NextAttack <= _timing.CurTime && TryComp<CombatModeComponent>(uid, out var combatMode))
                 {
-                    combatMode.IsInCombatMode = true;
+                    _combat.SetInCombatMode(uid, true, combatMode);
                     var destructibleQuery = GetEntityQuery<DestructibleComponent>();
 
                     // TODO: This is a hack around grilles and windows.
@@ -131,7 +131,7 @@ public sealed partial class NPCSteeringSystem
                         }
                     }
 
-                    combatMode.IsInCombatMode = false;
+                    _combat.SetInCombatMode(uid, false, combatMode);
 
                     if (obstacleEnts.Count == 0)
                         return SteeringObstacleStatus.Completed;
index 70f6de7410751f67cc76512b073f44922db96459..8df27d48e8f2802d6ea2d26c94d1f0fdc8ff32af 100644 (file)
@@ -7,6 +7,7 @@ using Content.Server.NPC.Components;
 using Content.Server.NPC.Events;
 using Content.Server.NPC.Pathfinding;
 using Content.Shared.CCVar;
+using Content.Shared.CombatMode;
 using Content.Shared.Interaction;
 using Content.Shared.Movement.Components;
 using Content.Shared.Movement.Systems;
@@ -55,6 +56,7 @@ namespace Content.Server.NPC.Systems
         [Dependency] private readonly SharedMoverController _mover = default!;
         [Dependency] private readonly SharedPhysicsSystem _physics = default!;
         [Dependency] private readonly SharedTransformSystem _transform = default!;
+        [Dependency] private readonly SharedCombatModeSystem _combat = default!;
 
         /// <summary>
         /// Enabled antistuck detection so if an NPC is in the same spot for a while it will re-path.
index 86271b0b0c0af321a48a6e72964dcc6569fb862e..338ff50698080ac6c10a6daec0cd48cbf27249e3 100644 (file)
@@ -110,7 +110,7 @@ namespace Content.Server.Strip
         {
             base.StartOpeningStripper(user, component, openInCombat);
 
-            if (TryComp<SharedCombatModeComponent>(user, out var mode) && mode.IsInCombatMode && !openInCombat)
+            if (TryComp<CombatModeComponent>(user, out var mode) && mode.IsInCombatMode && !openInCombat)
                 return;
 
             if (TryComp<ActorComponent>(user, out var actor))
index 234e7958618a00b727ee65e781f0d080e235b213..212ac90e29eac773ba53dc053d9fef5e5604b412 100644 (file)
@@ -4,7 +4,6 @@ using Content.Server.Body.Components;
 using Content.Server.Body.Systems;
 using Content.Server.Chemistry.Components;
 using Content.Server.Chemistry.EntitySystems;
-using Content.Server.CombatMode;
 using Content.Server.CombatMode.Disarm;
 using Content.Server.Contests;
 using Content.Server.Examine;
@@ -202,7 +201,7 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
         RaiseNetworkEvent(new DamageEffectEvent(Color.Red, targets), filter);
     }
 
-    private float CalculateDisarmChance(EntityUid disarmer, EntityUid disarmed, EntityUid? inTargetHand, SharedCombatModeComponent disarmerComp)
+    private float CalculateDisarmChance(EntityUid disarmer, EntityUid disarmed, EntityUid? inTargetHand, CombatModeComponent disarmerComp)
     {
         if (HasComp<DisarmProneComponent>(disarmer))
             return 1.0f;
index 5c3c262bff494eced4b99dc9cee5f36e065dfeb4..97c6a251b432fe4f88dd529f432bea84285c1e7a 100644 (file)
@@ -5,7 +5,6 @@ using Content.Server.Body.Systems;
 using Content.Server.Chat;
 using Content.Server.Chat.Managers;
 using Content.Server.Chat.Systems;
-using Content.Server.CombatMode;
 using Content.Server.Disease.Components;
 using Content.Server.Ghost.Roles.Components;
 using Content.Server.Humanoid;
@@ -18,6 +17,7 @@ using Content.Server.Popups;
 using Content.Server.Speech.Components;
 using Content.Server.Temperature.Components;
 using Content.Server.Traitor;
+using Content.Shared.CombatMode;
 using Content.Shared.Damage;
 using Content.Shared.Hands.Components;
 using Content.Shared.Hands.EntitySystems;
@@ -53,6 +53,7 @@ namespace Content.Server.Zombies
         [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!;
         [Dependency] private readonly AutoEmoteSystem _autoEmote = default!;
         [Dependency] private readonly EmoteOnDamageSystem _emoteOnDamage = default!;
+        [Dependency] private readonly SharedCombatModeSystem _combat = default!;
         [Dependency] private readonly IChatManager _chatMan = default!;
         [Dependency] private readonly IPrototypeManager _proto = default!;
 
@@ -116,7 +117,7 @@ namespace Content.Server.Zombies
             //in an attempt to make an entity not attack. This is the easiest way to do it.
             RemComp<CombatModeComponent>(target);
             var combat = AddComp<CombatModeComponent>(target);
-            combat.IsInCombatMode = true;
+            _combat.SetInCombatMode(target, true, combat);
 
             //This is the actual damage of the zombie. We assign the visual appearance
             //and range here because of stuff we'll find out later
similarity index 81%
rename from Content.Shared/CombatMode/SharedCombatModeComponent.cs
rename to Content.Shared/CombatMode/CombatModeComponent.cs
index 833e400ca59d92a88abb298ef07aaac19246ac8d..a7ec35e3e4fb4b7b55635d0b41841a33aa4c5876 100644 (file)
@@ -1,17 +1,20 @@
 using Content.Shared.Actions;
 using Content.Shared.Actions.ActionTypes;
 using Content.Shared.Targeting;
-using Content.Shared.Verbs;
 using Robust.Shared.Audio;
 using Robust.Shared.GameStates;
-using Robust.Shared.Serialization;
 using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
-using Robust.Shared.Utility;
 
 namespace Content.Shared.CombatMode
 {
-    [NetworkedComponent()]
-    public abstract class SharedCombatModeComponent : Component
+    /// <summary>
+    ///     Stores whether an entity is in "combat mode"
+    ///     This is used to differentiate between regular item interactions or
+    ///     using *everything* as a weapon.
+    /// </summary>
+    [RegisterComponent, NetworkedComponent]
+    [Access(typeof(SharedCombatModeSystem))]
+    public sealed class CombatModeComponent : Component
     {
         #region Disarm
 
@@ -40,7 +43,7 @@ namespace Content.Shared.CombatMode
         public InstantAction? CombatToggleAction;
 
         [ViewVariables(VVAccess.ReadWrite)]
-        public virtual bool IsInCombatMode
+        public bool IsInCombatMode
         {
             get => _isInCombatMode;
             set
@@ -55,7 +58,7 @@ namespace Content.Shared.CombatMode
         }
 
         [ViewVariables(VVAccess.ReadWrite)]
-        public virtual TargetingZone ActiveZone
+        public TargetingZone ActiveZone
         {
             get => _activeZone;
             set
index 3f0e79dc319eef969f7b60f1d3a6e686fd4f1b05..a223c61053cc283b3328221e421b45c5be1a7dbd 100644 (file)
@@ -6,6 +6,7 @@ namespace Content.Shared.CombatMode.Pacification
     public sealed class PacificationSystem : EntitySystem
     {
         [Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
+        [Dependency] private readonly SharedCombatModeSystem _combatSystem = default!;
 
         public override void Initialize()
         {
@@ -22,13 +23,13 @@ namespace Content.Shared.CombatMode.Pacification
 
         private void OnStartup(EntityUid uid, PacifiedComponent component, ComponentStartup args)
         {
-            if (!TryComp<SharedCombatModeComponent>(uid, out var combatMode))
+            if (!TryComp<CombatModeComponent>(uid, out var combatMode))
                 return;
 
             if (combatMode.CanDisarm != null)
-                combatMode.CanDisarm = false;
+                _combatSystem.SetCanDisarm(uid, false, combatMode);
 
-            combatMode.IsInCombatMode = false;
+            _combatSystem.SetInCombatMode(uid, false, combatMode);
 
             if (combatMode.CombatToggleAction != null)
             {
@@ -38,11 +39,11 @@ namespace Content.Shared.CombatMode.Pacification
 
         private void OnShutdown(EntityUid uid, PacifiedComponent component, ComponentShutdown args)
         {
-            if (!TryComp<SharedCombatModeComponent>(uid, out var combatMode))
+            if (!TryComp<CombatModeComponent>(uid, out var combatMode))
                 return;
 
             if (combatMode.CanDisarm != null)
-                combatMode.CanDisarm = true;
+                _combatSystem.SetCanDisarm(uid, true, combatMode);
 
             if (combatMode.CombatToggleAction != null)
                 _actionsSystem.SetEnabled(combatMode.CombatToggleAction, true);
index c5c5b3d880f57938925bae186acb7e090ec8d52c..fb05e32039f93d6f953a05ae3e5027db3e6e481c 100644 (file)
@@ -15,12 +15,12 @@ namespace Content.Shared.CombatMode
         {
             base.Initialize();
 
-            SubscribeLocalEvent<SharedCombatModeComponent, ComponentStartup>(OnStartup);
-            SubscribeLocalEvent<SharedCombatModeComponent, ComponentShutdown>(OnShutdown);
-            SubscribeLocalEvent<SharedCombatModeComponent, ToggleCombatActionEvent>(OnActionPerform);
+            SubscribeLocalEvent<CombatModeComponent, ComponentStartup>(OnStartup);
+            SubscribeLocalEvent<CombatModeComponent, ComponentShutdown>(OnShutdown);
+            SubscribeLocalEvent<CombatModeComponent, ToggleCombatActionEvent>(OnActionPerform);
         }
 
-        private void OnStartup(EntityUid uid, SharedCombatModeComponent component, ComponentStartup args)
+        private void OnStartup(EntityUid uid, CombatModeComponent component, ComponentStartup args)
         {
             if (component.CombatToggleAction == null
                 && _protoMan.TryIndex(component.CombatToggleActionId, out InstantActionPrototype? toggleProto))
@@ -32,24 +32,50 @@ namespace Content.Shared.CombatMode
                 _actionsSystem.AddAction(uid, component.CombatToggleAction, null);
         }
 
-        private void OnShutdown(EntityUid uid, SharedCombatModeComponent component, ComponentShutdown args)
+        private void OnShutdown(EntityUid uid, CombatModeComponent component, ComponentShutdown args)
         {
             if (component.CombatToggleAction != null)
                 _actionsSystem.RemoveAction(uid, component.CombatToggleAction);
         }
 
-        public bool IsInCombatMode(EntityUid? entity, SharedCombatModeComponent? component = null)
+        private void OnActionPerform(EntityUid uid, CombatModeComponent component, ToggleCombatActionEvent args)
+        {
+            if (args.Handled)
+                return;
+
+            SetInCombatMode(uid, !component.IsInCombatMode, component);
+            args.Handled = true;
+        }
+
+        public void SetCanDisarm(EntityUid entity, bool canDisarm, CombatModeComponent? component = null)
+        {
+            if (!Resolve(entity, ref component))
+                return;
+
+            component.CanDisarm = canDisarm;
+        }
+
+        public bool IsInCombatMode(EntityUid? entity, CombatModeComponent? component = null)
         {
             return entity != null && Resolve(entity.Value, ref component, false) && component.IsInCombatMode;
         }
 
-        private void OnActionPerform(EntityUid uid, SharedCombatModeComponent component, ToggleCombatActionEvent args)
+        public virtual void SetInCombatMode(EntityUid entity, bool inCombatMode,
+            CombatModeComponent? component = null)
         {
-            if (args.Handled)
+            if (!Resolve(entity, ref component))
                 return;
 
-            component.IsInCombatMode = !component.IsInCombatMode;
-            args.Handled = true;
+            component.IsInCombatMode = inCombatMode;
+        }
+
+        public virtual void SetActiveZone(EntityUid entity, TargetingZone zone,
+            CombatModeComponent? component = null)
+        {
+            if (!Resolve(entity, ref component))
+                return;
+
+            component.ActiveZone = zone;
         }
 
         [Serializable, NetSerializable]
index aaee8de7196f56ff0d3643be232f280a8aebff5a..7d8de660a231c7ab336c49d3b017e4c66a9bd1a4 100644 (file)
@@ -250,7 +250,7 @@ namespace Content.Shared.Interaction
             if (target != null && Deleted(target.Value))
                 return;
 
-            if (!altInteract && TryComp(user, out SharedCombatModeComponent? combatMode) && combatMode.IsInCombatMode)
+            if (!altInteract && TryComp(user, out CombatModeComponent? combatMode) && combatMode.IsInCombatMode)
             {
                 // Eat the input
                 return;
index abc35d8300315f9e2a967197b704fc6b27f9b4fd..bc428563926026e5b4f9994f8d5530605e1dcf2f 100644 (file)
   description: Nice to have, but you can't build a civilization on a foundation of honey alone.
   components:
   - type: CombatMode
-    disarmAction:
-      enabled: false
-      autoPopulate: false
-      name: action-name-disarm
   - type: MovementSpeedModifier
     baseWalkSpeed : 7
     baseSprintSpeed : 7
   description: How nice a bee. Oh no, it looks angry and wants my pizza.
   components:
   - type: CombatMode
-    disarmAction:
-      enabled: false
-      autoPopulate: false
-      name: action-name-disarm
   - type: MeleeWeapon
     hidden: true
     angle: 0
   description: A large marsupial herbivore. It has powerful hind legs and... boxing gloves?
   components:
   - type: CombatMode
-    disarm: null
   - type: Sprite
     drawdepth: Mobs
     layers:
   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:
   - type: CombatMode
-    disarm: null
   - type: NameIdentifier
     group: Monkey
   - type: SentienceTarget
       enabled: false
       autoPopulate: false
       name: action-name-combat
-    disarmAction:
-      enabled: false
-      autoPopulate: false
-      name: action-name-disarm
   - type: Bloodstream
     bloodMaxVolume: 50
   - type: DiseaseCarrier #The other class lab animal and disease vector
     - id: FoodMeatSpider
       amount: 2
   - type: CombatMode
-    disarmAction:
-      enabled: false
-      autoPopulate: false
-      name: action-name-disarm
   - type: MobThresholds
     thresholds:
       0: Alive
       types:
         Blunt: 0.1
   - type: CombatMode
-    disarmAction:
-      enabled: false
-      autoPopulate: false
-      name: action-name-disarm
   - type: MeleeWeapon
     hidden: true
     soundHit:
index 25bae1d497fece65e8859462fac0deaf08c66cfd..69a2a996706ef1c68787c2ebeb983f5e0dbf12ca 100644 (file)
     bloodMaxVolume: 300
     bloodReagent: Cryoxadone
   - type: CombatMode
-    disarmAction:
-      enabled: false
-      autoPopulate: false
-      name: action-name-disarm
   - type: Temperature
     heatDamageThreshold: 500
     coldDamageThreshold: 0
index 2d3e5d2508ddfafd1a758daaba5968afb0c7ac38..66087f4d7b6827a03aee56037fb4ba6c631ef053 100644 (file)
       - map: [ "enum.DamageStateVisualLayers.Base" ]
         state: base
     - type: CombatMode
-      disarmAction:
-        enabled: false
-        autoPopulate: false
-        name: action-name-disarm
     - type: Physics
     - type: Fixtures
       fixtures:
index ac6379ab7a220c7fd92e8b09ebab56202f555956..9c987895369c6a1d56f1bc29dca2ad280d9d9dcf 100644 (file)
   - type: Bloodstream
     bloodMaxVolume: 100
   - type: CombatMode
-    disarmAction:
-      enabled: false
-      autoPopulate: false
-      name: action-name-disarm
   - type: MeleeWeapon
     hidden: true
     soundHit:
index e3314820bcb83c07ac785b3bb8fc0077f05def26..b5029cedb8903532212d52ea9991d450bc2aa322 100644 (file)
   - type: Bloodstream
     bloodMaxVolume: 50
   - type: CombatMode
-    disarmAction:
-      enabled: false
-      autoPopulate: false
-      name: action-name-disarm
   - type: MeleeWeapon
     hidden: true
     soundHit:
index 783d286e17213631ccfb0ed4d4775ad3a7048452..e8a22f7045eb5d387ea520c47a421f89794ab2e9 100644 (file)
@@ -9,7 +9,6 @@
   - type: DiseaseProtection
     protection: 1
   - type: CombatMode
-    disarm: null
   - type: InputMover
   - type: MobMover
   - type: HTN
index f897fc3024ebfbe50ddbef39d6909aad52b7ff3c..67524ec40f9e3273489d97bbe70818049eb797df 100644 (file)
         - Dragon
     - type: Speech
     - type: CombatMode
-      disarmAction:
-        enabled: false
-        autoPopulate: false
-        name: action-name-disarm
     - type: MobMover
     - type: InputMover
     - type: MovementSpeedModifier
index c6b5d46e5926061bb063a9adbb68fc215a13b8af..0f9b19ce85068b40a5a439f56c9e9322d498a66c 100644 (file)
@@ -5,7 +5,6 @@
   id: MobDwarf
   components:
     - type: CombatMode
-      disarm: null
     - type: InteractionPopup
       successChance: 1
       interactSuccessString: hugging-success-generic
index 60f86a10b8ab8af51151376366dba227e39c2c45..7da10c790f909bffdda8291360bf248a856af195 100644 (file)
@@ -5,7 +5,6 @@
   id: MobHuman
   components:
   - type: CombatMode
-    disarm: null
   - type: InteractionPopup
     successChance: 1
     interactSuccessString: hugging-success-generic
index 4890c8b6a878473473eb55931cef0b433368357a..254bd0ff09097825db1c7c2b4408a75db516c689 100644 (file)
@@ -5,7 +5,6 @@
   id: MobReptilian
   components:
     - type: CombatMode
-      disarm: null
     - type: InteractionPopup
       successChance: 1
       interactSuccessString: hugging-success-generic
index c379eeb95e8ffe1e867fca6c92c4c8dcc3bce8a2..d1fa5a268f86255bb77609a2a12c25d4d0e03398 100644 (file)
@@ -4,7 +4,6 @@
   id: MobSlimePerson
   components:
     - type: CombatMode
-      disarm: null
     - type: InteractionPopup
       successChance: 1
       interactSuccessString: hugging-success-generic
index a74e95680c871c90f66d578375c95e65939bb5c3..6862c3d92ef8221c67fa82c77f38c6f1279f697c 100644 (file)
@@ -5,7 +5,6 @@
   id: MobVox
   components:
     - type: CombatMode
-      disarm: null
     - type: InteractionPopup
       successChance: 1
       interactSuccessString: hugging-success-generic