2021-06-09 22:19:39 +02:00
|
|
|
|
using Content.Shared.Body.Mechanism;
|
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
|
|
|
|
|
|
{
|
|
|
|
|
|
public class HideMechanismsCommand : IConsoleCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
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>();
|
|
|
|
|
|
var mechanisms = entityManager.EntityQuery<SharedMechanismComponent>(true);
|
2020-10-26 12:11:32 +01:00
|
|
|
|
|
|
|
|
|
|
foreach (var mechanism in mechanisms)
|
|
|
|
|
|
{
|
2021-03-10 14:48:29 +01:00
|
|
|
|
if (!mechanism.Owner.TryGetComponent(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
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|