Namespace cleanup around Mind Roles (#30965)

* namespaces

* Comment does not need a semicolon

---------

Co-authored-by: Vasilis <vascreeper@yahoo.com>
This commit is contained in:
Errant
2024-08-15 20:26:57 +02:00
committed by GitHub
parent f523df821a
commit 40b9fd4ea3
14 changed files with 2356 additions and 2370 deletions

View File

@@ -7,10 +7,10 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
namespace Content.Client.Administration
namespace Content.Client.Administration;
internal sealed class AdminNameOverlay : Overlay
{
internal sealed class AdminNameOverlay : Overlay
{
private readonly AdminSystem _system;
private readonly IEntityManager _entityManager;
private readonly IEyeManager _eyeManager;
@@ -69,5 +69,4 @@ namespace Content.Client.Administration
args.ScreenHandle.DrawString(_font, screenCoordinates, playerInfo.CharacterName, playerInfo.Connected ? Color.Aquamarine : Color.White);
}
}
}
}

View File

@@ -10,11 +10,11 @@ using Robust.Client.UserInterface.XAML;
using static Content.Client.Administration.UI.Tabs.PlayerTab.PlayerTabHeader;
using static Robust.Client.UserInterface.Controls.BaseButton;
namespace Content.Client.Administration.UI.Tabs.PlayerTab
namespace Content.Client.Administration.UI.Tabs.PlayerTab;
[GenerateTypedNameReferences]
public sealed partial class PlayerTab : Control
{
[GenerateTypedNameReferences]
public sealed partial class PlayerTab : Control
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IPlayerManager _playerMan = default!;
@@ -223,7 +223,6 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
}
#endregion
}
public record PlayerListData(PlayerInfo Info, string FilteringString) : ListData;
}
public record PlayerListData(PlayerInfo Info, string FilteringString) : ListData;

View File

@@ -5,10 +5,10 @@ using Content.Shared.Chat;
using Robust.Client.Console;
using Robust.Shared.Utility;
namespace Content.Client.Chat.Managers
namespace Content.Client.Chat.Managers;
internal sealed class ChatManager : IChatManager
{
internal sealed class ChatManager : IChatManager
{
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IClientAdminManager _adminMgr = default!;
[Dependency] private readonly IEntitySystemManager _systems = default!;
@@ -71,5 +71,4 @@ namespace Content.Client.Chat.Managers
throw new ArgumentOutOfRangeException(nameof(channel), channel, null);
}
}
}
}

View File

@@ -31,10 +31,10 @@ using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Player;
namespace Content.Server.Administration.Systems
namespace Content.Server.Administration.Systems;
public sealed class AdminSystem : EntitySystem
{
public sealed class AdminSystem : EntitySystem
{
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly IChatManager _chat = default!;
[Dependency] private readonly IConfigurationManager _config = default!;
@@ -452,5 +452,4 @@ namespace Content.Server.Administration.Systems
{
UpdatePlayerList(session);
}
}
}

View File

@@ -18,13 +18,13 @@ using Robust.Shared.Player;
using Robust.Shared.Replays;
using Robust.Shared.Utility;
namespace Content.Server.Chat.Managers
namespace Content.Server.Chat.Managers;
/// <summary>
/// Dispatches chat messages to clients.
/// </summary>
internal sealed partial class ChatManager : IChatManager
{
/// <summary>
/// Dispatches chat messages to clients.
/// </summary>
internal sealed partial class ChatManager : IChatManager
{
private static readonly Dictionary<string, string> PatronOocColors = new()
{
// I had plans for multiple colors and those went nowhere so...
@@ -392,11 +392,10 @@ namespace Content.Server.Chat.Managers
}
#endregion
}
}
public enum OOCChatType : byte
{
public enum OOCChatType : byte
{
OOC,
Admin
}
}

View File

@@ -1,11 +1,10 @@
namespace Content.Server.Ghost
namespace Content.Server.Ghost;
/// <summary>
/// This is used to mark Observers properly, as they get Minds
/// </summary>
[RegisterComponent]
public sealed partial class ObserverRoleComponent : Component
{
/// <summary>
/// This is used to mark Observers properly, as they get Minds
/// </summary>
[RegisterComponent]
public sealed partial class ObserverRoleComponent : Component
{
public string Name => Loc.GetString("observer-role-name");
}
}

View File

@@ -2,12 +2,12 @@
using Content.Server.Mind.Commands;
using Content.Shared.Roles;
namespace Content.Server.Ghost.Roles.Components
namespace Content.Server.Ghost.Roles.Components;
[RegisterComponent]
[Access(typeof(GhostRoleSystem))]
public sealed partial class GhostRoleComponent : Component
{
[RegisterComponent]
[Access(typeof(GhostRoleSystem))]
public sealed partial class GhostRoleComponent : Component
{
[DataField("name")] private string _roleName = "Unknown";
[DataField("description")] private string _roleDescription = "Unknown";
@@ -99,5 +99,4 @@ namespace Content.Server.Ghost.Roles.Components
[DataField("raffle")]
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
public GhostRoleRaffleConfig? RaffleConfig { get; set; }
}
}

View File

@@ -34,11 +34,11 @@ using Content.Shared.Verbs;
using Robust.Shared.Collections;
using Content.Shared.Ghost.Roles.Components;
namespace Content.Server.Ghost.Roles
namespace Content.Server.Ghost.Roles;
[UsedImplicitly]
public sealed class GhostRoleSystem : EntitySystem
{
[UsedImplicitly]
public sealed class GhostRoleSystem : EntitySystem
{
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly EuiManager _euiManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
@@ -806,11 +806,11 @@ namespace Content.Server.Ghost.Roles
SetMode(entity.Owner, ghostRoleProto, ghostRoleProto.Name, entity.Comp);
}
}
}
[AnyCommand]
public sealed class GhostRoles : IConsoleCommand
{
[AnyCommand]
public sealed class GhostRoles : IConsoleCommand
{
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "ghostroles";
@@ -823,5 +823,4 @@ namespace Content.Server.Ghost.Roles
else
shell.WriteLine("You can only open the ghost roles UI on a client.");
}
}
}

View File

@@ -37,16 +37,16 @@ using Content.Shared.Traits.Assorted;
using Robust.Shared.Audio.Systems;
using Content.Shared.Ghost.Roles.Components;
namespace Content.Server.Zombies
namespace Content.Server.Zombies;
/// <summary>
/// Handles zombie propagation and inherent zombie traits
/// </summary>
/// <remarks>
/// Don't Shitcode Open Inside
/// </remarks>
public sealed partial class ZombieSystem
{
/// <summary>
/// Handles zombie propagation and inherent zombie traits
/// </summary>
/// <remarks>
/// Don't Shitcode Open Inside
/// </remarks>
public sealed partial class ZombieSystem
{
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly ServerInventorySystem _inventory = default!;
[Dependency] private readonly NpcFactionSystem _faction = default!;
@@ -277,5 +277,4 @@ namespace Content.Server.Zombies
//zombies get slowdown once they convert
_movementSpeedModifier.RefreshMovementSpeedModifiers(target);
}
}
}

View File

@@ -1,10 +1,9 @@
using Robust.Shared.Serialization;
namespace Content.Shared.Administration.Events
namespace Content.Shared.Administration.Events;
[NetSerializable, Serializable]
public sealed class PlayerInfoChangedEvent : EntityEventArgs
{
[NetSerializable, Serializable]
public sealed class PlayerInfoChangedEvent : EntityEventArgs
{
public PlayerInfo? PlayerInfo;
}
}

View File

@@ -1,10 +1,10 @@
using Robust.Shared.Network;
using Robust.Shared.Serialization;
namespace Content.Shared.Administration
{
[Serializable, NetSerializable]
public sealed record PlayerInfo(
namespace Content.Shared.Administration;
[Serializable, NetSerializable]
public sealed record PlayerInfo(
string Username,
string CharacterName,
string IdentityName,
@@ -15,7 +15,7 @@ namespace Content.Shared.Administration
bool Connected,
bool ActiveThisRound,
TimeSpan? OverallPlaytime)
{
{
private string? _playtimeString;
public bool IsPinned { get; set; }
@@ -32,5 +32,4 @@ namespace Content.Shared.Administration
{
return SessionId.GetHashCode();
}
}
}

View File

@@ -1,12 +1,11 @@
using Robust.Shared.Serialization;
namespace Content.Shared.Ghost.Roles
namespace Content.Shared.Ghost.Roles;
[Serializable, NetSerializable]
public sealed class GhostRole
{
[Serializable, NetSerializable]
public sealed class GhostRole
{
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public NetEntity Id;
}
}

View File

@@ -1,15 +1,15 @@
using System.Diagnostics.CodeAnalysis;
using Robust.Shared.GameStates;
namespace Content.Shared.Mind.Components
namespace Content.Shared.Mind.Components;
/// <summary>
/// This component indicates that this entity may have mind, which is simply an entity with a <see cref="MindComponent"/>.
/// The mind entity is not actually stored in a "container", but is simply stored in nullspace.
/// </summary>
[RegisterComponent, Access(typeof(SharedMindSystem)), NetworkedComponent, AutoGenerateComponentState]
public sealed partial class MindContainerComponent : Component
{
/// <summary>
/// This component indicates that this entity may have mind, which is simply an entity with a <see cref="MindComponent"/>.
/// The mind entity is not actually stored in a "container", but is simply stored in nullspace.
/// </summary>
[RegisterComponent, Access(typeof(SharedMindSystem)), NetworkedComponent, AutoGenerateComponentState]
public sealed partial class MindContainerComponent : Component
{
/// <summary>
/// The mind controlling this mob. Can be null.
/// </summary>
@@ -37,10 +37,10 @@ namespace Content.Shared.Mind.Components
[DataField("ghostOnShutdown")]
[Access(typeof(SharedMindSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
public bool GhostOnShutdown { get; set; } = true;
}
}
public abstract class MindEvent : EntityEventArgs
{
public abstract class MindEvent : EntityEventArgs
{
public readonly Entity<MindComponent> Mind;
public readonly Entity<MindContainerComponent> Container;
@@ -49,49 +49,48 @@ namespace Content.Shared.Mind.Components
Mind = mind;
Container = container;
}
}
}
/// <summary>
/// Event raised directed at a mind-container when a mind gets removed.
/// </summary>
public sealed class MindRemovedMessage : MindEvent
{
/// <summary>
/// Event raised directed at a mind-container when a mind gets removed.
/// </summary>
public sealed class MindRemovedMessage : MindEvent
{
public MindRemovedMessage(Entity<MindComponent> mind, Entity<MindContainerComponent> container)
: base(mind, container)
{
}
}
}
/// <summary>
/// Event raised directed at a mind when it gets removed from a mind-container.
/// </summary>
public sealed class MindGotRemovedEvent : MindEvent
{
/// <summary>
/// Event raised directed at a mind when it gets removed from a mind-container.
/// </summary>
public sealed class MindGotRemovedEvent : MindEvent
{
public MindGotRemovedEvent(Entity<MindComponent> mind, Entity<MindContainerComponent> container)
: base(mind, container)
{
}
}
}
/// <summary>
/// Event raised directed at a mind-container when a mind gets added.
/// </summary>
public sealed class MindAddedMessage : MindEvent
{
/// <summary>
/// Event raised directed at a mind-container when a mind gets added.
/// </summary>
public sealed class MindAddedMessage : MindEvent
{
public MindAddedMessage(Entity<MindComponent> mind, Entity<MindContainerComponent> container)
: base(mind, container)
{
}
}
}
/// <summary>
/// Event raised directed at a mind when it gets added to a mind-container.
/// </summary>
public sealed class MindGotAddedEvent : MindEvent
{
/// <summary>
/// Event raised directed at a mind when it gets added to a mind-container.
/// </summary>
public sealed class MindGotAddedEvent : MindEvent
{
public MindGotAddedEvent(Entity<MindComponent> mind, Entity<MindContainerComponent> container)
: base(mind, container)
{
}
}
}

View File

@@ -5,27 +5,27 @@ using Robust.Shared.GameStates;
using Robust.Shared.Network;
using Robust.Shared.Player;
namespace Content.Shared.Mind
namespace Content.Shared.Mind;
/// <summary>
/// This component stores information about a player/mob mind. The component will be attached to a mind-entity
/// which is stored in null-space. The entity that is currently "possessed" by the mind will have a
/// <see cref="MindContainerComponent"/>.
/// </summary>
/// <remarks>
/// Roles are attached as components on the mind-entity entity.
/// Think of it like this: if a player is supposed to have their memories,
/// their mind follows along.
///
/// Things such as respawning do not follow, because you're a new character.
/// Getting borged, cloned, turned into a catbeast, etc... will keep it following you.
///
/// Minds are stored in null-space, and are thus generally not set to players unless that player is the owner
/// of the mind. As a result it should be safe to network "secret" information like roles & objectives
/// </remarks>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
public sealed partial class MindComponent : Component
{
/// <summary>
/// This component stores information about a player/mob mind. The component will be attached to a mind-entity
/// which is stored in null-space. The entity that is currently "possessed" by the mind will have a
/// <see cref="MindContainerComponent"/>.
/// </summary>
/// <remarks>
/// Roles are attached as components on the mind-entity entity.
/// Think of it like this: if a player is supposed to have their memories,
/// their mind follows along.
///
/// Things such as respawning do not follow, because you're a new character.
/// Getting borged, cloned, turned into a catbeast, etc... will keep it following you.
///
/// Minds are stored in null-space, and are thus generally not set to players unless that player is the owner
/// of the mind. As a result it should be safe to network "secret" information like roles & objectives
/// </remarks>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
public sealed partial class MindComponent : Component
{
[DataField, AutoNetworkedField]
public List<EntityUid> Objectives = new();
@@ -105,5 +105,4 @@ namespace Content.Shared.Mind
[ViewVariables, Access(typeof(SharedMindSystem), typeof(SharedGameTicker))]
// TODO remove this after moving IPlayerManager functions to shared
public ICommonSession? Session { get; set; }
}
}