Client commands: clean up and localize (#22897)
* action commands * atmos debug commands * comming * credits command * debug commands * usage * usings * debug pathfinding command * grouping entity menu command * hide mechanisms command * commit * mapping client side setup command * open ahelp command * set menu visibility command * commit * show mechanisms command * toggle health overlay command * toggle outline command * stage * disable once * ioc * namespaces * WriteError * clean up command usage * don't abbriviate * ActionsCommands * AtmosDebugCommands * the rest * oops * undo
This commit is contained in:
@@ -1,46 +1,45 @@
|
||||
using Content.Shared.Body.Organ;
|
||||
using Robust.Client.Console;
|
||||
using Content.Shared.Body.Organ;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Client.Commands
|
||||
namespace Content.Client.Commands;
|
||||
|
||||
public sealed class HideMechanismsCommand : LocalizedCommands
|
||||
{
|
||||
public sealed class HideMechanismsCommand : IConsoleCommand
|
||||
[Dependency] private readonly IEntityManager _entityManager = 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)
|
||||
{
|
||||
public string Command => "hidemechanisms";
|
||||
public string Description => $"Reverts the effects of {ShowMechanismsCommand.CommandName}";
|
||||
public string Help => $"{Command}";
|
||||
var containerSys = _entityManager.System<SharedContainerSystem>();
|
||||
var query = _entityManager.AllEntityQueryEnumerator<OrganComponent>();
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
while (query.MoveNext(out var uid, out _))
|
||||
{
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var containerSys = entityManager.System<SharedContainerSystem>();
|
||||
var query = entityManager.AllEntityQueryEnumerator<OrganComponent>();
|
||||
|
||||
while (query.MoveNext(out var uid, out _))
|
||||
if (!_entityManager.TryGetComponent(uid, out SpriteComponent? sprite))
|
||||
{
|
||||
if (!entityManager.TryGetComponent(uid, out SpriteComponent? sprite))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sprite.ContainerOccluded = false;
|
||||
|
||||
var tempParent = uid;
|
||||
while (containerSys.TryGetContainingContainer(tempParent, out var container))
|
||||
{
|
||||
if (!container.ShowContents)
|
||||
{
|
||||
sprite.ContainerOccluded = true;
|
||||
break;
|
||||
}
|
||||
|
||||
tempParent = container.Owner;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand("hidecontainedcontext");
|
||||
sprite.ContainerOccluded = false;
|
||||
|
||||
var tempParent = uid;
|
||||
while (containerSys.TryGetContainingContainer(tempParent, out var container))
|
||||
{
|
||||
if (!container.ShowContents)
|
||||
{
|
||||
sprite.ContainerOccluded = true;
|
||||
break;
|
||||
}
|
||||
|
||||
tempParent = container.Owner;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user