From 73d754e2d216f97dff18a2884ee6f728412b126d Mon Sep 17 00:00:00 2001 From: zumorica Date: Fri, 17 Apr 2020 18:51:51 +0200 Subject: [PATCH 1/6] Observers now get correct name on observe from lobby --- Content.Server/GameTicking/GameTicker.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index b2f0a862c3..910446c8df 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -630,12 +630,17 @@ 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; data.Mind.TransferTo(mob); } From 01e8e4784b9e097d55b2b0e090c7d23b565da88e Mon Sep 17 00:00:00 2001 From: zumorica Date: Fri, 17 Apr 2020 19:16:42 +0200 Subject: [PATCH 2/6] Joining round as observer greys out return to body button --- Content.Server/GameTicking/GameTicker.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 910446c8df..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; @@ -641,6 +642,7 @@ namespace Content.Server.GameTicking var mob = _spawnObserverMob(); mob.Name = name; + mob.GetComponent().CanReturnToBody = false; data.Mind.TransferTo(mob); } From 02ccc6dc45fba00a8ba8ad507c09b29220f120b7 Mon Sep 17 00:00:00 2001 From: zumorica Date: Fri, 17 Apr 2020 19:19:37 +0200 Subject: [PATCH 3/6] Only delete ghosts on return to body or unghost --- Content.Server/Administration/AGhost.cs | 6 ++++-- .../GameObjects/Components/Observer/GhostComponent.cs | 2 +- Content.Server/Observer/Ghost.cs | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Content.Server/Administration/AGhost.cs b/Content.Server/Administration/AGhost.cs index 40547197e1..f4eb9fca29 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 { @@ -27,7 +29,7 @@ namespace Content.Server.Administration { var visiting = mind.VisitingEntity; mind.UnVisit(); - visiting.Delete(); + Timer.Spawn(100, visiting.Delete); } else { diff --git a/Content.Server/GameObjects/Components/Observer/GhostComponent.cs b/Content.Server/GameObjects/Components/Observer/GhostComponent.cs index 6adc21ed33..a829ad5987 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(); + Timer.Spawn(100, 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/Observer/Ghost.cs b/Content.Server/Observer/Ghost.cs index 712d673c5a..c87581f3d3 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(); + Timer.Spawn(100, mind.VisitingEntity.Delete); } var position = player.AttachedEntity?.Transform.GridPosition ?? IoCManager.Resolve().GetObserverSpawnPoint(); From c2e328e5ae74c269d9bd572c505e55e40a8e0f69 Mon Sep 17 00:00:00 2001 From: zumorica Date: Fri, 17 Apr 2020 19:23:06 +0200 Subject: [PATCH 4/6] Turns out we don't need to spawn a timer to delete ghosts anymore --- Content.Server/Administration/AGhost.cs | 2 +- .../GameObjects/Components/Observer/GhostComponent.cs | 2 +- Content.Server/Observer/Ghost.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Content.Server/Administration/AGhost.cs b/Content.Server/Administration/AGhost.cs index f4eb9fca29..3eff686aef 100644 --- a/Content.Server/Administration/AGhost.cs +++ b/Content.Server/Administration/AGhost.cs @@ -29,7 +29,7 @@ namespace Content.Server.Administration { var visiting = mind.VisitingEntity; mind.UnVisit(); - Timer.Spawn(100, visiting.Delete); + visiting.Delete(); } else { diff --git a/Content.Server/GameObjects/Components/Observer/GhostComponent.cs b/Content.Server/GameObjects/Components/Observer/GhostComponent.cs index a829ad5987..bcb1365b56 100644 --- a/Content.Server/GameObjects/Components/Observer/GhostComponent.cs +++ b/Content.Server/GameObjects/Components/Observer/GhostComponent.cs @@ -50,7 +50,7 @@ namespace Content.Server.GameObjects.Components.Observer if (netChannel == null || netChannel == actor.playerSession.ConnectedClient) { actor.playerSession.ContentData().Mind.UnVisit(); - Timer.Spawn(100, Owner.Delete); + Owner.Delete(); } break; case PlayerAttachedMsg msg: diff --git a/Content.Server/Observer/Ghost.cs b/Content.Server/Observer/Ghost.cs index c87581f3d3..12696ef85d 100644 --- a/Content.Server/Observer/Ghost.cs +++ b/Content.Server/Observer/Ghost.cs @@ -38,7 +38,7 @@ namespace Content.Server.Observer if (mind.VisitingEntity != null) { mind.UnVisit(); - Timer.Spawn(100, mind.VisitingEntity.Delete); + mind.VisitingEntity.Delete(); } var position = player.AttachedEntity?.Transform.GridPosition ?? IoCManager.Resolve().GetObserverSpawnPoint(); From a408cdad0a419c95291ea6bac6c0c87b69a884e2 Mon Sep 17 00:00:00 2001 From: zumorica Date: Fri, 17 Apr 2020 19:28:08 +0200 Subject: [PATCH 5/6] Fix ControlMob not deleting ghosts --- Content.Server/Administration/ControlMob.cs | 6 ++++++ Content.Server/GlobalVerbs/ControlMobVerb.cs | 5 +++++ 2 files changed, 11 insertions(+) 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/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(); } } } From 47e964a882e7fe8b99e18bcfa4741dd7b27f5ff1 Mon Sep 17 00:00:00 2001 From: zumorica Date: Fri, 17 Apr 2020 19:38:18 +0200 Subject: [PATCH 6/6] Deadchat now has color --- Content.Client/Chat/ChatManager.cs | 3 +++ 1 file changed, 3 insertions(+) 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);