Add ability to prevent ghosting (#12906)
* add ability to prevent ghosting to MindComponent.cs * make minds preserve properties in certain transfer scenarios * Revert "make minds preserve properties in certain transfer scenarios" This reverts commit 333cae0db0faf4ef81767b93332271d944c90a0e. * move PreventGhosting to the actual mind
This commit is contained in:
@@ -83,12 +83,13 @@ namespace Content.Server.Chat.Managers
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Server announcement: {message}");
|
||||
}
|
||||
|
||||
public void DispatchServerMessage(IPlayerSession player, string message)
|
||||
public void DispatchServerMessage(IPlayerSession player, string message, bool suppressLog = false)
|
||||
{
|
||||
var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", FormattedMessage.EscapeText(message)));
|
||||
ChatMessageToOne(ChatChannel.Server, message, wrappedMessage, default, false, player.ConnectedClient);
|
||||
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Server message to {player:Player}: {message}");
|
||||
if (!suppressLog)
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Server message to {player:Player}: {message}");
|
||||
}
|
||||
|
||||
public void SendAdminAnnouncement(string message)
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Server.Chat.Managers
|
||||
/// <param name="colorOverride">Override the color of the message being sent.</param>
|
||||
void DispatchServerAnnouncement(string message, Color? colorOverride = null);
|
||||
|
||||
void DispatchServerMessage(IPlayerSession player, string message);
|
||||
void DispatchServerMessage(IPlayerSession player, string message, bool suppressLog = false);
|
||||
|
||||
void TrySendOOCMessage(IPlayerSession player, string message, OOCChatType type);
|
||||
|
||||
|
||||
@@ -156,6 +156,14 @@ namespace Content.Server.GameTicking
|
||||
if (handleEv.Handled)
|
||||
return handleEv.Result;
|
||||
|
||||
if (mind.PreventGhosting)
|
||||
{
|
||||
if (mind.Session != null)
|
||||
// Logging is suppressed to prevent spam from ghost attempts caused by movement attempts
|
||||
_chatManager.DispatchServerMessage(mind.Session, Loc.GetString("comp-mind-ghosting-prevented"), true);
|
||||
return false;
|
||||
}
|
||||
|
||||
var playerEntity = mind.CurrentEntity;
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
@@ -109,6 +109,13 @@ namespace Content.Server.Mind
|
||||
[ViewVariables]
|
||||
public IEnumerable<Objective> AllObjectives => _objectives;
|
||||
|
||||
/// <summary>
|
||||
/// Prevents user from ghosting out
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("preventGhosting")]
|
||||
public bool PreventGhosting { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The session of the player owning this mind.
|
||||
/// Can be null, in which case the player is currently not logged in.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# MindComponent localization
|
||||
|
||||
comp-mind-ghosting-prevented = You are not able to ghost right now.
|
||||
|
||||
## Messages displayed when a body is examined and in a certain state
|
||||
comp-mind-examined-catatonic = { CAPITALIZE(SUBJECT($ent)) } { CONJUGATE-BE($ent) } totally catatonic. The stresses of life in deep-space must have been too much for { OBJECT($ent) }. Any recovery is unlikely.
|
||||
comp-mind-examined-dead = { CAPITALIZE(POSS-ADJ($ent)) } soul has departed.
|
||||
|
||||
Reference in New Issue
Block a user