Move minds, roles, jobs and objectives to shared (#19679)

This commit is contained in:
DrSmugleaf
2023-08-30 21:46:11 -07:00
committed by GitHub
parent b702963d5e
commit 3f3ba6ac62
139 changed files with 1209 additions and 1041 deletions

View File

@@ -1,7 +1,7 @@
using Content.Server.GameTicking;
using Content.Server.Mind;
using Content.Shared.Administration;
using Content.Shared.Ghost;
using Content.Shared.Mind;
using Robust.Server.Player;
using Robust.Shared.Console;
@@ -25,7 +25,7 @@ namespace Content.Server.Administration.Commands
return;
}
var mindSystem = _entities.System<MindSystem>();
var mindSystem = _entities.System<SharedMindSystem>();
if (!mindSystem.TryGetMind(player, out var mindId, out var mind))
{
shell.WriteLine("You can't ghost here!");

View File

@@ -1,5 +1,5 @@
using Content.Server.Mind;
using Content.Shared.Administration;
using Content.Shared.Mind;
using Robust.Server.Player;
using Robust.Shared.Console;
@@ -42,7 +42,7 @@ namespace Content.Server.Administration.Commands
return;
}
var mindSystem = _entities.System<MindSystem>();
var mindSystem = _entities.System<SharedMindSystem>();
if (!mindSystem.TryGetMind(target, out var mindId, out var mind))
{
shell.WriteLine(Loc.GetString("shell-entity-is-not-mob"));

View File

@@ -1,7 +1,7 @@
using Content.Server.Mind;
using Content.Server.Mind.Components;
using Content.Server.Players;
using Content.Shared.Administration;
using Content.Shared.Mind;
using Content.Shared.Mind.Components;
using Robust.Server.Player;
using Robust.Shared.Console;
@@ -67,7 +67,7 @@ namespace Content.Server.Administration.Commands
return;
}
var mindSystem = entityManager.System<MindSystem>();
var mindSystem = entityManager.System<SharedMindSystem>();
var metadata = entityManager.GetComponent<MetaDataComponent>(eUid);
var mind = playerCData.Mind ?? mindSystem.CreateMind(session.UserId, metadata.EntityName);

View File

@@ -9,10 +9,9 @@ using Content.Shared.Administration.Notes;
using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.Players.PlayTimeTracking;
using Robust.Server.Player;
using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.Network;
using Robust.Shared.Players;
namespace Content.Server.Administration.Notes;
@@ -33,27 +32,27 @@ public sealed class AdminNotesManager : IAdminNotesManager, IPostInjectInit
private ISawmill _sawmill = default!;
public bool CanCreate(IPlayerSession admin)
public bool CanCreate(ICommonSession admin)
{
return CanEdit(admin);
}
public bool CanDelete(IPlayerSession admin)
public bool CanDelete(ICommonSession admin)
{
return CanEdit(admin);
}
public bool CanEdit(IPlayerSession admin)
public bool CanEdit(ICommonSession admin)
{
return _admins.HasAdminFlag(admin, AdminFlags.EditNotes);
}
public bool CanView(IPlayerSession admin)
public bool CanView(ICommonSession admin)
{
return _admins.HasAdminFlag(admin, AdminFlags.ViewNotes);
}
public async Task OpenEui(IPlayerSession admin, Guid notedPlayer)
public async Task OpenEui(ICommonSession admin, Guid notedPlayer)
{
var ui = new AdminNotesEui();
_euis.OpenEui(ui, admin);
@@ -61,7 +60,7 @@ public sealed class AdminNotesManager : IAdminNotesManager, IPostInjectInit
await ui.ChangeNotedPlayer(notedPlayer);
}
public async Task OpenUserNotesEui(IPlayerSession player)
public async Task OpenUserNotesEui(ICommonSession player)
{
var ui = new UserNotesEui();
_euis.OpenEui(ui, player);
@@ -69,7 +68,7 @@ public sealed class AdminNotesManager : IAdminNotesManager, IPostInjectInit
await ui.UpdateNotes();
}
public async Task AddAdminRemark(IPlayerSession createdBy, Guid player, NoteType type, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime)
public async Task AddAdminRemark(ICommonSession createdBy, Guid player, NoteType type, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime)
{
message = message.Trim();
@@ -179,7 +178,7 @@ public sealed class AdminNotesManager : IAdminNotesManager, IPostInjectInit
};
}
public async Task DeleteAdminRemark(int noteId, NoteType type, IPlayerSession deletedBy)
public async Task DeleteAdminRemark(int noteId, NoteType type, ICommonSession deletedBy)
{
var note = await GetAdminRemark(noteId, type);
if (note == null)
@@ -215,7 +214,7 @@ public sealed class AdminNotesManager : IAdminNotesManager, IPostInjectInit
NoteDeleted?.Invoke(note);
}
public async Task ModifyAdminRemark(int noteId, NoteType type, IPlayerSession editedBy, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime)
public async Task ModifyAdminRemark(int noteId, NoteType type, ICommonSession editedBy, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime)
{
message = message.Trim();

View File

@@ -2,7 +2,7 @@ using System.Threading.Tasks;
using Content.Server.Database;
using Content.Shared.Administration.Notes;
using Content.Shared.Database;
using Robust.Server.Player;
using Robust.Shared.Players;
namespace Content.Server.Administration.Notes;
@@ -12,15 +12,15 @@ public interface IAdminNotesManager
event Action<SharedAdminNote>? NoteModified;
event Action<SharedAdminNote>? NoteDeleted;
bool CanCreate(IPlayerSession admin);
bool CanDelete(IPlayerSession admin);
bool CanEdit(IPlayerSession admin);
bool CanView(IPlayerSession admin);
Task OpenEui(IPlayerSession admin, Guid notedPlayer);
Task OpenUserNotesEui(IPlayerSession player);
Task AddAdminRemark(IPlayerSession createdBy, Guid player, NoteType type, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime);
Task DeleteAdminRemark(int noteId, NoteType type, IPlayerSession deletedBy);
Task ModifyAdminRemark(int noteId, NoteType type, IPlayerSession editedBy, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime);
bool CanCreate(ICommonSession admin);
bool CanDelete(ICommonSession admin);
bool CanEdit(ICommonSession admin);
bool CanView(ICommonSession admin);
Task OpenEui(ICommonSession admin, Guid notedPlayer);
Task OpenUserNotesEui(ICommonSession player);
Task AddAdminRemark(ICommonSession createdBy, Guid player, NoteType type, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime);
Task DeleteAdminRemark(int noteId, NoteType type, ICommonSession deletedBy);
Task ModifyAdminRemark(int noteId, NoteType type, ICommonSession editedBy, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime);
/// <summary>
/// Queries the database and retrieves all notes, secret and visible
/// </summary>

View File

@@ -2,16 +2,17 @@ using System.Linq;
using Content.Server.Administration.Managers;
using Content.Server.IdentityManagement;
using Content.Server.Mind;
using Content.Server.Roles;
using Content.Server.Roles.Jobs;
using Content.Shared.Administration;
using Content.Shared.Administration.Events;
using Content.Shared.GameTicking;
using Content.Shared.IdentityManagement;
using Content.Shared.Roles;
using Content.Shared.Roles.Jobs;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Player;
namespace Content.Server.Administration.Systems
{
@@ -19,9 +20,9 @@ namespace Content.Server.Administration.Systems
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly JobSystem _jobs = default!;
[Dependency] private readonly SharedJobSystem _jobs = default!;
[Dependency] private readonly MindSystem _minds = default!;
[Dependency] private readonly RoleSystem _role = default!;
[Dependency] private readonly SharedRoleSystem _role = default!;
private readonly Dictionary<NetUserId, PlayerInfo> _playerList = new();
@@ -104,10 +105,11 @@ namespace Content.Server.Administration.Systems
private void OnRoleEvent(RoleEvent ev)
{
if (!ev.Antagonist || ev.Mind.Session == null)
var session = _minds.GetSession(ev.Mind);
if (!ev.Antagonist || session == null)
return;
UpdatePlayerList(ev.Mind.Session);
UpdatePlayerList(session);
}
private void OnAdminPermsChanged(AdminPermsChangedEventArgs obj)

View File

@@ -1,9 +1,9 @@
using Content.Server.GameTicking.Rules;
using Content.Server.Mind;
using Content.Server.Mind.Components;
using Content.Server.Zombies;
using Content.Shared.Administration;
using Content.Shared.Database;
using Content.Shared.Mind;
using Content.Shared.Mind.Components;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.Utility;
@@ -16,7 +16,7 @@ public sealed partial class AdminVerbSystem
[Dependency] private readonly TraitorRuleSystem _traitorRule = default!;
[Dependency] private readonly NukeopsRuleSystem _nukeopsRule = default!;
[Dependency] private readonly PiratesRuleSystem _piratesRule = default!;
[Dependency] private readonly MindSystem _minds = default!;
[Dependency] private readonly SharedMindSystem _minds = default!;
// All antag verbs have names so invokeverb works.
private void AddAntagVerbs(GetVerbsEvent<Verb> args)

View File

@@ -8,9 +8,7 @@ using Content.Server.Disposal.Tube;
using Content.Server.Disposal.Tube.Components;
using Content.Server.EUI;
using Content.Server.Ghost.Roles;
using Content.Server.Mind;
using Content.Server.Mind.Commands;
using Content.Server.Mind.Components;
using Content.Server.Prayer;
using Content.Server.Xenoarchaeology.XenoArtifacts;
using Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Components;
@@ -20,6 +18,8 @@ using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Inventory;
using Content.Shared.Mind;
using Content.Shared.Mind.Components;
using Content.Shared.Popups;
using Content.Shared.Verbs;
using Robust.Server.Console;
@@ -28,6 +28,7 @@ using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Players;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Robust.Shared.Toolshed;
@@ -54,11 +55,11 @@ namespace Content.Server.Administration.Systems
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly PrayerSystem _prayerSystem = default!;
[Dependency] private readonly EuiManager _eui = default!;
[Dependency] private readonly MindSystem _mindSystem = default!;
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
[Dependency] private readonly ToolshedManager _toolshed = default!;
[Dependency] private readonly RejuvenateSystem _rejuvenate = default!;
private readonly Dictionary<IPlayerSession, EditSolutionsEui> _openSolutionUis = new();
private readonly Dictionary<ICommonSession, EditSolutionsEui> _openSolutionUis = new();
public override void Initialize()
{
@@ -425,7 +426,7 @@ namespace Content.Server.Administration.Systems
eui.StateDirty();
}
public void OnEditSolutionsEuiClosed(IPlayerSession session)
public void OnEditSolutionsEuiClosed(ICommonSession session)
{
_openSolutionUis.Remove(session, out var eui);
}

View File

@@ -8,9 +8,9 @@ using System.Threading.Tasks;
using Content.Server.Administration.Managers;
using Content.Server.Discord;
using Content.Server.GameTicking;
using Content.Server.Mind;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Content.Shared.Mind;
using JetBrains.Annotations;
using Robust.Server.Player;
using Robust.Shared;
@@ -31,7 +31,7 @@ namespace Content.Server.Administration.Systems
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IPlayerLocator _playerLocator = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly MindSystem _minds = default!;
[Dependency] private readonly SharedMindSystem _minds = default!;
private ISawmill _sawmill = default!;
private readonly HttpClient _httpClient = new();