@@ -57,6 +57,7 @@ public sealed class WiresSystem : SharedWiresSystem
|
||||
SubscribeLocalEvent<WiresComponent, PowerChangedEvent>(OnWiresPowered);
|
||||
SubscribeLocalEvent<WiresComponent, WireDoAfterEvent>(OnDoAfter);
|
||||
SubscribeLocalEvent<ActivatableUIRequiresPanelComponent, ActivatableUIOpenAttemptEvent>(OnAttemptOpenActivatableUI);
|
||||
SubscribeLocalEvent<ActivatableUIRequiresPanelComponent, PanelChangedEvent>(OnActivatableUIPanelChanged);
|
||||
}
|
||||
|
||||
private void SetOrCreateWireLayout(EntityUid uid, WiresComponent? wires = null)
|
||||
@@ -505,6 +506,17 @@ public sealed class WiresSystem : SharedWiresSystem
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnActivatableUIPanelChanged(EntityUid uid, ActivatableUIRequiresPanelComponent component, ref PanelChangedEvent args)
|
||||
{
|
||||
if (args.Open == component.RequireOpen)
|
||||
return;
|
||||
|
||||
if (!TryComp<ActivatableUIComponent>(uid, out var ui) || ui.Key == null)
|
||||
return;
|
||||
|
||||
_uiSystem.TryCloseAll(uid, ui.Key);
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, WiresComponent component, MapInitEvent args)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(component.LayoutId))
|
||||
@@ -641,6 +653,9 @@ public sealed class WiresSystem : SharedWiresSystem
|
||||
component.Open = open;
|
||||
UpdateAppearance(uid, component);
|
||||
Dirty(component);
|
||||
|
||||
var ev = new PanelChangedEvent(component.Open);
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
}
|
||||
|
||||
public void SetWiresPanelSecurityData(EntityUid uid, WiresPanelComponent component, string wiresPanelSecurityLevelID)
|
||||
|
||||
Reference in New Issue
Block a user