Remove IRelayMoveInput (#4663)
* Remove IRelayMoveInput This interface gets called every time a movement key is pressed so it gets called a lot. * Remove RelayMovementEntityMessage Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Ghost.Components;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Players;
|
||||
@@ -7,6 +8,7 @@ using Content.Server.Visible;
|
||||
using Content.Server.Warps;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Movement.EntitySystems;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
@@ -23,6 +25,7 @@ namespace Content.Server.Ghost
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly GameTicker _ticker = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -36,12 +39,23 @@ namespace Content.Server.Ghost
|
||||
SubscribeLocalEvent<GhostComponent, MindRemovedMessage>(OnMindRemovedMessage);
|
||||
SubscribeLocalEvent<GhostComponent, MindUnvisitedMessage>(OnMindUnvisitedMessage);
|
||||
|
||||
SubscribeLocalEvent<GhostOnMoveComponent, RelayMoveInputEvent>(OnRelayMoveInput);
|
||||
|
||||
SubscribeNetworkEvent<GhostWarpsRequestEvent>(OnGhostWarpsRequest);
|
||||
SubscribeNetworkEvent<GhostReturnToBodyRequest>(OnGhostReturnToBodyRequest);
|
||||
SubscribeNetworkEvent<GhostWarpToLocationRequestEvent>(OnGhostWarpToLocationRequest);
|
||||
SubscribeNetworkEvent<GhostWarpToTargetRequestEvent>(OnGhostWarpToTargetRequest);
|
||||
}
|
||||
|
||||
private void OnRelayMoveInput(EntityUid uid, GhostOnMoveComponent component, RelayMoveInputEvent args)
|
||||
{
|
||||
// Let's not ghost if our mind is visiting...
|
||||
if (ComponentManager.HasComponent<VisitingMindComponent>(uid)) return;
|
||||
if (!ComponentManager.TryGetComponent<MindComponent>(uid, out var mind) || !mind.HasMind || mind.Mind!.IsVisitingEntity) return;
|
||||
|
||||
_ticker.OnGhostAttempt(mind.Mind!, component.CanReturn);
|
||||
}
|
||||
|
||||
private void OnGhostStartup(EntityUid uid, GhostComponent component, ComponentStartup args)
|
||||
{
|
||||
// Allow this entity to be seen by other ghosts.
|
||||
|
||||
Reference in New Issue
Block a user