From 2cf07a15e8c26c4b8f58130ca46000d076d94745 Mon Sep 17 00:00:00 2001 From: HitPanda <104197232+EnefFlow@users.noreply.github.com> Date: Sat, 23 Sep 2023 15:57:14 +0300 Subject: [PATCH] [Fix] Check for character changed after ghost respawn (#430) --- .../GameTicking/GameTicker.Spawning.cs | 25 +++++++++++++++++++ .../White/Snatcherprod/SnatcherprodSystem.cs | 2 +- Resources/Locale/ru-RU/ghost/ghost-gui.ftl | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs index fe04db37d9..1eb0ee7d50 100644 --- a/Content.Server/GameTicking/GameTicker.Spawning.cs +++ b/Content.Server/GameTicking/GameTicker.Spawning.cs @@ -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() + .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); diff --git a/Content.Server/White/Snatcherprod/SnatcherprodSystem.cs b/Content.Server/White/Snatcherprod/SnatcherprodSystem.cs index 49e1986715..0bc2c9feb7 100644 --- a/Content.Server/White/Snatcherprod/SnatcherprodSystem.cs +++ b/Content.Server/White/Snatcherprod/SnatcherprodSystem.cs @@ -52,7 +52,7 @@ public sealed class SnatcherprodSystem : EntitySystem { if (TerminatingOrDeleted(uid)) return; - + if (!_itemToggle.IsActivated(uid)) { if (TryComp(uid, out var appearance)) diff --git a/Resources/Locale/ru-RU/ghost/ghost-gui.ftl b/Resources/Locale/ru-RU/ghost/ghost-gui.ftl index 6c04fa8e08..56d2259eba 100644 --- a/Resources/Locale/ru-RU/ghost/ghost-gui.ftl +++ b/Resources/Locale/ru-RU/ghost/ghost-gui.ftl @@ -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 = Нельзя заходить в раунд за того же персонажа. Поменяйте его в настройках персонажей.