Ghost roles create new minds, better tracking of roles at round end screen (#5175)

* Ghost roles now get new Minds

* Some round start/end button stuff

* Mind tracking for better round end reports

* Make traitor kill objectives use mind CharacterName rather than actual occupied entity ("kill brain" prevention)

* Transition over to EntityUid for mind stuff because that's the only way to do it

* BrainSystem fix for PR rebase
This commit is contained in:
20kdc
2021-11-15 18:14:34 +00:00
committed by GitHub
parent c3a7548545
commit 4cce40bd9f
26 changed files with 229 additions and 68 deletions

View File

@@ -16,12 +16,19 @@ namespace Content.Server.Players
[ViewVariables]
public NetUserId UserId { get; }
/// <summary>
/// This is a backup copy of the player name stored on connection.
/// This is useful in the event the player disconnects.
/// </summary>
[ViewVariables]
public string Name { get; }
/// <summary>
/// The currently occupied mind of the player owning this data.
/// DO NOT DIRECTLY SET THIS UNLESS YOU KNOW WHAT YOU'RE DOING.
/// </summary>
[ViewVariables]
public Mind.Mind? Mind { get; set; }
public Mind.Mind? Mind { get; private set; }
/// <summary>
/// If true, the player is an admin and they explicitly de-adminned mid-game,
@@ -32,13 +39,22 @@ namespace Content.Server.Players
public void WipeMind()
{
Mind?.TransferTo(null);
Mind?.RemoveOwningPlayer();
Mind = null;
// This will ensure Mind == null
Mind?.ChangeOwningPlayer(null);
}
public PlayerData(NetUserId userId)
/// <summary>
/// Called from Mind.ChangeOwningPlayer *and nowhere else.*
/// </summary>
public void UpdateMindFromMindChangeOwningPlayer(Mind.Mind? mind)
{
Mind = mind;
}
public PlayerData(NetUserId userId, string name)
{
UserId = userId;
Name = name;
}
}