2022-10-23 00:46:28 +02:00
|
|
|
|
using Content.Shared.Body.Organ;
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
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-10-23 00:46:28 +02:00
|
|
|
|
var organs = entityManager.EntityQuery<OrganComponent>(true);
|
2020-10-26 12:11:32 +01:00
|
|
|
|
|
2022-10-23 00:46:28 +02:00
|
|
|
|
foreach (var part in organs)
|
2020-10-26 12:11:32 +01:00
|
|
|
|
{
|
2022-10-23 00:46:28 +02:00
|
|
|
|
if (!entityManager.TryGetComponent(part.Owner, out SpriteComponent? sprite))
|
2020-10-26 12:11:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sprite.ContainerOccluded = false;
|
|
|
|
|
|
|
2022-10-23 00:46:28 +02:00
|
|
|
|
var tempParent = part.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
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|