diff --git a/Content.Server/GameObjects/Components/Mobs/DamageStates.cs b/Content.Server/GameObjects/Components/Mobs/DamageStates.cs index 73f9433436..1134a65539 100644 --- a/Content.Server/GameObjects/Components/Mobs/DamageStates.cs +++ b/Content.Server/GameObjects/Components/Mobs/DamageStates.cs @@ -93,6 +93,11 @@ namespace Content.Server.GameObjects { return true; } + + bool IActionBlocker.CanChangeDirection() + { + return true; + } } /// @@ -169,6 +174,11 @@ namespace Content.Server.GameObjects { return false; } + + bool IActionBlocker.CanChangeDirection() + { + return true; + } } /// @@ -255,5 +265,10 @@ namespace Content.Server.GameObjects { return false; } + + bool IActionBlocker.CanChangeDirection() + { + return false; + } } } diff --git a/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs b/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs index faf2d9f62a..7e654e6241 100644 --- a/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs @@ -151,6 +151,7 @@ namespace Content.Server.GameObjects.Components.Mobs public bool CanEquip() => (!Stunned); public bool CanUnequip() => (!Stunned); + public bool CanChangeDirection() => true; #endregion } } diff --git a/Content.Server/GameObjects/EntitySystems/ActionBlockerSystem.cs b/Content.Server/GameObjects/EntitySystems/ActionBlockerSystem.cs index e6ce5d7862..90bb573228 100644 --- a/Content.Server/GameObjects/EntitySystems/ActionBlockerSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/ActionBlockerSystem.cs @@ -24,6 +24,7 @@ namespace Content.Server.GameObjects.EntitySystems bool CanAttack() => true; bool CanEquip() => true; bool CanUnequip() => true; + bool CanChangeDirection() => true; } public class ActionBlockerSystem : EntitySystem @@ -145,5 +146,17 @@ namespace Content.Server.GameObjects.EntitySystems return canunequip; } + + public static bool CanChangeDirection(IEntity entity) + { + bool canchangedirection = true; + + foreach (var actionblockercomponents in entity.GetAllComponents()) + { + canchangedirection &= actionblockercomponents.CanChangeDirection(); + } + + return canchangedirection; + } } } diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index 1dcf645020..c5deb92514 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -451,13 +451,14 @@ namespace Content.Server.GameObjects.EntitySystems var item = hands.GetActiveHand?.Owner; + if(ActionBlockerSystem.CanChangeDirection(player)) + playerTransform.LocalRotation = new Angle(coordinates.ToMapPos(_mapManager) - playerTransform.MapPosition.Position); + if (!ActionBlockerSystem.CanInteract(player)) { return; } - playerTransform.LocalRotation = new Angle(coordinates.ToMapPos(_mapManager) - playerTransform.MapPosition.Position); - // TODO: Check if client should be able to see that object to click on it in the first place // Clicked on empty space behavior, try using ranged attack