[Fix] Check for character changed after ghost respawn (#430)

This commit is contained in:
HitPanda
2023-09-23 15:57:14 +03:00
committed by Aviu00
parent 0cc831cb18
commit 2cf07a15e8
3 changed files with 27 additions and 1 deletions

View File

@@ -4,14 +4,18 @@ using System.Numerics;
using Content.Server.Administration.Managers;
using System.Text;
using Content.Server.Ghost;
using Content.Server.Mind;
using Content.Server.Players;
using Content.Server.Spawners.Components;
using Content.Server.Speech.Components;
using Content.Server.Station.Components;
using Content.Shared.CCVar;
using Content.Shared.Chat;
using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.Players;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Mind;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Content.Shared.Roles.Jobs;
@@ -158,6 +162,27 @@ namespace Content.Server.GameTicking
return;
}
//WD start
//Ghost system return to round, check for whether the character isn't the same.
if (lateJoin)
{
var allPlayerMinds = EntityQuery<MindComponent>()
.Where(mind => mind.OriginalOwnerUserId == player.UserId);
foreach (var mind in allPlayerMinds)
{
if (mind.CharacterName == character.Name && !_adminManager.IsAdmin(player))
{
var message = Loc.GetString("ghost-respawn-same-character");
var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message));
_chatManager.ChatMessageToOne(ChatChannel.Server, message, wrappedMessage,
default, false, player.ConnectedClient, Color.Red);
return;
}
}
}
//WD end
// Automatically de-admin players who are joining.
if (_cfg.GetCVar(CCVars.AdminDeadminOnJoin) && _adminManager.IsAdmin(player))
_adminManager.DeAdmin(player);