Action blocker for changing direction
This commit is contained in:
@@ -93,6 +93,11 @@ namespace Content.Server.GameObjects
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IActionBlocker.CanChangeDirection()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -169,6 +174,11 @@ namespace Content.Server.GameObjects
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IActionBlocker.CanChangeDirection()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -255,5 +265,10 @@ namespace Content.Server.GameObjects
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IActionBlocker.CanChangeDirection()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ namespace Content.Server.GameObjects.Components.Mobs
|
|||||||
public bool CanEquip() => (!Stunned);
|
public bool CanEquip() => (!Stunned);
|
||||||
|
|
||||||
public bool CanUnequip() => (!Stunned);
|
public bool CanUnequip() => (!Stunned);
|
||||||
|
public bool CanChangeDirection() => true;
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
bool CanAttack() => true;
|
bool CanAttack() => true;
|
||||||
bool CanEquip() => true;
|
bool CanEquip() => true;
|
||||||
bool CanUnequip() => true;
|
bool CanUnequip() => true;
|
||||||
|
bool CanChangeDirection() => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ActionBlockerSystem : EntitySystem
|
public class ActionBlockerSystem : EntitySystem
|
||||||
@@ -145,5 +146,17 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
|
|
||||||
return canunequip;
|
return canunequip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool CanChangeDirection(IEntity entity)
|
||||||
|
{
|
||||||
|
bool canchangedirection = true;
|
||||||
|
|
||||||
|
foreach (var actionblockercomponents in entity.GetAllComponents<IActionBlocker>())
|
||||||
|
{
|
||||||
|
canchangedirection &= actionblockercomponents.CanChangeDirection();
|
||||||
|
}
|
||||||
|
|
||||||
|
return canchangedirection;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -451,13 +451,14 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
|
|
||||||
var item = hands.GetActiveHand?.Owner;
|
var item = hands.GetActiveHand?.Owner;
|
||||||
|
|
||||||
|
if(ActionBlockerSystem.CanChangeDirection(player))
|
||||||
|
playerTransform.LocalRotation = new Angle(coordinates.ToMapPos(_mapManager) - playerTransform.MapPosition.Position);
|
||||||
|
|
||||||
if (!ActionBlockerSystem.CanInteract(player))
|
if (!ActionBlockerSystem.CanInteract(player))
|
||||||
{
|
{
|
||||||
return;
|
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
|
// 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
|
// Clicked on empty space behavior, try using ranged attack
|
||||||
|
|||||||
Reference in New Issue
Block a user