Hide mechanism and show mechanism commands to LEC (#38587)

commit
This commit is contained in:
Kyle Tyo
2025-06-26 09:00:44 -04:00
committed by GitHub
parent bebc077fcc
commit 4af6c8461f
4 changed files with 15 additions and 25 deletions

View File

@@ -5,32 +5,27 @@ using Robust.Shared.Containers;
namespace Content.Client.Commands;
public sealed class HideMechanismsCommand : LocalizedCommands
public sealed class HideMechanismsCommand : LocalizedEntityCommands
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SpriteSystem _spriteSystem = default!;
public override string Command => "hidemechanisms";
public override string Description => LocalizationManager.GetString($"cmd-{Command}-desc", ("showMechanismsCommand", ShowMechanismsCommand.CommandName));
public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command));
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
var containerSys = _entityManager.System<SharedContainerSystem>();
var spriteSys = _entityManager.System<SpriteSystem>();
var query = _entityManager.AllEntityQueryEnumerator<OrganComponent, SpriteComponent>();
var query = EntityManager.AllEntityQueryEnumerator<OrganComponent, SpriteComponent>();
while (query.MoveNext(out var uid, out _, out var sprite))
{
spriteSys.SetContainerOccluded((uid, sprite), false);
_spriteSystem.SetContainerOccluded((uid, sprite), false);
var tempParent = uid;
while (containerSys.TryGetContainingContainer((tempParent, null, null), out var container))
while (_containerSystem.TryGetContainingContainer((tempParent, null, null), out var container))
{
if (!container.ShowContents)
{
spriteSys.SetContainerOccluded((uid, sprite), true);
_spriteSystem.SetContainerOccluded((uid, sprite), true);
break;
}

View File

@@ -4,24 +4,19 @@ using Robust.Shared.Console;
namespace Content.Client.Commands;
public sealed class ShowMechanismsCommand : LocalizedCommands
public sealed class ShowMechanismsCommand : LocalizedEntityCommands
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly SpriteSystem _spriteSystem = default!;
public const string CommandName = "showmechanisms";
public override string Command => CommandName;
public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command));
public override string Command => "showmechanisms";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
var spriteSys = _entManager.System<SpriteSystem>();
var query = _entManager.AllEntityQueryEnumerator<OrganComponent, SpriteComponent>();
var query = EntityManager.AllEntityQueryEnumerator<OrganComponent, SpriteComponent>();
while (query.MoveNext(out var uid, out _, out var sprite))
{
spriteSys.SetContainerOccluded((uid, sprite), false);
_spriteSystem.SetContainerOccluded((uid, sprite), false);
}
}
}

View File

@@ -1,2 +1,2 @@
cmd-hidemechanisms-desc = Reverts the effects of {$showMechanismsCommand}
cmd-hidemechanisms-help = Usage: {$command}
cmd-hidemechanisms-desc = Reverts the effects of showmechanisms command.
cmd-hidemechanisms-help = Usage: hidemechanisms

View File

@@ -1,2 +1,2 @@
cmd-showmechanisms-desc = Makes mechanisms visible, even when they shouldn't be.
cmd-showmechanisms-help = Usage: {$command}
cmd-showmechanisms-help = Usage: showmechanisms