Files

67 lines
1.9 KiB
C#
Raw Permalink Normal View History


namespace Content.Shared.Administration
{
2020-11-10 21:30:20 +01:00
/// <summary>
/// Represents data for a single server admin.
/// </summary>
public sealed class AdminData
{
// Can be false if they're de-adminned with the ability to re-admin.
2020-11-10 21:30:20 +01:00
/// <summary>
/// Whether the admin is currently active. This can be false if they have de-adminned mid-round.
/// </summary>
public bool Active;
2020-11-10 21:30:20 +01:00
2023-07-16 11:32:42 +03:00
public bool Stealth; // WD
2020-11-10 21:30:20 +01:00
/// <summary>
/// The admin's title.
/// </summary>
public string? Title;
2020-11-10 21:30:20 +01:00
/// <summary>
/// The admin's permission flags.
/// </summary>
public AdminFlags Flags;
2020-11-10 21:30:20 +01:00
/// <summary>
/// Checks whether this admin has an admin flag.
/// </summary>
/// <param name="flag">The flags to check. Multiple flags can be specified, they must all be held.</param>
/// <returns>False if this admin is not <see cref="Active"/> or does not have all the flags specified.</returns>
public bool HasFlag(AdminFlags flag)
{
return Active && (Flags & flag) == flag;
}
2020-11-10 21:30:20 +01:00
/// <summary>
/// Check if this admin can spawn stuff in with the entity/tile spawn panel.
/// </summary>
public bool CanAdminPlace()
{
return HasFlag(AdminFlags.Spawn);
}
2020-11-10 21:30:20 +01:00
/// <summary>
/// Check if this admin can execute server-side C# scripts.
/// </summary>
public bool CanScript()
{
return HasFlag(AdminFlags.Host);
}
2020-11-10 21:30:20 +01:00
/// <summary>
/// Check if this admin can open the admin menu.
/// </summary>
public bool CanAdminMenu()
{
return HasFlag(AdminFlags.Admin);
}
public bool CanAdminReloadPrototypes()
{
return HasFlag(AdminFlags.Host);
}
}
}