Allow zoom command to ignore zoom limits (#19419)

This commit is contained in:
Leon Friedrich
2023-08-22 21:27:41 +12:00
committed by GitHub
parent cf38f16d36
commit 4d845caa07
7 changed files with 62 additions and 36 deletions

View File

@@ -1,3 +1,5 @@
using Robust.Shared.Players;
namespace Content.Shared.Administration.Managers;
/// <summary>
@@ -16,6 +18,18 @@ public interface ISharedAdminManager
/// </param>
/// <returns><see langword="null" /> if the player is not an admin.</returns>
AdminData? GetAdminData(EntityUid uid, bool includeDeAdmin = false);
/// <summary>
/// Gets the admin data for a player, if they are an admin.
/// </summary>
/// <remarks>
/// When used by the client, this only returns accurate results for the player's own session.
/// </remarks>
/// <param name="includeDeAdmin">
/// Whether to return admin data for admins that are current de-adminned.
/// </param>
/// <returns><see langword="null" /> if the player is not an admin.</returns>
AdminData? GetAdminData(ICommonSession session, bool includeDeAdmin = false);
/// <summary>
/// See if a player has an admin flag.
@@ -29,6 +43,19 @@ public interface ISharedAdminManager
var data = GetAdminData(player);
return data != null && data.HasFlag(flag);
}
/// <summary>
/// See if a player has an admin flag.
/// </summary>
/// <remarks>
/// When used by the client, this only returns accurate results for the player's own session.
/// </remarks>
/// <returns>True if the player is and admin and has the specified flags.</returns>
bool HasAdminFlag(ICommonSession player, AdminFlags flag)
{
var data = GetAdminData(player);
return data != null && data.HasFlag(flag);
}
/// <summary>
/// Checks if a player is an admin.
@@ -44,4 +71,19 @@ public interface ISharedAdminManager
{
return GetAdminData(uid, includeDeAdmin) != null;
}
/// <summary>
/// Checks if a player is an admin.
/// </summary>
/// <remarks>
/// When used by the client, this only returns accurate results for the player's own session.
/// </remarks>
/// <param name="includeDeAdmin">
/// Whether to return admin data for admins that are current de-adminned.
/// </param>
/// <returns>true if the player is an admin, false otherwise.</returns>
bool IsAdmin(ICommonSession session, bool includeDeAdmin = false)
{
return GetAdminData(session, includeDeAdmin) != null;
}
}