Borg tweaks (#19046)

* borg tweaks

* wahoo
This commit is contained in:
Nemanja
2023-08-13 03:09:30 -04:00
committed by GitHub
parent 6edd731833
commit 812cceae9d
9 changed files with 110 additions and 10 deletions

View File

@@ -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)