Adds a component for ghosting on move. (#3090)

* Adds a component for ghosting on move.
Adds a dummy input mover for IRelayMoveInput to work.

* Add IGhostOnMove

* Fix tests.
This commit is contained in:
Vera Aguilera Puerto
2021-02-05 17:02:20 +01:00
committed by GitHub
parent 63e1252539
commit 9884b14e8d
5 changed files with 90 additions and 1 deletions

View File

@@ -1,7 +1,9 @@
#nullable enable
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Observer;
using Content.Shared.GameObjects.Components.Body;
using Content.Shared.GameObjects.Components.Body.Part;
using Content.Shared.GameObjects.Components.Movement;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
@@ -56,6 +58,13 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
newEntity.EnsureComponent<MindComponent>();
var oldMind = oldEntity.EnsureComponent<MindComponent>();
if (!newEntity.HasComponent<IGhostOnMove>())
newEntity.AddComponent<GhostOnMoveComponent>();
// TODO: This is an awful solution.
if (!newEntity.HasComponent<IMoverComponent>())
newEntity.AddComponent<SharedDummyInputMoverComponent>();
oldMind.Mind?.TransferTo(newEntity);
}
}

View File

@@ -1,6 +1,7 @@
#nullable enable
using System;
using Content.Server.Commands.Observer;
using Content.Server.GameObjects.Components.Observer;
using Content.Shared.Audio;
using Content.Shared.GameObjects.Components.Body;
using Content.Shared.GameObjects.Components.Body.Part;
@@ -25,7 +26,8 @@ namespace Content.Server.GameObjects.Components.Body
[RegisterComponent]
[ComponentReference(typeof(SharedBodyComponent))]
[ComponentReference(typeof(IBody))]
public class BodyComponent : SharedBodyComponent, IRelayMoveInput
[ComponentReference(typeof(IGhostOnMove))]
public class BodyComponent : SharedBodyComponent, IRelayMoveInput, IGhostOnMove
{
private Container _partContainer = default!;