ActivatableUI tweaks (#27448)
* ActivatableUI tweaks * EntGotRemovedFromContainerMessage * A
This commit is contained in:
@@ -20,12 +20,19 @@ public sealed partial class ActivatableUISystem
|
||||
{
|
||||
_cell.SetPowerCellDrawEnabled(uid, false);
|
||||
|
||||
if (HasComp<ActivatableUIRequiresPowerCellComponent>(uid) &&
|
||||
TryComp<ActivatableUIComponent>(uid, out var activatable) &&
|
||||
activatable.Key != null)
|
||||
if (!HasComp<ActivatableUIRequiresPowerCellComponent>(uid) ||
|
||||
!TryComp(uid, out ActivatableUIComponent? activatable))
|
||||
{
|
||||
_uiSystem.CloseUi(uid, activatable.Key);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activatable.Key == null)
|
||||
{
|
||||
Log.Error($"Encountered null key in activatable ui on entity {ToPrettyString(uid)}");
|
||||
return;
|
||||
}
|
||||
|
||||
_uiSystem.CloseUi(uid, activatable.Key);
|
||||
}
|
||||
|
||||
private void OnBatteryOpened(EntityUid uid, ActivatableUIRequiresPowerCellComponent component, BoundUIOpenedEvent args)
|
||||
@@ -55,9 +62,15 @@ public sealed partial class ActivatableUISystem
|
||||
/// </summary>
|
||||
public void CheckUsage(EntityUid uid, ActivatableUIComponent? active = null, ActivatableUIRequiresPowerCellComponent? component = null, PowerCellDrawComponent? draw = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, ref draw, ref active, false) || active.Key == null)
|
||||
if (!Resolve(uid, ref component, ref draw, ref active, false))
|
||||
return;
|
||||
|
||||
if (active.Key == null)
|
||||
{
|
||||
Log.Error($"Encountered null key in activatable ui on entity {ToPrettyString(uid)}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_cell.HasActivatableCharge(uid))
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user