From 3d96d252c1416d25be05faf22fb0fe54a81aa452 Mon Sep 17 00:00:00 2001 From: ZoNeSRuS Date: Wed, 21 Feb 2024 14:05:52 +0700 Subject: [PATCH] fixResp --- Content.Server/Ghost/GhostSystem.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index 0adb0357817b6c..2f735d49dc4c3f 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -23,7 +23,7 @@ using Robust.Shared.Physics.Systems; using Robust.Shared.Player; using Robust.Shared.Timing; -using Robust.Server.Console; +using Robust.Shared.Network; namespace Content.Server.Ghost { @@ -43,7 +43,6 @@ public sealed class GhostSystem : SharedGhostSystem [Dependency] private readonly GameTicker _ticker = default!; [Dependency] private readonly TransformSystem _transformSystem = default!; [Dependency] private readonly VisibilitySystem _visibilitySystem = default!; - [Dependency] private readonly IServerConsoleHost _host = default!; public override void Initialize() { @@ -124,7 +123,15 @@ private void OnActionRespanw(EntityUid uid, GhostComponent component, RespawnAct if (!TryComp(uid, out var actor)) return; - _host.ExecuteCommand(actor.PlayerSession, "respawn"); + var playerMgr = IoCManager.Resolve(); + NetUserId userId; + userId = actor.PlayerSession.UserId; + if (!playerMgr.TryGetSessionById(userId, out var targetPlayer)) + return; + + _ticker.Respawn(targetPlayer); + + } //SS-220 end noDeath private void OnRelayMoveInput(EntityUid uid, GhostOnMoveComponent component, ref MoveInputEvent args)