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

@@ -49,6 +49,12 @@ namespace Content.Server.UserInterface
[DataField("allowSpectator")]
public bool AllowSpectator = true;
/// <summary>
/// Whether the UI should close when the item is deselected due to a hand swap or drop
/// </summary>
[DataField("closeOnHandDeselect")]
public bool CloseOnHandDeselect = true;
/// <summary>
/// The client channel currently using the object, or null if there's none/not single user.
/// NOTE: DO NOT DIRECTLY SET, USE ActivatableUISystem.SetCurrentSingleUser

View File

@@ -25,7 +25,7 @@ namespace Content.Server.UserInterface
SubscribeLocalEvent<ActivatableUIComponent, ActivateInWorldEvent>(OnActivate);
SubscribeLocalEvent<ActivatableUIComponent, UseInHandEvent>(OnUseInHand);
SubscribeLocalEvent<ActivatableUIComponent, HandDeselectedEvent>((uid, aui, _) => CloseAll(uid, aui));
SubscribeLocalEvent<ActivatableUIComponent, HandDeselectedEvent>(OnHandDeselected);
SubscribeLocalEvent<ActivatableUIComponent, GotUnequippedHandEvent>((uid, aui, _) => CloseAll(uid, aui));
// *THIS IS A BLATANT WORKAROUND!* RATIONALE: Microwaves need it
SubscribeLocalEvent<ActivatableUIComponent, EntParentChangedMessage>(OnParentChanged);
@@ -169,6 +169,14 @@ namespace Content.Server.UserInterface
if (!Resolve(uid, ref aui, false)) return;
aui.UserInterface?.CloseAll();
}
private void OnHandDeselected(EntityUid uid, ActivatableUIComponent? aui, HandDeselectedEvent args)
{
if (!Resolve(uid, ref aui, false)) return;
if (!aui.CloseOnHandDeselect)
return;
CloseAll(uid, aui);
}
}
public sealed class ActivatableUIOpenAttemptEvent : CancellableEntityEventArgs