diff --git a/Content.Client/Chat/ChatManager.cs b/Content.Client/Chat/ChatManager.cs index dd8f437142..8a0fcdeabd 100644 --- a/Content.Client/Chat/ChatManager.cs +++ b/Content.Client/Chat/ChatManager.cs @@ -184,6 +184,9 @@ namespace Content.Client.Chat case ChatChannel.OOC: color = Color.LightSkyBlue; break; + case ChatChannel.Dead: + color = Color.MediumPurple; + break; } _currentChatBox?.AddLine(messageText, message.Channel, color); diff --git a/Content.Server/Administration/AGhost.cs b/Content.Server/Administration/AGhost.cs index 40547197e1..3eff686aef 100644 --- a/Content.Server/Administration/AGhost.cs +++ b/Content.Server/Administration/AGhost.cs @@ -1,10 +1,12 @@ -using Content.Server.GameObjects.Components.Observer; +using System.Timers; +using Content.Server.GameObjects.Components.Observer; using Content.Server.Players; using Robust.Server.Interfaces.Console; using Robust.Server.Interfaces.Player; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; +using Timer = Robust.Shared.Timers.Timer; namespace Content.Server.Administration { diff --git a/Content.Server/Administration/ControlMob.cs b/Content.Server/Administration/ControlMob.cs index 4a72b5dd89..8b08f3d99e 100644 --- a/Content.Server/Administration/ControlMob.cs +++ b/Content.Server/Administration/ControlMob.cs @@ -1,4 +1,5 @@ using Content.Server.GameObjects.Components.Mobs; +using Content.Server.GameObjects.Components.Observer; using Content.Server.Mobs; using Content.Server.Players; using Robust.Server.Interfaces.Console; @@ -55,9 +56,14 @@ namespace Content.Server.Administration return; } + var oldEntity = mind.CurrentEntity; + mindComponent.Mind?.TransferTo(null); mind.TransferTo(target); + if(oldEntity.HasComponent()) + oldEntity.Delete(); + } } } diff --git a/Content.Server/GameObjects/Components/Observer/GhostComponent.cs b/Content.Server/GameObjects/Components/Observer/GhostComponent.cs index 6adc21ed33..bcb1365b56 100644 --- a/Content.Server/GameObjects/Components/Observer/GhostComponent.cs +++ b/Content.Server/GameObjects/Components/Observer/GhostComponent.cs @@ -50,6 +50,7 @@ namespace Content.Server.GameObjects.Components.Observer if (netChannel == null || netChannel == actor.playerSession.ConnectedClient) { actor.playerSession.ContentData().Mind.UnVisit(); + Owner.Delete(); } break; case PlayerAttachedMsg msg: @@ -58,7 +59,6 @@ namespace Content.Server.GameObjects.Components.Observer break; case PlayerDetachedMsg msg: msg.OldPlayer.VisibilityMask &= ~(int)VisibilityFlags.Ghost; - Timer.Spawn(100, Owner.Delete); break; default: break; diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index b2f0a862c3..d81bafeffa 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -6,6 +6,7 @@ using Content.Server.GameObjects; using Content.Server.GameObjects.Components.Access; using Content.Server.GameObjects.Components.Markers; using Content.Server.GameObjects.Components.Mobs; +using Content.Server.GameObjects.Components.Observer; using Content.Server.GameTicking.GamePresets; using Content.Server.Interfaces; using Content.Server.Interfaces.Chat; @@ -630,12 +631,18 @@ namespace Content.Server.GameTicking private void _spawnObserver(IPlayerSession session) { + var name = _prefsManager + .GetPreferences(session.SessionId.Username) + .SelectedCharacter.Name; + _playerJoinGame(session); var data = session.ContentData(); data.WipeMind(); data.Mind = new Mind(session.SessionId); var mob = _spawnObserverMob(); + mob.Name = name; + mob.GetComponent().CanReturnToBody = false; data.Mind.TransferTo(mob); } diff --git a/Content.Server/GlobalVerbs/ControlMobVerb.cs b/Content.Server/GlobalVerbs/ControlMobVerb.cs index 52150d57be..2da62dba18 100644 --- a/Content.Server/GlobalVerbs/ControlMobVerb.cs +++ b/Content.Server/GlobalVerbs/ControlMobVerb.cs @@ -1,6 +1,7 @@ using Content.Server.GameObjects; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Nutrition; +using Content.Server.GameObjects.Components.Observer; using Content.Server.Players; using Content.Shared.GameObjects; using Robust.Server.Console; @@ -41,9 +42,13 @@ namespace Content.Server.GlobalVerbs { var userMind = user.GetComponent().playerSession.ContentData().Mind; var targetMind = target.GetComponent(); + var oldEntity = userMind.CurrentEntity; targetMind.Mind?.TransferTo(null); userMind.TransferTo(target); + + if(oldEntity.HasComponent()) + oldEntity.Delete(); } } } diff --git a/Content.Server/Observer/Ghost.cs b/Content.Server/Observer/Ghost.cs index 712d673c5a..12696ef85d 100644 --- a/Content.Server/Observer/Ghost.cs +++ b/Content.Server/Observer/Ghost.cs @@ -10,6 +10,7 @@ using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Map; +using Robust.Shared.Timers; namespace Content.Server.Observer { @@ -37,6 +38,7 @@ namespace Content.Server.Observer if (mind.VisitingEntity != null) { mind.UnVisit(); + mind.VisitingEntity.Delete(); } var position = player.AttachedEntity?.Transform.GridPosition ?? IoCManager.Resolve().GetObserverSpawnPoint();