mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
57 lines
1.9 KiB
C#
57 lines
1.9 KiB
C#
using Content.Server.Administration.Systems;
|
|
using Content.Server.EUI;
|
|
using Content.Shared.Administration;
|
|
using Content.Shared.Chemistry.Components.SolutionManager;
|
|
using Content.Shared.Eui;
|
|
using Content.Shared.Chemistry.EntitySystems;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Server.Administration.UI
|
|
{
|
|
/// <summary>
|
|
/// Admin Eui for displaying and editing the reagents in a solution.
|
|
/// </summary>
|
|
[UsedImplicitly]
|
|
public sealed partial class EditSolutionsEui : BaseEui
|
|
{
|
|
[Dependency] private IEntityManager _entityManager = default!;
|
|
[Dependency] private IGameTiming _gameTiming = default!;
|
|
private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
|
|
public readonly EntityUid Target;
|
|
|
|
public EditSolutionsEui(EntityUid entity)
|
|
{
|
|
IoCManager.InjectDependencies(this);
|
|
_solutionContainerSystem = _entityManager.System<SharedSolutionContainerSystem>();
|
|
Target = entity;
|
|
}
|
|
|
|
public override void Opened()
|
|
{
|
|
base.Opened();
|
|
StateDirty();
|
|
}
|
|
|
|
public override void Closed()
|
|
{
|
|
base.Closed();
|
|
_entityManager.System<AdminVerbSystem>().OnEditSolutionsEuiClosed(Player, this);
|
|
}
|
|
|
|
public override EuiStateBase GetNewState()
|
|
{
|
|
List<(string Name, NetEntity Solution)>? netSolutions = new();
|
|
|
|
foreach (var (name, solution) in _solutionContainerSystem.EnumerateSolutions(Target))
|
|
{
|
|
if (name is null || !_entityManager.TryGetNetEntity(solution, out var netSolution))
|
|
continue;
|
|
|
|
netSolutions.Add((name, netSolution.Value));
|
|
}
|
|
|
|
return new EditSolutionsEuiState(_entityManager.GetNetEntity(Target), netSolutions, _gameTiming.CurTick);
|
|
}
|
|
}
|
|
}
|