Merge pull request #823 from Zumorica/2020-04-17-fix-my-shit

This commit is contained in:
Pieter-Jan Briers
2020-04-17 21:01:37 +02:00
committed by GitHub
7 changed files with 27 additions and 2 deletions

View File

@@ -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);

View File

@@ -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
{

View File

@@ -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<GhostComponent>())
oldEntity.Delete();
}
}
}

View File

@@ -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;

View File

@@ -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<GhostComponent>().CanReturnToBody = false;
data.Mind.TransferTo(mob);
}

View File

@@ -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<IActorComponent>().playerSession.ContentData().Mind;
var targetMind = target.GetComponent<MindComponent>();
var oldEntity = userMind.CurrentEntity;
targetMind.Mind?.TransferTo(null);
userMind.TransferTo(target);
if(oldEntity.HasComponent<GhostComponent>())
oldEntity.Delete();
}
}
}

View File

@@ -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<IGameTicker>().GetObserverSpawnPoint();