use PopupClient for encryption keys (#17291)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-06-13 06:05:17 +00:00
committed by GitHub
parent c189c52d85
commit 8625cb1b4b

View File

@@ -115,29 +115,25 @@ public sealed class EncryptionKeySystem : EntitySystem
{ {
if (!component.KeysUnlocked) if (!component.KeysUnlocked)
{ {
if (_net.IsClient && _timing.IsFirstTimePredicted) _popup.PopupClient(Loc.GetString("encryption-keys-are-locked"), uid, args.User);
_popup.PopupEntity(Loc.GetString("encryption-keys-are-locked"), uid, args.User);
return; return;
} }
if (TryComp<WiresPanelComponent>(uid, out var panel) && !panel.Open) if (TryComp<WiresPanelComponent>(uid, out var panel) && !panel.Open)
{ {
if (_net.IsClient && _timing.IsFirstTimePredicted) _popup.PopupClient(Loc.GetString("encryption-keys-panel-locked"), uid, args.User);
_popup.PopupEntity(Loc.GetString("encryption-keys-panel-locked"), uid, args.User);
return; return;
} }
if (component.KeySlots <= component.KeyContainer.ContainedEntities.Count) if (component.KeySlots <= component.KeyContainer.ContainedEntities.Count)
{ {
if (_net.IsClient && _timing.IsFirstTimePredicted) _popup.PopupClient(Loc.GetString("encryption-key-slots-already-full"), uid, args.User);
_popup.PopupEntity(Loc.GetString("encryption-key-slots-already-full"), uid, args.User);
return; return;
} }
if (component.KeyContainer.Insert(args.Used)) if (component.KeyContainer.Insert(args.Used))
{ {
if (_net.IsClient&& _timing.IsFirstTimePredicted) _popup.PopupClient(Loc.GetString("encryption-key-successfully-installed"), uid, args.User);
_popup.PopupEntity(Loc.GetString("encryption-key-successfully-installed"), uid, args.User);
_audio.PlayPredicted(component.KeyInsertionSound, args.Target, args.User); _audio.PlayPredicted(component.KeyInsertionSound, args.Target, args.User);
args.Handled = true; args.Handled = true;
return; return;
@@ -149,22 +145,19 @@ public sealed class EncryptionKeySystem : EntitySystem
{ {
if (!component.KeysUnlocked) if (!component.KeysUnlocked)
{ {
if (_net.IsClient && _timing.IsFirstTimePredicted) _popup.PopupClient(Loc.GetString("encryption-keys-are-locked"), uid, args.User);
_popup.PopupEntity(Loc.GetString("encryption-keys-are-locked"), uid, args.User);
return; return;
} }
if (TryComp<WiresPanelComponent>(uid, out var panel) && !panel.Open) if (TryComp<WiresPanelComponent>(uid, out var panel) && !panel.Open)
{ {
if (_net.IsClient && _timing.IsFirstTimePredicted) _popup.PopupClient(Loc.GetString("encryption-keys-panel-locked"), uid, args.User);
_popup.PopupEntity(Loc.GetString("encryption-keys-panel-locked"), uid, args.User);
return; return;
} }
if (component.KeyContainer.ContainedEntities.Count == 0) if (component.KeyContainer.ContainedEntities.Count == 0)
{ {
if (_net.IsClient && _timing.IsFirstTimePredicted) _popup.PopupClient(Loc.GetString("encryption-keys-no-keys"), uid, args.User);
_popup.PopupEntity(Loc.GetString("encryption-keys-no-keys"), uid, args.User);
return; return;
} }