Remove hardcoded ghosting from MoverSystem.
This commit is contained in:
@@ -3,9 +3,12 @@ using System.Collections.Generic;
|
|||||||
using Content.Server.GameObjects.Components.Mobs;
|
using Content.Server.GameObjects.Components.Mobs;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
|
using Content.Server.Interfaces.GameObjects.Components.Movement;
|
||||||
|
using Content.Server.Observer;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Mobs;
|
using Content.Shared.GameObjects.Components.Mobs;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Server.Interfaces.Player;
|
||||||
using Robust.Shared.ContentPack;
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
@@ -15,7 +18,7 @@ using Robust.Shared.Serialization;
|
|||||||
namespace Content.Server.GameObjects
|
namespace Content.Server.GameObjects
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class SpeciesComponent : SharedSpeciesComponent, IActionBlocker, IOnDamageBehavior, IExAct
|
public class SpeciesComponent : SharedSpeciesComponent, IActionBlocker, IOnDamageBehavior, IExAct, IRelayMoveInput
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Damagestates are reached by reaching a certain damage threshold, they will block actions after being reached
|
/// Damagestates are reached by reaching a certain damage threshold, they will block actions after being reached
|
||||||
@@ -198,6 +201,14 @@ namespace Content.Server.GameObjects
|
|||||||
Owner.GetComponent<DamageableComponent>().TakeDamage(DamageType.Brute, bruteDamage, null);
|
Owner.GetComponent<DamageableComponent>().TakeDamage(DamageType.Brute, bruteDamage, null);
|
||||||
Owner.GetComponent<DamageableComponent>().TakeDamage(DamageType.Heat, burnDamage, null);
|
Owner.GetComponent<DamageableComponent>().TakeDamage(DamageType.Heat, burnDamage, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IRelayMoveInput.MoveInputPressed(IPlayerSession session)
|
||||||
|
{
|
||||||
|
if (CurrentDamageState is DeadState)
|
||||||
|
{
|
||||||
|
new Ghost().Execute(null, session, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -186,13 +186,19 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
|
|
||||||
private static void HandleDirChange(ICommonSession session, Direction dir, bool state)
|
private static void HandleDirChange(ICommonSession session, Direction dir, bool state)
|
||||||
{
|
{
|
||||||
if (!TryGetAttachedComponent(session as IPlayerSession, out IMoverComponent moverComp))
|
var playerSes = session as IPlayerSession;
|
||||||
|
if (!TryGetAttachedComponent(playerSes, out IMoverComponent moverComp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var owner = (session as IPlayerSession)?.AttachedEntity;
|
var owner = playerSes?.AttachedEntity;
|
||||||
|
|
||||||
if (owner != null && owner.TryGetComponent(out SpeciesComponent species) && species.CurrentDamageState is DeadState)
|
if (owner != null)
|
||||||
new Ghost().Execute(null, (IPlayerSession)session, null);
|
{
|
||||||
|
foreach (var comp in owner.GetAllComponents<IRelayMoveInput>())
|
||||||
|
{
|
||||||
|
comp.MoveInputPressed(playerSes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
moverComp.SetVelocityDirection(dir, state);
|
moverComp.SetVelocityDirection(dir, state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using Robust.Server.Interfaces.Player;
|
||||||
|
|
||||||
|
namespace Content.Server.Interfaces.GameObjects.Components.Movement
|
||||||
|
{
|
||||||
|
public interface IRelayMoveInput
|
||||||
|
{
|
||||||
|
void MoveInputPressed(IPlayerSession session);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user