Fix can't return to body bug (#4424)

This commit is contained in:
mirrorcult
2021-08-06 00:02:36 -07:00
committed by GitHub
parent db65ed5536
commit 09f5ec5cb8
6 changed files with 16 additions and 25 deletions

View File

@@ -10,36 +10,20 @@ namespace Content.Shared.Ghost
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SharedGhostComponent, GhostChangeCanReturnToBodyEvent>(OnGhostChangeCanReturnToBody);
}
private void OnGhostChangeCanReturnToBody(EntityUid uid, SharedGhostComponent component, GhostChangeCanReturnToBodyEvent args)
public void SetCanReturnToBody(SharedGhostComponent component, bool canReturn)
{
if (component.CanReturnToBody == args.CanReturnToBody)
if (component.CanReturnToBody == canReturn)
{
return;
}
component.CanReturnToBody = args.CanReturnToBody;
component.CanReturnToBody = canReturn;
component.Dirty();
}
}
/// <summary>
/// Raised to change the value of <see cref="SharedGhostComponent.CanReturnToBody"/>
/// </summary>
[Serializable, NetSerializable]
public class GhostChangeCanReturnToBodyEvent : EntityEventArgs
{
public GhostChangeCanReturnToBodyEvent(bool canReturnToBody)
{
CanReturnToBody = canReturnToBody;
}
public bool CanReturnToBody { get; }
}
[Serializable, NetSerializable]
public class GhostWarpsRequestEvent : EntityEventArgs
{