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

View File

@@ -52,7 +52,7 @@ public sealed class SnatcherprodSystem : EntitySystem
{
if (TerminatingOrDeleted(uid))
return;
if (!_itemToggle.IsActivated(uid))
{
if (TryComp<AppearanceComponent>(uid, out var appearance))

View File

@@ -28,3 +28,4 @@ ghost-respawn-window-request-button-timer = Принять ({ $time }сек.)
ghost-respawn-window-request-button = Принять
ghost-respawn-window-rules-footer = Пользуясь это функцией, вы [color=#ff7700]обязуетесь[/color] [color=#ff0000]не переносить[/color] знания своего прошлого персонажа в нового, [color=#ff0000]не метамстить[/color]. Каждый новый персонаж - [color=#ff7700]чистый уникальный лист[/color], который никак не связан с предыдущим. Поэтому не забудьте [color=#ff7700]поменять персонажа[/color] перед заходом, а также помните, что за нарушение пункта, указанного здесь, следует [color=#ff0000]бан в размере от 3ех дней[/color].
ghost-respawn-bug = Нет времени смерти. Установлено стандартное значение.
ghost-respawn-same-character = Нельзя заходить в раунд за того же персонажа. Поменяйте его в настройках персонажей.