mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
# Description This refactors #510 and #553. #553 specifically was reverted and re-implemented from scratch. As a consequence to all of this, the chat system was refactored a bit too, hopefully for the best. Changes: - InGameICChatType, InGameOOCChatType, ChatTransmitRange were all moved to shared and made serializable - Added a method to wrap whisper messages to reduce code duplication in chat system - Both WrapPublicMethod and WrapWhisperMessage call the same generic WrapMessage method, which allows to add speech verbs to whispers and more. That method is also fully responsible for adding language markers and deducing speech verbs now. - Everything related to speech was moved out of LanguagePrototype and into SpeechOverrideInfo. LanguagePrototype now holds an instance of that. - Added AllowRadio, RequireSpeech, ChatTypeOverride, SpeechVerbOverrides, MessageWrapOverrides to SpeechOverrideInfo, all of which are used in implementing the sign language. - Suffered a lot # TODO - [X] Cry - [X] Fix the sign language not displaying properly over the character. - [X] Find a way to circumvent being unable to speak?? <details><summary><h1>Media</h1></summary><p>  See below </p></details> # Changelog No cl no fun --------- Signed-off-by: Mnemotechnican <69920617+Mnemotechnician@users.noreply.github.com> Co-authored-by: Danger Revolution! <142105406+DangerRevolution@users.noreply.github.com>
64 lines
2.2 KiB
C#
64 lines
2.2 KiB
C#
using System.Linq;
|
|
using Content.Server.Administration.Logs;
|
|
using Content.Server.Chat.Systems;
|
|
using Content.Shared.Administration;
|
|
using Content.Shared.Chat;
|
|
using Content.Shared.Database;
|
|
using Robust.Shared.Console;
|
|
|
|
namespace Content.Server.Administration.Commands;
|
|
|
|
[AdminCommand(AdminFlags.Admin)]
|
|
public sealed class OSay : LocalizedCommands
|
|
{
|
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
|
|
public override string Command => "osay";
|
|
|
|
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
|
{
|
|
if (args.Length == 1)
|
|
{
|
|
return CompletionResult.FromHint(Loc.GetString("osay-command-arg-uid"));
|
|
}
|
|
|
|
if (args.Length == 2)
|
|
{
|
|
return CompletionResult.FromHintOptions( Enum.GetNames(typeof(InGameICChatType)),
|
|
Loc.GetString("osay-command-arg-type"));
|
|
}
|
|
|
|
if (args.Length > 2)
|
|
{
|
|
return CompletionResult.FromHint(Loc.GetString("osay-command-arg-message"));
|
|
}
|
|
|
|
return CompletionResult.Empty;
|
|
}
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
if (args.Length < 3)
|
|
{
|
|
shell.WriteLine(Loc.GetString("osay-command-error-args"));
|
|
return;
|
|
}
|
|
|
|
var chatType = (InGameICChatType) Enum.Parse(typeof(InGameICChatType), args[1]);
|
|
|
|
if (!NetEntity.TryParse(args[0], out var sourceNet) || !_entityManager.TryGetEntity(sourceNet, out var source) || !_entityManager.EntityExists(source))
|
|
{
|
|
shell.WriteLine(Loc.GetString("osay-command-error-euid", ("arg", args[0])));
|
|
return;
|
|
}
|
|
|
|
var message = string.Join(" ", args.Skip(2)).Trim();
|
|
if (string.IsNullOrEmpty(message))
|
|
return;
|
|
|
|
_entityManager.System<ChatSystem>().TrySendInGameICMessage(source.Value, message, chatType, false);
|
|
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{(shell.Player != null ? shell.Player.Name : "An administrator")} forced {_entityManager.ToPrettyString(source.Value)} to {args[1]}: {message}");
|
|
}
|
|
}
|