Skip to content

Conversation

Pok27
Copy link
Contributor

@Pok27 Pok27 commented Oct 7, 2025

IConsoleCommand dead, now only LocalizedEntityCommands/LocalizedCommands
I looked through all command files and their localization keys and fixed/added the missing ones

Required space-wizards/RobustToolbox#6248

@PJBot PJBot added S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. S: Needs Review Status: Requires additional reviews before being fully accepted. Not to be replaced by S: Approved. size/L Denotes a PR that changes 1000-4999 lines. Changes: UI Changes: Might require knowledge of UI design or code. labels Oct 7, 2025
@github-actions github-actions bot added the S: Merge Conflict Status: Needs to resolve merge conflicts before it can be accepted label Oct 7, 2025
Copy link
Contributor

github-actions bot commented Oct 7, 2025

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the S: Merge Conflict Status: Needs to resolve merge conflicts before it can be accepted label Oct 7, 2025
@Siginanto
Copy link
Contributor

Holy moth

@Princess-Cheeseballs
Copy link
Member

Is it possible to split this into multiple PRs? Or is the large diff unavoidable?

Copy link
Contributor

@VerinSenpai VerinSenpai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I be doing a naughty naughty and looking at this while Im at work so this is all Ive got to so far


public override string Command => "showsubfloor";

public override string Help => Loc.GetString($"cmd-{Command}-help", ("command", Command));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line and description aren't necessary in localized commands as they're fetched automatically by the parent class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not contain a parameter with the command passed to the key.

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LocalizedCommand which is inherited by LocalizedEntityCommand does have it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#37991

See the linked PR and the associated commands

Copy link
Contributor Author

@Pok27 Pok27 Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to pass the command name in {$command} (although this should be corrected), but here and in other commands it is necessary.

example:
image

Copy link
Contributor Author

@Pok27 Pok27 Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it better this way. It could be useful for renaming the command. We need a third person to decide. D:

Copy link
Contributor

@VerinSenpai VerinSenpai Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have had a moment of enlightenment that has foretold your reasoning behind this and I've come to agree.

I then bring 2 questions:

What does Loc.GetString do if a format value is passed but the string its formatting doesn't contain the formatee.

And if it silently ignores it, can we just update the help line in the parent class to get the name, as you've suggested above. This would let us keep these help overrides cleaned up.

Was also thinking that usage string with the command name could have its own locale string that could be used by this. Maybe I'm being too ambitious. I will dig deeper this weekend.

Copy link
Contributor Author

@Pok27 Pok27 Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think everything will be fine. I'll do the PR in RobustToolbox a little later. I don't know about localizing the commands, but I think can do it in another PR if necessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what i can see in fluent source code it looks pretty close to the fact that it should ignore arguments passed if they are not used. It cretes Scope from arguments and then asks to resolve arguments as it sees them in string to be formatted. So it would probably be fine to put additional arguments all the time? At the same time, when you put no arguments, it does not create bunch of objects, so it gives less memory workload. Meh. Its not like command helper props are on hot path :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works out great then. Shouldn't be an issue regardless as this updates most if not all help strings to take the command name as an argument and any future command additions should follow suit.

_overlay.AddOverlay(new AccessOverlay(EntityManager, _cache, _xform));

shell.WriteLine(Loc.GetString($"cmd-showaccessreaders-status", ("status", !existing)));
shell.WriteLine(Loc.GetString($"cmd-{Command}-status", ("status", !existing)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of doing this as I believe it hurts readability in the commands and I've been removing this in my own localization prs. Pinging @slarticodefast since he's reviewed most of mine to see if he has an opinion on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the style from this PR #22897.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid doing this, in case we rename the command in the future it would break all ftl string names and we would have to rename all of them.

@Pok27
Copy link
Contributor Author

Pok27 commented Oct 8, 2025

Is it possible to split this into multiple PRs? Or is the large diff unavoidable?

It's not impossible, but it will be difficult. It was easier for me to fix all .flt files to one format, after all the commands, without thinking about which commands with .flt will be in this PR.

@github-actions github-actions bot added the S: Merge Conflict Status: Needs to resolve merge conflicts before it can be accepted label Oct 8, 2025
Copy link
Contributor

github-actions bot commented Oct 8, 2025

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the S: Merge Conflict Status: Needs to resolve merge conflicts before it can be accepted label Oct 8, 2025
@VerinSenpai VerinSenpai added P3: Standard Priority: Default priority for repository items. T: Refactor Type: Refactor of notable amount of codebase D3: Low Difficulty: Some codebase knowledge required. A: Admin Tooling Area: Admin tooling and moderation. and removed S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. labels Oct 9, 2025
@VerinSenpai VerinSenpai added the A: Localization Area: Support for localizing the game's content for other languages. label Oct 9, 2025

public override string Command => "showaccessreaders";

public override string Help => Loc.GetString($"cmd-{Command}-help", ("command", Command));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public override string Help => Loc.GetString($"cmd-{Command}-help", ("command", Command));

no need to override this, this is already inherited from LocalizedEntityCommands

grafik

Same for all the other cases.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was being done to dynamically pass the command name as an argument to the usage. I was a bit off put by it but maybe its worth considering? Would help for example if the command name is changed to something russian in a fork.

Copy link
Member

@slarticodefast slarticodefast Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then do that in the parent instead of overriding it manually in every single command.

_overlay.AddOverlay(new AccessOverlay(EntityManager, _cache, _xform));

shell.WriteLine(Loc.GetString($"cmd-showaccessreaders-status", ("status", !existing)));
shell.WriteLine(Loc.GetString($"cmd-{Command}-status", ("status", !existing)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid doing this, in case we rename the command in the future it would break all ftl string names and we would have to rename all of them.

@PJBot PJBot added S: Awaiting Changes Status: Changes are required before another review can happen and removed S: Needs Review Status: Requires additional reviews before being fully accepted. Not to be replaced by S: Approved. labels Oct 9, 2025
@VerinSenpai VerinSenpai added the S: Needs Engine PR Merged Status: Requires an existing Robust Toolbox PR to be merged first. label Oct 9, 2025
@PJBot PJBot removed the Changes: UI Changes: Might require knowledge of UI design or code. label Oct 9, 2025
@github-actions github-actions bot added the S: Merge Conflict Status: Needs to resolve merge conflicts before it can be accepted label Oct 12, 2025
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the S: Merge Conflict Status: Needs to resolve merge conflicts before it can be accepted label Oct 13, 2025
@VerinSenpai VerinSenpai added S: Needs Engine Update Status: Requires a newer version of the Robust Toolbox engine. and removed S: Needs Engine PR Merged Status: Requires an existing Robust Toolbox PR to be merged first. labels Oct 13, 2025
@VerinSenpai
Copy link
Contributor

VerinSenpai commented Oct 13, 2025

@slarticodefast @Pok27 Engine change was merged. I assume there needs to be an engine update for this now yes?

{
if (args.Length != 2)
{
shell.WriteError(Loc.GetString(Loc.GetString("cmd-addaction-invalid-args")));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this happened twice. Not a lot, just weird its happened twice.

@Pok27
Copy link
Contributor Author

Pok27 commented Oct 13, 2025

@slarticodefast @Pok27 Engine change was merged. I assume there needs to be an engine update for this now yes?

Yeah

Copy link
Contributor

@VerinSenpai VerinSenpai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This nearly killed me. I'm still dizzy.

Overall I think its pretty good.
I've suggested some cleanup that should be done as part of converting comands to LocalizedEntityCommands. Namely removing the IEntityManager dependency and replace any usages of it with EntityManager (as its inherited from the parent class).

I've also gone ahead and suggested that you use generics from shell.ftl where possible. I intentionally didn't make this suggestion if the command was already using its own localized variant.

I believe I also made a few comments drawing attention to some strings that can have generics made for them as they're used a few times throughout, but that can be saved for a later date.

Cheers to command localizing 🥂

if (args.Length < 4)
{
shell.WriteLine($"Not enough arguments.\n{Help}");
shell.WriteLine(Loc.GetString("cmd-addreagent-not-enough-args"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer the generic shell loc string be used here, but given that this PR is already big enough, that can probably be saved for a future cleanup.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally some of these can be converted to LEC but that can also be saved.

if (shell.Player?.AttachedEntity is not { } entity)
{
shell.WriteError("This command can only be ran by a player with an attached entity.");
shell.WriteError(Loc.GetString("cmd-adminlogbulk-player-only"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this one to shell-must-be-attached-to-entity

if (args.Length < 3)
{
shell.WriteLine(Loc.GetString("osay-command-error-args"));
shell.WriteLine(Loc.GetString("cmd-osay-error-args"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can use the generic shell-wrong-arguments-number-needs-specific or shell-wrong-arguments-number

shell.WriteLine(Loc.GetString(toggle.Value
? "panicbunker-command-disable-with-admins-enabled"
: "panicbunker-command-disable-with-admins-disabled"
? "cmd-panicbunker_disable_with_admins-enabled"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a reason to change these line titles like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Command key renamed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right right, but why the underscore? convention would use hyphen.

cmd-panicbunker-disable-with-admins-enabled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structure cmd-(commandName)-(text) seems to be more important

if (args.Length != 1 && args.Length != 2)
{
shell.WriteLine($"Invalid amount of args. {Help}");
shell.WriteLine(Loc.GetString("cmd-rolebanlist-invalid-args", ("help", Help)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be converted to a generic too, but that can be saved for later.

public sealed class StatValuesCommand : LocalizedEntityCommands
{
[Dependency] private readonly EuiManager _eui = default!;
[Dependency] private readonly IEntityManager _entManager = default!;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chuu Chuu

Same here. Make sure to replace _entManager with EntityManager below too.

public sealed class InvokeVerbCommand : IConsoleCommand
public sealed class InvokeVerbCommand : LocalizedEntityCommands
{
[Dependency] private readonly IEntityManager _entManager = default!;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this dependency. Replace _entManager with EntityManager below.

public sealed class ListVerbsCommand : IConsoleCommand
public sealed class ListVerbsCommand : LocalizedEntityCommands
{
[Dependency] private readonly IEntityManager _entManager = default!;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this dependency. Replace _entManager with EntityManager below.

public sealed class ListVerbsCommand : IConsoleCommand
public sealed class ListVerbsCommand : LocalizedEntityCommands
{
[Dependency] private readonly IEntityManager _entManager = default!;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this dependency. Replace _entManager with EntityManager below.


if (!await _dbManager.GetWhitelistStatusAsync(session.UserId))
_netManager.DisconnectChannel(session.Channel, Loc.GetString("whitelist-not-whitelisted"));
_netManager.DisconnectChannel(session.Channel, Loc.GetString("whitelist-not-whitelisted")); // TODO: No localization key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest going ahead and resolving this as appose to adding a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to figure out what this is, where to create the key, and what to write there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Righty O

@Pok27
Copy link
Contributor Author

Pok27 commented Oct 13, 2025

CEOtheIsaac_-_1779269571381219682

@Pok27
Copy link
Contributor Author

Pok27 commented Oct 13, 2025

Thanks for the review!

@Pok27 Pok27 requested a review from VerinSenpai October 14, 2025 09:19
Copy link
Contributor

@VerinSenpai VerinSenpai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're bringing tears of joy to my eyes. This looks great. I forgot to clarify that entity systems can just be brought in as dependencies for LEC commands but other than that the code looks good.

Also really appreciate the cleanup, especially to the dozens of $ strings I dotted around because I didn't realize those were just C# format strings 😅

A maintainer still needs to give it the ole slice and dice but I reckon you're pretty much there.

var mapsSystem = _entManager.System<SharedMapSystem>();
var tileSystem = _entManager.System<TileSystem>();
var turfSystem = _entManager.System<TurfSystem>();
var mapsSystem = EntityManager.System<SharedMapSystem>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:despair:

I should've clarified in my initial review, I'm sorry ;(

These can be made dependencies in LEC commands.

}

var atmos = _entities.EntitySysManager.GetEntitySystem<AtmosphereSystem>();
var atmos = EntityManager.EntitySysManager.GetEntitySystem<AtmosphereSystem>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. This is just an even more convoluted way to get the AtmosphereSystem dependency.

}

var biomeSystem = _entManager.System<BiomeSystem>();
var biomeSystem = EntityManager.System<BiomeSystem>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency goblin strikes again 😈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A: Admin Tooling Area: Admin tooling and moderation. A: Localization Area: Support for localizing the game's content for other languages. D3: Low Difficulty: Some codebase knowledge required. P3: Standard Priority: Default priority for repository items. S: Awaiting Changes Status: Changes are required before another review can happen S: Needs Engine Update Status: Requires a newer version of the Robust Toolbox engine. size/L Denotes a PR that changes 1000-4999 lines. T: Refactor Type: Refactor of notable amount of codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants