Dsay Dirty and Follow commands converted to LEC and localized. (#38666)
* commit * whoopwhoopwhoop
This commit is contained in:
@@ -2,39 +2,36 @@ using Content.Server.Chat.Systems;
|
|||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
|
|
||||||
namespace Content.Server.Administration.Commands
|
namespace Content.Server.Administration.Commands;
|
||||||
|
|
||||||
|
[AdminCommand(AdminFlags.Moderator)]
|
||||||
|
public sealed class DsayCommand : LocalizedEntityCommands
|
||||||
{
|
{
|
||||||
[AdminCommand(AdminFlags.Moderator)]
|
[Dependency] private readonly ChatSystem _chatSystem = default!;
|
||||||
sealed class DSay : IConsoleCommand
|
|
||||||
|
public override string Command => "dsay";
|
||||||
|
|
||||||
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _e = default!;
|
if (shell.Player is not { } player)
|
||||||
|
|
||||||
public string Command => "dsay";
|
|
||||||
|
|
||||||
public string Description => Loc.GetString("dsay-command-description");
|
|
||||||
|
|
||||||
public string Help => Loc.GetString("dsay-command-help-text", ("command", Command));
|
|
||||||
|
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
||||||
{
|
{
|
||||||
if (shell.Player is not { } player)
|
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
|
||||||
{
|
return;
|
||||||
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.AttachedEntity is not { Valid: true } entity)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (args.Length < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var message = string.Join(" ", args).Trim();
|
|
||||||
if (string.IsNullOrEmpty(message))
|
|
||||||
return;
|
|
||||||
|
|
||||||
var chat = _e.System<ChatSystem>();
|
|
||||||
chat.TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Dead, false, shell, player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player.AttachedEntity is not { Valid: true } entity)
|
||||||
|
{
|
||||||
|
shell.WriteError(Loc.GetString("shell-must-be-attached-to-entity"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.Length < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var message = string.Join(" ", args).Trim();
|
||||||
|
if (string.IsNullOrEmpty(message))
|
||||||
|
return;
|
||||||
|
|
||||||
|
_chatSystem.TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Dead, false, shell, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,22 +4,18 @@ using Robust.Shared.Console;
|
|||||||
namespace Content.Server.Administration.Commands;
|
namespace Content.Server.Administration.Commands;
|
||||||
|
|
||||||
[AdminCommand(AdminFlags.Debug)]
|
[AdminCommand(AdminFlags.Debug)]
|
||||||
public sealed class DirtyCommand : IConsoleCommand
|
public sealed class DirtyCommand : LocalizedEntityCommands
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
public override string Command => "dirty";
|
||||||
|
|
||||||
public string Command => "dirty";
|
public override async void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
public string Description => "Marks all components on an entity as dirty, if not specified, dirties everything";
|
|
||||||
public string Help => $"Usage: {Command} [entityUid]";
|
|
||||||
|
|
||||||
public async void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
||||||
{
|
{
|
||||||
switch (args.Length)
|
switch (args.Length)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
foreach (var entity in _entManager.GetEntities())
|
foreach (var entity in EntityManager.GetEntities())
|
||||||
{
|
{
|
||||||
DirtyAll(_entManager, entity);
|
DirtyAll(entity);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@@ -28,7 +24,7 @@ public sealed class DirtyCommand : IConsoleCommand
|
|||||||
shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
|
shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DirtyAll(_entManager, _entManager.GetEntity(parsedTarget));
|
DirtyAll(EntityManager.GetEntity(parsedTarget));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
shell.WriteLine(Loc.GetString("shell-wrong-arguments-number"));
|
shell.WriteLine(Loc.GetString("shell-wrong-arguments-number"));
|
||||||
@@ -36,11 +32,11 @@ public sealed class DirtyCommand : IConsoleCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void DirtyAll(IEntityManager manager, EntityUid entityUid)
|
private void DirtyAll(EntityUid entityUid)
|
||||||
{
|
{
|
||||||
foreach (var component in manager.GetNetComponents(entityUid))
|
foreach (var component in EntityManager.GetNetComponents(entityUid))
|
||||||
{
|
{
|
||||||
manager.Dirty(entityUid, component.component);
|
EntityManager.Dirty(entityUid, component.component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,15 +6,13 @@ using Robust.Shared.Enums;
|
|||||||
namespace Content.Server.Administration.Commands;
|
namespace Content.Server.Administration.Commands;
|
||||||
|
|
||||||
[AdminCommand(AdminFlags.Admin)]
|
[AdminCommand(AdminFlags.Admin)]
|
||||||
public sealed class FollowCommand : IConsoleCommand
|
public sealed class FollowCommand : LocalizedEntityCommands
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
[Dependency] private readonly FollowerSystem _followerSystem = default!;
|
||||||
|
|
||||||
public string Command => "follow";
|
public override string Command => "follow";
|
||||||
public string Description => Loc.GetString("follow-command-description");
|
|
||||||
public string Help => Loc.GetString("follow-command-help");
|
|
||||||
|
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
if (shell.Player is not { } player)
|
if (shell.Player is not { } player)
|
||||||
{
|
{
|
||||||
@@ -34,10 +32,7 @@ public sealed class FollowCommand : IConsoleCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entity = args[0];
|
if (NetEntity.TryParse(args[0], out var uidNet) && EntityManager.TryGetEntity(uidNet, out var uid))
|
||||||
if (NetEntity.TryParse(entity, out var uidNet) && _entManager.TryGetEntity(uidNet, out var uid))
|
_followerSystem.StartFollowingEntity(playerEntity, uid.Value);
|
||||||
{
|
|
||||||
_entManager.System<FollowerSystem>().StartFollowingEntity(playerEntity, uid.Value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
dsay-command-description = Sends a message to deadchat as an admin
|
|
||||||
dsay-command-help-text = Usage: {$command} <message>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
follow-command-description = Makes you begin following an entity
|
|
||||||
follow-command-help = Usage: follow [netEntity]
|
|
||||||
2
Resources/Locale/en-US/commands/dirty-command.ftl
Normal file
2
Resources/Locale/en-US/commands/dirty-command.ftl
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
cmd-dirty-desc = Marks all components on an entity as dirty. If not specified, dirties everything.
|
||||||
|
cmd-dirty-help = Usage: dirty [entityUid]
|
||||||
2
Resources/Locale/en-US/commands/dsay-command.ftl
Normal file
2
Resources/Locale/en-US/commands/dsay-command.ftl
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
cmd-dsay-desc = Sends a message to deadchat as an admin.
|
||||||
|
cmd-dsay-help = Usage: dsay <message>
|
||||||
2
Resources/Locale/en-US/commands/follow-command.ftl
Normal file
2
Resources/Locale/en-US/commands/follow-command.ftl
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
cmd-follow-desc = Makes you begin following an entity.
|
||||||
|
cmd-follow-help = Usage: follow [netEntity]
|
||||||
Reference in New Issue
Block a user