Fix instant power cell drainage (#15927)

This commit is contained in:
Nemanja
2023-04-30 02:06:44 -04:00
committed by GitHub
parent ff0efb89e3
commit bccad7d430
4 changed files with 17 additions and 18 deletions

View File

@@ -19,10 +19,7 @@ public sealed partial class ActivatableUISystem
private void OnPowerCellRemoved(EntityUid uid, PowerCellDrawComponent component, EntRemovedFromContainerMessage args)
{
if (TryComp<PowerCellDrawComponent>(uid, out var draw))
{
draw.Enabled = false;
}
_cell.SetPowerCellDrawEnabled(uid, false);
if (HasComp<ActivatableUIRequiresPowerCellComponent>(uid) &&
TryComp<ActivatableUIComponent>(uid, out var activatable) &&
@@ -34,18 +31,12 @@ public sealed partial class ActivatableUISystem
private void OnBatteryOpened(EntityUid uid, ActivatableUIRequiresPowerCellComponent component, BoundUIOpenedEvent args)
{
if (!TryComp<PowerCellDrawComponent>(uid, out var draw))
return;
draw.Enabled = true;
_cell.SetPowerCellDrawEnabled(uid, true);
}
private void OnBatteryClosed(EntityUid uid, ActivatableUIRequiresPowerCellComponent component, BoundUIClosedEvent args)
{
if (!TryComp<PowerCellDrawComponent>(uid, out var draw))
return;
draw.Enabled = false;
_cell.SetPowerCellDrawEnabled(uid, false);
}
/// <summary>