Apply smiley filter on me-command (#6153)
This commit is contained in:
@@ -18,39 +18,29 @@ namespace Content.Server.Chat.Commands
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
if (shell.Player is not IPlayerSession player)
|
||||
{
|
||||
shell.WriteLine("This command cannot be run from the server.");
|
||||
shell.WriteError("This command cannot be run from the server.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.Status != SessionStatus.InGame || player.AttachedEntity == null)
|
||||
if (player.Status != SessionStatus.InGame)
|
||||
return;
|
||||
|
||||
if (args.Length < 1)
|
||||
return;
|
||||
|
||||
var action = string.Join(" ", args).Trim();
|
||||
if (string.IsNullOrEmpty(action))
|
||||
return;
|
||||
|
||||
var chat = IoCManager.Resolve<IChatManager>();
|
||||
var mindComponent = player.ContentData()?.Mind;
|
||||
|
||||
if (mindComponent == null)
|
||||
{
|
||||
shell.WriteError("You don't have a mind!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mindComponent.OwnedEntity == null)
|
||||
if (player.AttachedEntity is not {} playerEntity)
|
||||
{
|
||||
shell.WriteError("You don't have an entity!");
|
||||
return;
|
||||
}
|
||||
|
||||
chat.EntityMe(mindComponent.OwnedEntity.Value, action);
|
||||
if (args.Length < 1)
|
||||
return;
|
||||
|
||||
var message = string.Join(" ", args).Trim();
|
||||
if (string.IsNullOrEmpty(message))
|
||||
return;
|
||||
|
||||
IoCManager.Resolve<IChatManager>().TryEmote(playerEntity, message, shell, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user