@@ -5,32 +5,27 @@ using Robust.Shared.Containers;
|
|||||||
|
|
||||||
namespace Content.Client.Commands;
|
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 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)
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
var containerSys = _entityManager.System<SharedContainerSystem>();
|
var query = EntityManager.AllEntityQueryEnumerator<OrganComponent, SpriteComponent>();
|
||||||
var spriteSys = _entityManager.System<SpriteSystem>();
|
|
||||||
var query = _entityManager.AllEntityQueryEnumerator<OrganComponent, SpriteComponent>();
|
|
||||||
|
|
||||||
while (query.MoveNext(out var uid, out _, out var sprite))
|
while (query.MoveNext(out var uid, out _, out var sprite))
|
||||||
{
|
{
|
||||||
spriteSys.SetContainerOccluded((uid, sprite), false);
|
_spriteSystem.SetContainerOccluded((uid, sprite), false);
|
||||||
|
|
||||||
var tempParent = uid;
|
var tempParent = uid;
|
||||||
while (containerSys.TryGetContainingContainer((tempParent, null, null), out var container))
|
while (_containerSystem.TryGetContainingContainer((tempParent, null, null), out var container))
|
||||||
{
|
{
|
||||||
if (!container.ShowContents)
|
if (!container.ShowContents)
|
||||||
{
|
{
|
||||||
spriteSys.SetContainerOccluded((uid, sprite), true);
|
_spriteSystem.SetContainerOccluded((uid, sprite), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,24 +4,19 @@ using Robust.Shared.Console;
|
|||||||
|
|
||||||
namespace Content.Client.Commands;
|
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 => "showmechanisms";
|
||||||
|
|
||||||
public override string Command => CommandName;
|
|
||||||
|
|
||||||
public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command));
|
|
||||||
|
|
||||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
var spriteSys = _entManager.System<SpriteSystem>();
|
var query = EntityManager.AllEntityQueryEnumerator<OrganComponent, SpriteComponent>();
|
||||||
var query = _entManager.AllEntityQueryEnumerator<OrganComponent, SpriteComponent>();
|
|
||||||
|
|
||||||
while (query.MoveNext(out var uid, out _, out var sprite))
|
while (query.MoveNext(out var uid, out _, out var sprite))
|
||||||
{
|
{
|
||||||
spriteSys.SetContainerOccluded((uid, sprite), false);
|
_spriteSystem.SetContainerOccluded((uid, sprite), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
cmd-hidemechanisms-desc = Reverts the effects of {$showMechanismsCommand}
|
cmd-hidemechanisms-desc = Reverts the effects of showmechanisms command.
|
||||||
cmd-hidemechanisms-help = Usage: {$command}
|
cmd-hidemechanisms-help = Usage: hidemechanisms
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
cmd-showmechanisms-desc = Makes mechanisms visible, even when they shouldn't be.
|
cmd-showmechanisms-desc = Makes mechanisms visible, even when they shouldn't be.
|
||||||
cmd-showmechanisms-help = Usage: {$command}
|
cmd-showmechanisms-help = Usage: showmechanisms
|
||||||
|
|||||||
Reference in New Issue
Block a user