2022-06-11 18:54:41 -07:00
|
|
|
using System.Collections.Generic;
|
2021-02-17 09:39:31 -03:00
|
|
|
using System.Linq;
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using Robust.Client.AutoGenerated;
|
|
|
|
|
using Robust.Client.Console;
|
|
|
|
|
using Robust.Client.Player;
|
|
|
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
|
using Robust.Client.UserInterface.CustomControls;
|
2021-12-03 14:20:34 +01:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-02-17 09:39:31 -03:00
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
using Robust.Shared.Map;
|
2022-11-22 13:12:04 +11:00
|
|
|
using Robust.Shared.Map.Components;
|
2021-02-17 09:39:31 -03:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
2021-02-17 09:39:31 -03:00
|
|
|
{
|
|
|
|
|
[GenerateTypedNameReferences]
|
|
|
|
|
[UsedImplicitly]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed partial class AddAtmosWindow : DefaultWindow
|
2021-02-17 09:39:31 -03:00
|
|
|
{
|
2022-11-22 13:12:04 +11:00
|
|
|
private IEnumerable<MapGridComponent>? _data;
|
2021-02-17 09:39:31 -03:00
|
|
|
|
|
|
|
|
protected override void EnteredTree()
|
|
|
|
|
{
|
2022-12-12 14:59:02 +11:00
|
|
|
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Owner != 0);
|
2021-02-17 09:39:31 -03:00
|
|
|
foreach (var grid in _data)
|
|
|
|
|
{
|
2021-12-06 14:00:39 +01:00
|
|
|
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
2022-06-20 12:14:35 +12:00
|
|
|
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
2022-12-12 14:59:02 +11:00
|
|
|
GridOptions.AddItem($"{grid.Owner} {(playerGrid == grid.Owner ? " (Current)" : "")}");
|
2021-02-17 09:39:31 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
|
|
|
|
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
|
|
|
|
{
|
|
|
|
|
if (_data == null)
|
|
|
|
|
return;
|
|
|
|
|
var dataList = _data.ToList();
|
2022-12-12 14:59:02 +11:00
|
|
|
var selectedGrid = dataList[GridOptions.SelectedId].Owner;
|
2021-02-17 09:39:31 -03:00
|
|
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {selectedGrid}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|