forked from space-syndicate/space-station-14
@@ -52,14 +52,18 @@ namespace Content.Client.Atmos.UI
|
||||
|
||||
private void OnSelectGasPressed()
|
||||
{
|
||||
if (_window is null) return;
|
||||
if (_window is null)
|
||||
return;
|
||||
|
||||
if (_window.SelectedGas is null)
|
||||
{
|
||||
SendMessage(new GasFilterSelectGasMessage(null));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!int.TryParse(_window.SelectedGas, out var gas)) return;
|
||||
if (!Enum.TryParse<Gas>(_window.SelectedGas, out var gas))
|
||||
return;
|
||||
|
||||
SendMessage(new GasFilterSelectGasMessage(gas));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,18 +156,18 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
|
||||
private void OnSelectGasMessage(EntityUid uid, GasFilterComponent filter, GasFilterSelectGasMessage args)
|
||||
{
|
||||
if (args.ID.HasValue)
|
||||
if (args.Gas.HasValue)
|
||||
{
|
||||
if (Enum.TryParse<Gas>(args.ID.ToString(), true, out var parsedGas))
|
||||
if (Enum.IsDefined(typeof(Gas), args.Gas))
|
||||
{
|
||||
filter.FilteredGas = parsedGas;
|
||||
filter.FilteredGas = args.Gas;
|
||||
_adminLogger.Add(LogType.AtmosFilterChanged, LogImpact.Medium,
|
||||
$"{ToPrettyString(args.Actor):player} set the filter on {ToPrettyString(uid):device} to {parsedGas.ToString()}");
|
||||
$"{ToPrettyString(args.Actor):player} set the filter on {ToPrettyString(uid):device} to {args.Gas.ToString()}");
|
||||
DirtyUI(uid, filter);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Warning($"{ToPrettyString(uid)} received GasFilterSelectGasMessage with an invalid ID: {args.ID}");
|
||||
Log.Warning($"{ToPrettyString(uid)} received GasFilterSelectGasMessage with an invalid ID: {args.Gas}");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Robust.Shared.Serialization;
|
||||
using Content.Shared.Atmos.Prototypes;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Atmos.Piping.Trinary.Components
|
||||
{
|
||||
@@ -48,13 +50,8 @@ namespace Content.Shared.Atmos.Piping.Trinary.Components
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class GasFilterSelectGasMessage : BoundUserInterfaceMessage
|
||||
public sealed class GasFilterSelectGasMessage(Gas? gas) : BoundUserInterfaceMessage
|
||||
{
|
||||
public int? ID { get; }
|
||||
|
||||
public GasFilterSelectGasMessage(int? id)
|
||||
{
|
||||
ID = id;
|
||||
}
|
||||
public readonly Gas? Gas = gas;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user