2021-11-11 16:10:57 -07:00
|
|
|
|
using Content.Shared.Body.Components;
|
2020-10-26 12:11:32 +01:00
|
|
|
|
using Robust.Client.Console;
|
|
|
|
|
|
using Robust.Client.GameObjects;
|
2021-02-01 16:49:43 -08:00
|
|
|
|
using Robust.Shared.Console;
|
2020-10-26 12:11:32 +01:00
|
|
|
|
using Robust.Shared.Containers;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-10-26 12:11:32 +01:00
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.Commands
|
|
|
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class HideMechanismsCommand : IConsoleCommand
|
2020-10-26 12:11:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
public string Command => "hidemechanisms";
|
|
|
|
|
|
public string Description => $"Reverts the effects of {ShowMechanismsCommand.CommandName}";
|
|
|
|
|
|
public string Help => $"{Command}";
|
|
|
|
|
|
|
2021-02-01 16:49:43 -08:00
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-10-26 12:11:32 +01:00
|
|
|
|
{
|
2021-09-28 13:35:29 +02:00
|
|
|
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
2022-01-04 02:17:39 -07:00
|
|
|
|
var mechanisms = entityManager.EntityQuery<MechanismComponent>(true);
|
2020-10-26 12:11:32 +01:00
|
|
|
|
|
|
|
|
|
|
foreach (var mechanism in mechanisms)
|
|
|
|
|
|
{
|
2021-12-08 12:09:43 +01:00
|
|
|
|
if (!entityManager.TryGetComponent(mechanism.Owner, out SpriteComponent? sprite))
|
2020-10-26 12:11:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sprite.ContainerOccluded = false;
|
|
|
|
|
|
|
|
|
|
|
|
var tempParent = mechanism.Owner;
|
2020-11-13 20:25:04 +13:00
|
|
|
|
while (tempParent.TryGetContainer(out var container))
|
2020-10-26 12:11:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
if (!container.ShowContents)
|
|
|
|
|
|
{
|
|
|
|
|
|
sprite.ContainerOccluded = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tempParent = container.Owner;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-02-01 16:49:43 -08:00
|
|
|
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand("hidecontainedcontext");
|
2020-10-26 12:11:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|