Mind ecs (#14412)
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Content.Server.Chat.Commands
|
||||
var mind = player.ContentData()?.Mind;
|
||||
|
||||
// This check also proves mind not-null for at the end when the mob is ghosted.
|
||||
if (mind?.OwnedComponent?.Owner is not { Valid: true } victim)
|
||||
if (mind?.OwnedEntity is not { Valid: true } victim)
|
||||
{
|
||||
shell.WriteLine("You don't have a mind!");
|
||||
return;
|
||||
|
||||
@@ -116,19 +116,19 @@ namespace Content.Server.Chat.Managers
|
||||
ChatMessageToMany(ChatChannel.AdminAlert, message, wrappedMessage, default, false, true, clients);
|
||||
}
|
||||
|
||||
public void SendAdminAlert(EntityUid player, string message, MindComponent? mindComponent = null)
|
||||
public void SendAdminAlert(EntityUid player, string message, MindContainerComponent? mindContainerComponent = null)
|
||||
{
|
||||
if(mindComponent == null && !_entityManager.TryGetComponent(player, out mindComponent))
|
||||
if(mindContainerComponent == null && !_entityManager.TryGetComponent(player, out mindContainerComponent))
|
||||
{
|
||||
SendAdminAlert(message);
|
||||
return;
|
||||
}
|
||||
|
||||
var adminSystem = _entityManager.System<AdminSystem>();
|
||||
var antag = mindComponent.Mind!.UserId != null
|
||||
&& (adminSystem.GetCachedPlayerInfo(mindComponent.Mind!.UserId.Value)?.Antag ?? false);
|
||||
var antag = mindContainerComponent.Mind!.UserId != null
|
||||
&& (adminSystem.GetCachedPlayerInfo(mindContainerComponent.Mind!.UserId.Value)?.Antag ?? false);
|
||||
|
||||
SendAdminAlert($"{mindComponent.Mind!.Session?.Name}{(antag ? " (ANTAG)" : "")} {message}");
|
||||
SendAdminAlert($"{mindContainerComponent.Mind!.Session?.Name}{(antag ? " (ANTAG)" : "")} {message}");
|
||||
}
|
||||
|
||||
public void SendHookOOC(string sender, string message)
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.Chat.Managers
|
||||
void SendHookOOC(string sender, string message);
|
||||
void SendAdminAnnouncement(string message);
|
||||
void SendAdminAlert(string message);
|
||||
void SendAdminAlert(EntityUid player, string message, MindComponent? mindComponent = null);
|
||||
void SendAdminAlert(EntityUid player, string message, MindContainerComponent? mindContainerComponent = null);
|
||||
|
||||
void ChatMessageToOne(ChatChannel channel, string message, string wrappedMessage, EntityUid source, bool hideChat,
|
||||
INetChannel client, Color? colorOverride = null, bool recordReplay = false, string? audioPath = null, float audioVolume = 0);
|
||||
|
||||
@@ -497,9 +497,9 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
if (player == null)
|
||||
return true;
|
||||
|
||||
var mindComponent = player.ContentData()?.Mind;
|
||||
var mindContainerComponent = player.ContentData()?.Mind;
|
||||
|
||||
if (mindComponent == null)
|
||||
if (mindContainerComponent == null)
|
||||
{
|
||||
shell?.WriteError("You don't have a mind!");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user