public sealed partial class ActivatableUIComponent : Component
{
[DataField(required: true, customTypeSerializer: typeof(EnumSerializer))]
- public Enum Key { get; set; } = default!;
+ public Enum? Key { get; set; } = default!;
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
_cell.SetPowerCellDrawEnabled(uid, false);
if (HasComp<ActivatableUIRequiresPowerCellComponent>(uid) &&
- TryComp<ActivatableUIComponent>(uid, out var activatable))
+ TryComp<ActivatableUIComponent>(uid, out var activatable) &&
+ activatable.Key != null)
{
_uiSystem.CloseUi(uid, activatable.Key);
}
/// </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))
+ if (!Resolve(uid, ref component, ref draw, ref active, false) || active.Key == null)
return;
if (_cell.HasActivatableCharge(uid))
private bool InteractUI(EntityUid user, EntityUid uiEntity, ActivatableUIComponent aui)
{
- if (!_uiSystem.HasUi(uiEntity, aui.Key))
+ if (aui.Key == null || !_uiSystem.HasUi(uiEntity, aui.Key))
return false;
if (_uiSystem.IsUiOpen(uiEntity, aui.Key, user))
public void CloseAll(EntityUid uid, ActivatableUIComponent? aui = null)
{
- if (!Resolve(uid, ref aui, false))
+ if (!Resolve(uid, ref aui, false) || aui.Key == null)
return;
_uiSystem.CloseUi(uid, aui.Key);