Gas Analyzer can now scan pipes/devices along with the environment (#10976)

This commit is contained in:
theashtronaut
2022-09-08 14:22:14 +00:00
committed by GitHub
parent ae8fe43529
commit 868abaca5c
23 changed files with 826 additions and 758 deletions

View File

@@ -1,5 +1,4 @@
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using static Content.Shared.Atmos.Components.SharedGasAnalyzerComponent;
namespace Content.Client.Atmos.UI
@@ -10,34 +9,41 @@ namespace Content.Client.Atmos.UI
{
}
private GasAnalyzerWindow? _menu;
private GasAnalyzerWindow? _window;
protected override void Open()
{
base.Open();
_menu = new GasAnalyzerWindow(this);
_menu.OnClose += Close;
_menu.OpenCentered();
_window = new GasAnalyzerWindow(this);
_window.OnClose += OnClose;
_window.OpenCentered();
}
protected override void UpdateState(BoundUserInterfaceState state)
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
{
base.UpdateState(state);
_menu?.Populate((GasAnalyzerBoundUserInterfaceState) state);
if (_window == null)
return;
if (message is not GasAnalyzerUserMessage cast)
return;
_window.Populate(cast);
}
public void Refresh()
/// <summary>
/// Closes UI and tells the server to disable the analyzer
/// </summary>
private void OnClose()
{
SendMessage(new GasAnalyzerRefreshMessage());
SendMessage(new GasAnalyzerDisableMessage());
Close();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing) _menu?.Dispose();
if (disposing)
_window?.Dispose();
}
}
}