Skip to content

Conversation

@VerinSenpai
Copy link
Contributor

@VerinSenpai VerinSenpai commented Jun 29, 2025

About the PR

Also unified the structure of both commands. Do suggest any improvements that can be made.

Technical details

Converts the suicide and ghost commands to LocalizedEntityCommands and performed cleanup that comes with that. The commands were already localized but this does make a few minor changes such as switching the suicide command to using its own denied message.
Also unifies the code between the two commands. I'm sure this can be deduplicated better with methods in the future so I'll keep that in mind.

Requirements

@github-actions github-actions bot added S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. size/M Denotes a PR that changes 100-999 lines. S: Needs Review Status: Requires additional reviews before being fully accepted. Not to be replaced by S: Approved. labels Jun 29, 2025
@BramvanZijp
Copy link
Contributor

@VerinSenpai I am not a maintainer, but as a Triager, I am going to suggest that you follow the format that you get when making the PR.

This current PR does not include the info that both triagers and maintainers need to properly review the PR. Such as a CL, technical details, etc. This means I cannot add the triage labels, and a maintainer may outright choose to close it (or they may not, up to them.)

@VerinSenpai
Copy link
Contributor Author

I added some technical details for it since this one does a bit more than just an LEC conversion. This change doesn't require a cl entry so I've omitted that as well as the media categories so the PR looks cleaner. I've been a bit lax lately as most of these PRs are just the same shit different day type deals. I'll bear that in mind though for the future.

@VerinSenpai VerinSenpai added P3: Standard Priority: Default priority for repository items. T: Cleanup Type: Code clean-up, without being a full refactor or feature D3: Low Difficulty: Some codebase knowledge required. A: Admin Tooling Area: Admin tooling and moderation. A: Localization Area: Support for localizing the game's content for other languages. and removed S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. A: Admin Tooling Area: Admin tooling and moderation. A: Localization Area: Support for localizing the game's content for other languages. labels Aug 5, 2025
Copy link
Member

@Princess-Cheeseballs Princess-Cheeseballs left a comment

Choose a reason for hiding this comment

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

Small (Large) requested change.

Comment on lines +28 to +49
if (!_gameTicker.PlayerGameStatuses.TryGetValue(player.UserId, out var playerStatus) ||
playerStatus is not PlayerGameStatus.JoinedGame)
{
shell.WriteLine(Loc.GetString("suicide-command-error-lobby"));
return;
}

public void Execute(IConsoleShell shell, string argStr, string[] args)
if (player.AttachedEntity is { Valid: true } frozen &&
EntityManager.HasComponent<AdminFrozenComponent>(frozen))
{
if (shell.Player is not { } player)
{
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

if (player.Status != SessionStatus.InGame || player.AttachedEntity == null)
return;

var minds = _e.System<SharedMindSystem>();

// This check also proves mind not-null for at the end when the mob is ghosted.
if (!minds.TryGetMind(player, out var mindId, out var mindComp) ||
mindComp.OwnedEntity is not { Valid: true } victim)
{
shell.WriteLine(Loc.GetString("suicide-command-no-mind"));
return;
}

var suicideSystem = _e.System<SuicideSystem>();

if (_e.HasComponent<AdminFrozenComponent>(victim))
{
var deniedMessage = Loc.GetString("suicide-command-denied");
shell.WriteLine(deniedMessage);
_e.System<PopupSystem>()
.PopupEntity(deniedMessage, victim, victim);
return;
}

if (suicideSystem.Suicide(victim))
return;

shell.WriteLine(Loc.GetString("ghost-command-denied"));
var deniedMessage = Loc.GetString("suicide-command-denied");
shell.WriteLine(deniedMessage);
_popupSystem.PopupEntity(deniedMessage, frozen, frozen);
return;
}

if (!_mindSystem.TryGetMind(player, out _, out var mindComp) ||
mindComp.OwnedEntity is not { Valid: true } victim)
{
shell.WriteLine(Loc.GetString("suicide-command-no-mind"));
return;
}

Choose a reason for hiding this comment

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

This should be deboilerplated and moved to a helper system.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You got it.

@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 4, 2025
@VerinSenpai
Copy link
Contributor Author

Ive opted to close this for now. Im instead going to let Pok take over localizing this and begin work on the mentioned command helpers.

@VerinSenpai VerinSenpai deleted the suicide-ghost-commands branch October 11, 2025 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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 size/M Denotes a PR that changes 100-999 lines. T: Cleanup Type: Code clean-up, without being a full refactor or feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants