Allow gas filters to not filter gases. (#12051)
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using Content.Client.Atmos.EntitySystems;
|
||||
using Content.Client.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Atmos.Piping.Trinary.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Atmos.UI
|
||||
{
|
||||
@@ -58,9 +56,16 @@ namespace Content.Client.Atmos.UI
|
||||
|
||||
private void OnSelectGasPressed()
|
||||
{
|
||||
if (_window is null || _window.SelectedGas is null) return;
|
||||
if (!int.TryParse(_window.SelectedGas, out var gas)) return;
|
||||
SendMessage(new GasFilterSelectGasMessage(gas));
|
||||
if (_window is null) return;
|
||||
if (_window.SelectedGas is null)
|
||||
{
|
||||
SendMessage(new GasFilterSelectGasMessage(null));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!int.TryParse(_window.SelectedGas, out var gas)) return;
|
||||
SendMessage(new GasFilterSelectGasMessage(gas));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -84,7 +89,7 @@ namespace Content.Client.Atmos.UI
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.SetGasFiltered(null, "None");
|
||||
_window.SetGasFiltered(null, Loc.GetString("comp-gas-filter-ui-filter-gas-none"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,12 @@ namespace Content.Client.Atmos.UI
|
||||
|
||||
private void PopulateGasList(IEnumerable<GasPrototype> gases)
|
||||
{
|
||||
GasList.Add(new ItemList.Item(GasList)
|
||||
{
|
||||
Metadata = null,
|
||||
Text = Loc.GetString("comp-gas-filter-ui-filter-gas-none")
|
||||
});
|
||||
|
||||
foreach (GasPrototype gas in gases)
|
||||
{
|
||||
GasList.Add(GetGasItem(gas.ID, gas.Name, GasList));
|
||||
|
||||
Reference in New Issue
Block a user