add lock uplink button (#15994)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-05-02 07:53:10 +00:00
committed by GitHub
parent 529ca8ec88
commit a5aa4196a4
7 changed files with 83 additions and 57 deletions

View File

@@ -137,6 +137,15 @@ namespace Content.Server.PDA
_store.ToggleUi(msg.Session.AttachedEntity!.Value, uid, store);
break;
}
case PDALockUplinkMessage _:
{
if (TryComp<RingerUplinkComponent>(uid, out var uplink))
{
_ringer.LockUplink(uid, uplink);
UpdatePdaUi(uid, pda);
}
break;
}
}
}

View File

@@ -79,6 +79,21 @@ namespace Content.Server.PDA.Ringer
}
}
/// <summary>
/// Locks the uplink and closes the window, if its open
/// </summary>
/// <remarks>
/// Will not update the PDA ui so you must do that yourself if needed
/// </remarks>
public void LockUplink(EntityUid uid, RingerUplinkComponent? uplink)
{
if (!Resolve(uid, ref uplink, true))
return;
uplink.Unlocked = false;
_ui.TryCloseAll(uid, StoreUiKey.Key);
}
public void RandomizeRingtone(EntityUid uid, RingerComponent ringer, MapInitEvent args)
{
UpdateRingerRingtone(ringer, GenerateRingtone());