Move minds, roles, jobs and objectives to shared (#19679)
This commit is contained in:
7
Content.Client/Mind/MindSystem.cs
Normal file
7
Content.Client/Mind/MindSystem.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Content.Shared.Mind;
|
||||
|
||||
namespace Content.Client.Mind;
|
||||
|
||||
public sealed class MindSystem : SharedMindSystem
|
||||
{
|
||||
}
|
||||
12
Content.Client/Players/PlayerSystem.cs
Normal file
12
Content.Client/Players/PlayerSystem.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Content.Shared.Players;
|
||||
using Robust.Shared.Players;
|
||||
|
||||
namespace Content.Client.Players;
|
||||
|
||||
public sealed class PlayerSystem : SharedPlayerSystem
|
||||
{
|
||||
public override PlayerData? ContentData(ICommonSession? session)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
7
Content.Client/Roles/Jobs/JobSystem.cs
Normal file
7
Content.Client/Roles/Jobs/JobSystem.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Content.Shared.Roles.Jobs;
|
||||
|
||||
namespace Content.Client.Roles.Jobs;
|
||||
|
||||
public sealed class JobSystem : SharedJobSystem
|
||||
{
|
||||
}
|
||||
5
Content.Client/Roles/RoleSystem.cs
Normal file
5
Content.Client/Roles/RoleSystem.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Content.Client.Roles;
|
||||
|
||||
public sealed class RoleSystem : EntitySystem
|
||||
{
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Robust.Client;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Exceptions;
|
||||
|
||||
@@ -12,22 +12,13 @@ using Content.IntegrationTests.Tests;
|
||||
using Content.IntegrationTests.Tests.Destructible;
|
||||
using Content.IntegrationTests.Tests.DeviceNetwork;
|
||||
using Content.IntegrationTests.Tests.Interaction.Click;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.GameTicking;
|
||||
using Robust.Client;
|
||||
using Robust.Client.State;
|
||||
using Robust.Server;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.ContentPack;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.UnitTesting;
|
||||
|
||||
@@ -5,7 +5,6 @@ using Content.Client.Construction;
|
||||
using Content.Client.Examine;
|
||||
using Content.IntegrationTests.Pair;
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Players;
|
||||
using Content.Server.Stack;
|
||||
using Content.Server.Tools;
|
||||
@@ -14,6 +13,7 @@ using Content.Shared.DoAfter;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Client.Input;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -192,7 +192,7 @@ public abstract partial class InteractionTest
|
||||
{
|
||||
// Fuck you mind system I want an hour of my life back
|
||||
// Mind system is a time vampire
|
||||
SEntMan.System<MindSystem>().WipeMind(ServerSession.ContentData()?.Mind);
|
||||
SEntMan.System<SharedMindSystem>().WipeMind(ServerSession.ContentData()?.Mind);
|
||||
|
||||
old = cPlayerMan.LocalPlayer.ControlledEntity;
|
||||
Player = SEntMan.SpawnEntity(PlayerPrototype, PlayerCoords);
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Ghost.Roles;
|
||||
using Content.Server.Ghost.Roles.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
@@ -42,7 +42,7 @@ public sealed class GhostRoleTests
|
||||
var entMan = server.ResolveDependency<IEntityManager>();
|
||||
var sPlayerMan = server.ResolveDependency<Robust.Server.Player.IPlayerManager>();
|
||||
var conHost = client.ResolveDependency<IConsoleHost>();
|
||||
var mindSystem = entMan.System<MindSystem>();
|
||||
var mindSystem = entMan.System<SharedMindSystem>();
|
||||
var session = sPlayerMan.ServerSessions.Single();
|
||||
var originalMindId = session.ContentData()!.Mind!.Value;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
@@ -27,7 +27,7 @@ public sealed partial class MindTests
|
||||
var entMan = server.ResolveDependency<IServerEntityManager>();
|
||||
var playerMan = server.ResolveDependency<IPlayerManager>();
|
||||
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<MindSystem>();
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<SharedMindSystem>();
|
||||
|
||||
EntityUid playerEnt = default;
|
||||
EntityUid visitEnt = default;
|
||||
@@ -83,7 +83,7 @@ public sealed partial class MindTests
|
||||
var playerMan = server.ResolveDependency<IPlayerManager>();
|
||||
var player = playerMan.ServerSessions.Single();
|
||||
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<MindSystem>();
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<SharedMindSystem>();
|
||||
|
||||
EntityUid playerEnt = default;
|
||||
EntityUid mindId = default!;
|
||||
@@ -159,7 +159,7 @@ public sealed partial class MindTests
|
||||
|
||||
var entMan = server.ResolveDependency<IServerEntityManager>();
|
||||
var playerMan = server.ResolveDependency<IPlayerManager>();
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<MindSystem>();
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<SharedMindSystem>();
|
||||
var mind = GetMind(pair);
|
||||
|
||||
var player = playerMan.ServerSessions.Single();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Linq;
|
||||
using Content.IntegrationTests.Pair;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Enums;
|
||||
@@ -34,7 +34,7 @@ public sealed partial class MindTests
|
||||
|
||||
var entMan = pair.Server.ResolveDependency<IServerEntityManager>();
|
||||
var playerMan = pair.Server.ResolveDependency<IPlayerManager>();
|
||||
var mindSys = entMan.System<MindSystem>();
|
||||
var mindSys = entMan.System<SharedMindSystem>();
|
||||
|
||||
var player = playerMan.ServerSessions.Single();
|
||||
|
||||
@@ -66,7 +66,7 @@ public sealed partial class MindTests
|
||||
{
|
||||
var entMan = pair.Server.ResolveDependency<IServerEntityManager>();
|
||||
var playerMan = pair.Server.ResolveDependency<IPlayerManager>();
|
||||
var mindSys = entMan.System<MindSystem>();
|
||||
var mindSys = entMan.System<SharedMindSystem>();
|
||||
EntityUid ghostUid = default;
|
||||
EntityUid mindId = default!;
|
||||
MindComponent mind = default!;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
@@ -124,7 +124,7 @@ public sealed partial class MindTests
|
||||
{
|
||||
await using var pair = await SetupPair();
|
||||
var entMan = pair.Server.ResolveDependency<IEntityManager>();
|
||||
var mindSys = entMan.System<MindSystem>();
|
||||
var mindSys = entMan.System<SharedMindSystem>();
|
||||
var mind = GetMind(pair);
|
||||
|
||||
// Make player visit a new mob
|
||||
|
||||
@@ -3,15 +3,16 @@ using System.Linq;
|
||||
using Content.Server.Ghost;
|
||||
using Content.Server.Ghost.Roles;
|
||||
using Content.Server.Ghost.Roles.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Commands;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Players;
|
||||
using Content.Server.Roles;
|
||||
using Content.Server.Roles.Jobs;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Roles;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
@@ -61,7 +62,7 @@ public sealed partial class MindTests
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<MindSystem>();
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<SharedMindSystem>();
|
||||
|
||||
var entity = entMan.SpawnEntity(null, new MapCoordinates());
|
||||
var mindComp = entMan.EnsureComponent<MindContainerComponent>(entity);
|
||||
@@ -88,7 +89,7 @@ public sealed partial class MindTests
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<MindSystem>();
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<SharedMindSystem>();
|
||||
|
||||
var entity = entMan.SpawnEntity(null, new MapCoordinates());
|
||||
var mindComp = entMan.EnsureComponent<MindContainerComponent>(entity);
|
||||
@@ -122,7 +123,7 @@ public sealed partial class MindTests
|
||||
EntityUid entity = default!;
|
||||
MindContainerComponent mindContainerComp = default!;
|
||||
EntityUid mindId = default!;
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<MindSystem>();
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<SharedMindSystem>();
|
||||
var damageableSystem = entMan.EntitySysManager.GetEntitySystem<DamageableSystem>();
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
@@ -176,7 +177,7 @@ public sealed partial class MindTests
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<MindSystem>();
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<SharedMindSystem>();
|
||||
|
||||
var entity = entMan.SpawnEntity(null, new MapCoordinates());
|
||||
var targetEntity = entMan.SpawnEntity(null, new MapCoordinates());
|
||||
@@ -213,7 +214,7 @@ public sealed partial class MindTests
|
||||
var entMan = server.ResolveDependency<IServerEntityManager>();
|
||||
|
||||
await pair.RunTicksSync(5);
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<MindSystem>();
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<SharedMindSystem>();
|
||||
var originalMind = GetMind(pair);
|
||||
var userId = originalMind.Comp.UserId;
|
||||
|
||||
@@ -269,8 +270,8 @@ public sealed partial class MindTests
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<MindSystem>();
|
||||
var roleSystem = entMan.EntitySysManager.GetEntitySystem<RoleSystem>();
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<SharedMindSystem>();
|
||||
var roleSystem = entMan.EntitySysManager.GetEntitySystem<SharedRoleSystem>();
|
||||
|
||||
var entity = entMan.SpawnEntity(null, new MapCoordinates());
|
||||
var mindComp = entMan.EnsureComponent<MindContainerComponent>(entity);
|
||||
@@ -339,7 +340,7 @@ public sealed partial class MindTests
|
||||
var entMan = server.ResolveDependency<IServerEntityManager>();
|
||||
var playerMan = server.ResolveDependency<IPlayerManager>();
|
||||
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<MindSystem>();
|
||||
var mindSystem = entMan.EntitySysManager.GetEntitySystem<SharedMindSystem>();
|
||||
var ghostSystem = entMan.EntitySysManager.GetEntitySystem<GhostSystem>();
|
||||
|
||||
EntityUid entity = default!;
|
||||
|
||||
@@ -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!");
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Linq;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Ame.Components;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.NodeContainer;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Ame;
|
||||
@@ -11,6 +10,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -4,12 +4,12 @@ using Content.Server.Body.Components;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Server.Kitchen.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Body.Organ;
|
||||
using Content.Shared.Body.Part;
|
||||
using Content.Shared.Body.Systems;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Random.Helpers;
|
||||
@@ -28,7 +28,7 @@ public sealed class BodySystem : SharedBodySystem
|
||||
[Dependency] private readonly HumanoidAppearanceSystem _humanoidSystem = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Ghost.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Body.Events;
|
||||
using Content.Shared.Body.Organ;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Systems;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Server.Body.Systems
|
||||
public sealed class BrainSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeed = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
@@ -27,7 +27,7 @@ namespace Content.Server.Chat.Commands
|
||||
if (player.Status != SessionStatus.InGame || player.AttachedEntity == null)
|
||||
return;
|
||||
|
||||
var minds = IoCManager.Resolve<IEntityManager>().System<MindSystem>();
|
||||
var minds = IoCManager.Resolve<IEntityManager>().System<SharedMindSystem>();
|
||||
// This check also proves mind not-null for at the end when the mob is ghosted.
|
||||
if (!minds.TryGetMind(player, out var mindId, out var mind) ||
|
||||
mind.OwnedEntity is not { Valid: true } victim)
|
||||
|
||||
@@ -2,17 +2,18 @@ using System.Linq;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Server.Administration.Systems;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.MoMMI;
|
||||
using Content.Server.Preferences.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Replays;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -84,7 +85,7 @@ namespace Content.Server.Chat.Managers
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Server announcement: {message}");
|
||||
}
|
||||
|
||||
public void DispatchServerMessage(IPlayerSession player, string message, bool suppressLog = false)
|
||||
public void DispatchServerMessage(ICommonSession player, string message, bool suppressLog = false)
|
||||
{
|
||||
var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", FormattedMessage.EscapeText(message)));
|
||||
ChatMessageToOne(ChatChannel.Server, message, wrappedMessage, default, false, player.ConnectedClient);
|
||||
@@ -116,7 +117,7 @@ namespace Content.Server.Chat.Managers
|
||||
|
||||
public void SendAdminAlert(EntityUid player, string message)
|
||||
{
|
||||
var mindSystem = _entityManager.System<MindSystem>();
|
||||
var mindSystem = _entityManager.System<SharedMindSystem>();
|
||||
if (!mindSystem.TryGetMind(player, out var mindId, out var mind))
|
||||
{
|
||||
SendAdminAlert(message);
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Shared.Chat;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Players;
|
||||
|
||||
namespace Content.Server.Chat.Managers
|
||||
{
|
||||
@@ -16,7 +17,7 @@ namespace Content.Server.Chat.Managers
|
||||
/// <param name="colorOverride">Override the color of the message being sent.</param>
|
||||
void DispatchServerAnnouncement(string message, Color? colorOverride = null);
|
||||
|
||||
void DispatchServerMessage(IPlayerSession player, string message, bool suppressLog = false);
|
||||
void DispatchServerMessage(ICommonSession player, string message, bool suppressLog = false);
|
||||
|
||||
void TrySendOOCMessage(IPlayerSession player, string message, OOCChatType type);
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using Content.Server.Ghost.Roles.Components;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Speech.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Server.Ghost.Roles.Components;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Chemistry.ReagentEffects;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Polymorph.Components;
|
||||
using Content.Server.Polymorph.Systems;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Polymorph;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Cloning;
|
||||
using Content.Shared.Eui;
|
||||
using Content.Shared.Mind;
|
||||
|
||||
namespace Content.Server.Cloning
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@ using Content.Server.Administration.Logs;
|
||||
using Content.Server.Cloning.Components;
|
||||
using Content.Server.DeviceLinking.Systems;
|
||||
using Content.Server.Medical.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Server.UserInterface;
|
||||
@@ -13,6 +12,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.DeviceLinking;
|
||||
using Content.Shared.DeviceLinking.Events;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using JetBrains.Annotations;
|
||||
@@ -31,7 +31,7 @@ namespace Content.Server.Cloning
|
||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||
[Dependency] private readonly PowerReceiverSystem _powerReceiverSystem = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -8,11 +8,8 @@ using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Server.Jobs;
|
||||
using Content.Server.Materials;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Server.Roles.Jobs;
|
||||
using Content.Server.Traits.Assorted;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.CCVar;
|
||||
@@ -26,7 +23,10 @@ using Content.Shared.Examine;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Humanoid.Prototypes;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
@@ -59,9 +59,9 @@ namespace Content.Server.Cloning
|
||||
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
||||
[Dependency] private readonly MaterialStorageSystem _material = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
|
||||
[Dependency] private readonly JobSystem _jobs = default!;
|
||||
[Dependency] private readonly SharedJobSystem _jobs = default!;
|
||||
|
||||
public readonly Dictionary<MindComponent, EntityUid> ClonesWaitingForMind = new();
|
||||
public const float EasyModeCloningCost = 0.7f;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Mind;
|
||||
|
||||
namespace Content.Server.Cloning.Components
|
||||
{
|
||||
|
||||
@@ -25,5 +25,8 @@
|
||||
<ProjectReference Include="..\RobustToolbox\Robust.Server\Robust.Server.csproj" />
|
||||
<ProjectReference Include="..\Content.Shared\Content.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Objectives\Interfaces\" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
|
||||
</Project>
|
||||
|
||||
@@ -13,6 +13,7 @@ using Content.Shared.StationRecords;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Players;
|
||||
|
||||
namespace Content.Server.CrewManifest;
|
||||
|
||||
@@ -30,7 +31,7 @@ public sealed class CrewManifestSystem : EntitySystem
|
||||
/// </summary>
|
||||
private readonly Dictionary<EntityUid, CrewManifestEntries> _cachedEntries = new();
|
||||
|
||||
private readonly Dictionary<EntityUid, Dictionary<IPlayerSession, CrewManifestEui>> _openEuis = new();
|
||||
private readonly Dictionary<EntityUid, Dictionary<ICommonSession, CrewManifestEui>> _openEuis = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -168,7 +169,7 @@ public sealed class CrewManifestSystem : EntitySystem
|
||||
/// <param name="station">Station that we're displaying the crew manifest for.</param>
|
||||
/// <param name="session">The player's session.</param>
|
||||
/// <param name="owner">The owner of this EUI, if there was one.</param>
|
||||
public void CloseEui(EntityUid station, IPlayerSession session, EntityUid? owner = null)
|
||||
public void CloseEui(EntityUid station, ICommonSession session, EntityUid? owner = null)
|
||||
{
|
||||
if (!HasComp<StationRecordsComponent>(station))
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Drone.Components;
|
||||
using Content.Server.Ghost.Roles.Components;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Tools.Innate;
|
||||
using Content.Server.UserInterface;
|
||||
@@ -14,14 +13,13 @@ using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction.Components;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server.Drone
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Content.Shared.Eui;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
using Robust.Shared.Players;
|
||||
|
||||
namespace Content.Server.EUI
|
||||
{
|
||||
@@ -23,7 +22,7 @@ namespace Content.Server.EUI
|
||||
/// <summary>
|
||||
/// The player that this EUI is open for.
|
||||
/// </summary>
|
||||
public IPlayerSession Player { get; private set; } = default!;
|
||||
public ICommonSession Player { get; private set; } = default!;
|
||||
public bool IsShutDown { get; private set; }
|
||||
public EuiManager Manager { get; private set; } = default!;
|
||||
public uint Id { get; private set; }
|
||||
@@ -118,7 +117,7 @@ namespace Content.Server.EUI
|
||||
netMgr.ServerSendMessage(msg, Player.ConnectedClient);
|
||||
}
|
||||
|
||||
internal void Initialize(EuiManager manager, IPlayerSession player, uint id)
|
||||
internal void Initialize(EuiManager manager, ICommonSession player, uint id)
|
||||
{
|
||||
Manager = manager;
|
||||
Player = player;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
|
||||
namespace Content.Server.EUI
|
||||
{
|
||||
public sealed class EuiManager : IPostInjectInit
|
||||
@@ -12,11 +12,11 @@ namespace Content.Server.EUI
|
||||
[Dependency] private readonly IPlayerManager _players = default!;
|
||||
[Dependency] private readonly IServerNetManager _net = default!;
|
||||
|
||||
private readonly Dictionary<IPlayerSession, PlayerEuiData> _playerData =
|
||||
private readonly Dictionary<ICommonSession, PlayerEuiData> _playerData =
|
||||
new();
|
||||
|
||||
private readonly Queue<(IPlayerSession player, uint id)> _stateUpdateQueue =
|
||||
new Queue<(IPlayerSession, uint id)>();
|
||||
private readonly Queue<(ICommonSession player, uint id)> _stateUpdateQueue =
|
||||
new Queue<(ICommonSession, uint id)>();
|
||||
|
||||
private sealed class PlayerEuiData
|
||||
{
|
||||
@@ -53,7 +53,7 @@ namespace Content.Server.EUI
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenEui(BaseEui eui, IPlayerSession player)
|
||||
public void OpenEui(BaseEui eui, ICommonSession player)
|
||||
{
|
||||
if (eui.Id != 0)
|
||||
{
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Server.Explosion.Components;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Explosion;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Spawners.Components;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Players;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Network;
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.GameTicking.Commands
|
||||
var playerMgr = IoCManager.Resolve<IPlayerManager>();
|
||||
var sysMan = IoCManager.Resolve<IEntitySystemManager>();
|
||||
var ticker = sysMan.GetEntitySystem<GameTicker>();
|
||||
var mind = sysMan.GetEntitySystem<MindSystem>();
|
||||
var mind = sysMan.GetEntitySystem<SharedMindSystem>();
|
||||
|
||||
NetUserId userId;
|
||||
if (args.Length == 0)
|
||||
|
||||
@@ -3,12 +3,12 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameTicking.Presets;
|
||||
using Content.Server.Maps;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
@@ -214,7 +214,7 @@ namespace Content.Server.GameTicking
|
||||
{
|
||||
if (mind.Session != null) // Logging is suppressed to prevent spam from ghost attempts caused by movement attempts
|
||||
{
|
||||
_chatManager.DispatchServerMessage(mind.Session, Loc.GetString("comp-mind-ghosting-prevented"),
|
||||
_chatManager.DispatchServerMessage((IPlayerSession) mind.Session, Loc.GetString("comp-mind-ghosting-prevented"),
|
||||
true);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Database;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.GameWindow;
|
||||
using Content.Shared.Players;
|
||||
using Content.Shared.Preferences;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
|
||||
@@ -4,10 +4,10 @@ using Content.Server.Discord;
|
||||
using Content.Server.GameTicking.Events;
|
||||
using Content.Server.Ghost;
|
||||
using Content.Server.Maps;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Players;
|
||||
using Content.Shared.Preferences;
|
||||
using JetBrains.Annotations;
|
||||
using Prometheus;
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Numerics;
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Server.Ghost;
|
||||
using Content.Server.Players;
|
||||
using Content.Server.Roles.Jobs;
|
||||
using Content.Server.Spawners.Components;
|
||||
using Content.Server.Speech.Components;
|
||||
using Content.Server.Station.Components;
|
||||
@@ -12,6 +11,7 @@ using Content.Shared.CCVar;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Roles;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Map;
|
||||
@@ -25,7 +25,7 @@ namespace Content.Server.GameTicking
|
||||
public sealed partial class GameTicker
|
||||
{
|
||||
[Dependency] private readonly IAdminManager _adminManager = default!;
|
||||
[Dependency] private readonly JobSystem _jobs = default!;
|
||||
[Dependency] private readonly SharedJobSystem _jobs = default!;
|
||||
|
||||
[ValidatePrototypeId<EntityPrototype>]
|
||||
private const string ObserverPrototypeName = "MobObserver";
|
||||
|
||||
@@ -5,16 +5,15 @@ using Content.Server.Chat.Systems;
|
||||
using Content.Server.Database;
|
||||
using Content.Server.Ghost;
|
||||
using Content.Server.Maps;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Players.PlayTimeTracking;
|
||||
using Content.Server.Preferences.Managers;
|
||||
using Content.Server.Roles;
|
||||
using Content.Server.ServerUpdates;
|
||||
using Content.Server.Shuttles.Systems;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server;
|
||||
@@ -57,7 +56,7 @@ namespace Content.Server.GameTicking
|
||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
[Dependency] private readonly MapLoaderSystem _map = default!;
|
||||
[Dependency] private readonly GhostSystem _ghost = default!;
|
||||
[Dependency] private readonly MindSystem _mind = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mind = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly PlayTimeTrackingSystem _playTimeTrackings = default!;
|
||||
[Dependency] private readonly PvsOverrideSystem _pvsOverride = default!;
|
||||
@@ -67,7 +66,7 @@ namespace Content.Server.GameTicking
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly UserDbDataManager _userDb = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
[Dependency] private readonly RoleSystem _roles = default!;
|
||||
[Dependency] private readonly SharedRoleSystem _roles = default!;
|
||||
|
||||
[ViewVariables] private bool _initialized;
|
||||
[ViewVariables] private bool _postInitialized;
|
||||
|
||||
@@ -2,8 +2,8 @@ using Content.Server.NPC.Components;
|
||||
using Content.Server.StationEvents.Events;
|
||||
using Content.Shared.Dataset;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
@@ -158,7 +158,7 @@ public sealed partial class NukeopsRuleComponent : Component
|
||||
/// </summary>
|
||||
/// todo: don't store sessions, dingus
|
||||
[DataField("operativePlayers")]
|
||||
public Dictionary<string, IPlayerSession> OperativePlayers = new();
|
||||
public Dictionary<string, ICommonSession> OperativePlayers = new();
|
||||
|
||||
[DataField("faction", customTypeSerializer: typeof(PrototypeIdSerializer<NpcFactionPrototype>), required: true)]
|
||||
public string Faction = default!;
|
||||
|
||||
@@ -10,7 +10,6 @@ using Content.Server.Ghost.Roles.Components;
|
||||
using Content.Server.Ghost.Roles.Events;
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.NPC.Components;
|
||||
using Content.Server.NPC.Systems;
|
||||
using Content.Server.Nuke;
|
||||
@@ -30,6 +29,8 @@ using Content.Server.Store.Systems;
|
||||
using Content.Shared.Dataset;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Humanoid.Prototypes;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Nuke;
|
||||
@@ -69,7 +70,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
|
||||
[Dependency] private readonly MapLoaderSystem _map = default!;
|
||||
[Dependency] private readonly ShuttleSystem _shuttle = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly RoleSystem _roles = default!;
|
||||
[Dependency] private readonly SharedRoleSystem _roles = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly ChatSystem _chatSystem = default!;
|
||||
|
||||
@@ -4,13 +4,13 @@ using Content.Server.Administration.Commands;
|
||||
using Content.Server.Cargo.Systems;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Preferences.Managers;
|
||||
using Content.Server.Spawners.Components;
|
||||
using Content.Server.Station.Components;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -40,7 +40,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem<PiratesRuleComponent>
|
||||
[Dependency] private readonly PricingSystem _pricingSystem = default!;
|
||||
[Dependency] private readonly MapLoaderSystem _map = default!;
|
||||
[Dependency] private readonly NamingSystem _namingSystem = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Mind.Toolshed;
|
||||
using Content.Server.Players;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
|
||||
@@ -6,17 +6,19 @@ using Content.Server.NPC.Systems;
|
||||
using Content.Server.Objectives;
|
||||
using Content.Server.PDA.Ringer;
|
||||
using Content.Server.Roles;
|
||||
using Content.Server.Roles.Jobs;
|
||||
using Content.Server.Shuttles.Components;
|
||||
using Content.Server.Traitor.Uplink;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Dataset;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.PDA;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Roles;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -30,14 +32,13 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
[Dependency] private readonly IChatManager _chatManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IComponentFactory _component = default!;
|
||||
[Dependency] private readonly NpcFactionSystem _npcFaction = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||
[Dependency] private readonly UplinkSystem _uplink = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly RoleSystem _roleSystem = default!;
|
||||
[Dependency] private readonly JobSystem _jobs = default!;
|
||||
[Dependency] private readonly SharedRoleSystem _roleSystem = default!;
|
||||
[Dependency] private readonly SharedJobSystem _jobs = default!;
|
||||
[Dependency] private readonly ObjectivesSystem _objectives = default!;
|
||||
|
||||
private int PlayersPerTraitor => _cfg.GetCVar(CCVars.TraitorPlayersPerTraitor);
|
||||
@@ -202,7 +203,7 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
|
||||
return results;
|
||||
}
|
||||
|
||||
public bool MakeTraitor(IPlayerSession traitor)
|
||||
public bool MakeTraitor(ICommonSession traitor)
|
||||
{
|
||||
var traitorRule = EntityQuery<TraitorRuleComponent>().FirstOrDefault();
|
||||
if (traitorRule == null)
|
||||
|
||||
@@ -4,7 +4,6 @@ using Content.Server.Actions;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Preferences.Managers;
|
||||
using Content.Server.Roles;
|
||||
@@ -15,10 +14,12 @@ using Content.Server.Zombies;
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Roles;
|
||||
using Content.Shared.Zombies;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
@@ -44,8 +45,8 @@ public sealed class ZombieRuleSystem : GameRuleSystem<ZombieRuleComponent>
|
||||
[Dependency] private readonly ActionsSystem _action = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly ZombieSystem _zombie = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly RoleSystem _roles = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedRoleSystem _roles = default!;
|
||||
[Dependency] private readonly StationSystem _station = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.Ghost
|
||||
return;
|
||||
}
|
||||
|
||||
var minds = _entities.System<MindSystem>();
|
||||
var minds = _entities.System<SharedMindSystem>();
|
||||
if (!minds.TryGetMind(player, out var mindId, out var mind))
|
||||
{
|
||||
shell.WriteLine("You have no Mind, you can't ghost.");
|
||||
|
||||
@@ -2,9 +2,6 @@ using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Ghost.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Roles.Jobs;
|
||||
using Content.Server.Visible;
|
||||
using Content.Server.Warps;
|
||||
using Content.Shared.Actions;
|
||||
@@ -12,9 +9,12 @@ using Content.Shared.Administration;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Follower;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
@@ -30,15 +30,15 @@ namespace Content.Server.Ghost
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly GameTicker _ticker = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _actions = default!;
|
||||
[Dependency] private readonly VisibilitySystem _visibilitySystem = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly FollowerSystem _followerSystem = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly MindSystem _minds = default!;
|
||||
[Dependency] private readonly JobSystem _jobs = default!;
|
||||
[Dependency] private readonly SharedMindSystem _minds = default!;
|
||||
[Dependency] private readonly SharedJobSystem _jobs = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Eui;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Mind;
|
||||
|
||||
namespace Content.Server.Ghost;
|
||||
|
||||
public sealed class ReturnToBodyEui : BaseEui
|
||||
{
|
||||
private readonly MindSystem _mindSystem;
|
||||
private readonly SharedMindSystem _mindSystem;
|
||||
|
||||
private readonly MindComponent _mind;
|
||||
|
||||
public ReturnToBodyEui(MindComponent mind, MindSystem mindSystem)
|
||||
public ReturnToBodyEui(MindComponent mind, SharedMindSystem mindSystem)
|
||||
{
|
||||
_mind = mind;
|
||||
_mindSystem = mindSystem;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Players;
|
||||
|
||||
namespace Content.Server.Ghost.Roles.Components;
|
||||
|
||||
[ByRefEvent]
|
||||
public record struct TakeGhostRoleEvent(IPlayerSession Player)
|
||||
public record struct TakeGhostRoleEvent(ICommonSession Player)
|
||||
{
|
||||
public bool TookRole { get; set; }
|
||||
}
|
||||
|
||||
@@ -3,23 +3,24 @@ using Content.Server.EUI;
|
||||
using Content.Server.Ghost.Roles.Components;
|
||||
using Content.Server.Ghost.Roles.Events;
|
||||
using Content.Server.Ghost.Roles.UI;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Commands;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Players;
|
||||
using Content.Server.Roles;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Follower;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Roles;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Roles;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -34,14 +35,14 @@ namespace Content.Server.Ghost.Roles
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly FollowerSystem _followerSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly RoleSystem _roleSystem = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedRoleSystem _roleSystem = default!;
|
||||
|
||||
private uint _nextRoleIdentifier;
|
||||
private bool _needsUpdateGhostRoleCount = true;
|
||||
private readonly Dictionary<uint, GhostRoleComponent> _ghostRoles = new();
|
||||
private readonly Dictionary<IPlayerSession, GhostRolesEui> _openUis = new();
|
||||
private readonly Dictionary<IPlayerSession, MakeGhostRoleEui> _openMakeGhostRoleUis = new();
|
||||
private readonly Dictionary<ICommonSession, GhostRolesEui> _openUis = new();
|
||||
private readonly Dictionary<ICommonSession, MakeGhostRoleEui> _openMakeGhostRoleUis = new();
|
||||
|
||||
[ViewVariables]
|
||||
public IReadOnlyCollection<GhostRoleComponent> GhostRoles => _ghostRoles.Values;
|
||||
@@ -123,7 +124,7 @@ namespace Content.Server.Ghost.Roles
|
||||
eui.StateDirty();
|
||||
}
|
||||
|
||||
public void CloseEui(IPlayerSession session)
|
||||
public void CloseEui(ICommonSession session)
|
||||
{
|
||||
if (!_openUis.ContainsKey(session)) return;
|
||||
|
||||
@@ -132,7 +133,7 @@ namespace Content.Server.Ghost.Roles
|
||||
eui?.Close();
|
||||
}
|
||||
|
||||
public void CloseMakeGhostRoleEui(IPlayerSession session)
|
||||
public void CloseMakeGhostRoleEui(ICommonSession session)
|
||||
{
|
||||
if (_openMakeGhostRoleUis.Remove(session, out var eui))
|
||||
{
|
||||
@@ -190,7 +191,7 @@ namespace Content.Server.Ghost.Roles
|
||||
UpdateAllEui();
|
||||
}
|
||||
|
||||
public void Takeover(IPlayerSession player, uint identifier)
|
||||
public void Takeover(ICommonSession player, uint identifier)
|
||||
{
|
||||
if (!_ghostRoles.TryGetValue(identifier, out var role)) return;
|
||||
|
||||
@@ -205,7 +206,7 @@ namespace Content.Server.Ghost.Roles
|
||||
CloseEui(player);
|
||||
}
|
||||
|
||||
public void Follow(IPlayerSession player, uint identifier)
|
||||
public void Follow(ICommonSession player, uint identifier)
|
||||
{
|
||||
if (!_ghostRoles.TryGetValue(identifier, out var role)) return;
|
||||
if (player.AttachedEntity == null) return;
|
||||
@@ -213,7 +214,7 @@ namespace Content.Server.Ghost.Roles
|
||||
_followerSystem.StartFollowingEntity(player.AttachedEntity.Value, role.Owner);
|
||||
}
|
||||
|
||||
public void GhostRoleInternalCreateMindAndTransfer(IPlayerSession player, EntityUid roleUid, EntityUid mob, GhostRoleComponent? role = null)
|
||||
public void GhostRoleInternalCreateMindAndTransfer(ICommonSession player, EntityUid roleUid, EntityUid mob, GhostRoleComponent? role = null)
|
||||
{
|
||||
if (!Resolve(roleUid, ref role)) return;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Ghost.Roles.Components;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Ghost.Roles
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
using Content.Server.Ghost.Roles.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.PAI;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Verbs;
|
||||
|
||||
@@ -17,7 +16,7 @@ public sealed class ToggleableGhostRoleSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly MindSystem _mind = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mind = default!;
|
||||
//todo this really shouldn't be in here but this system was converted from PAIs
|
||||
[Dependency] private readonly PAISystem _pai = default!;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Server.Hands.Systems;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Storage;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Content.Server.Light.Events;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Decals;
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.Light;
|
||||
using Content.Shared.Light.Component;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Toggleable;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -4,7 +4,6 @@ using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Server.Construction;
|
||||
using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Nutrition.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Power.Components;
|
||||
@@ -17,6 +16,7 @@ using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Materials;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -34,7 +34,7 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
|
||||
[Dependency] private readonly SharedBodySystem _body = default!; //bobby
|
||||
[Dependency] private readonly PuddleSystem _puddle = default!;
|
||||
[Dependency] private readonly StackSystem _stack = default!;
|
||||
[Dependency] private readonly MindSystem _mind = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mind = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
|
||||
@@ -4,7 +4,6 @@ using Content.Server.Climbing;
|
||||
using Content.Server.Construction;
|
||||
using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Server.Materials;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Audio;
|
||||
@@ -18,6 +17,7 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Jittering;
|
||||
using Content.Shared.Medical;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
@@ -45,7 +45,7 @@ namespace Content.Server.Medical.BiomassReclaimer
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly MaterialStorageSystem _material = default!;
|
||||
[Dependency] private readonly MindSystem _minds = default!;
|
||||
[Dependency] private readonly SharedMindSystem _minds = default!;
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@ using Content.Server.DoAfter;
|
||||
using Content.Server.Electrocution;
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.Ghost;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.PowerCell;
|
||||
using Content.Shared.Damage;
|
||||
@@ -13,12 +12,13 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Components;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Medical;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Timing;
|
||||
using Content.Shared.Toggleable;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server.Medical;
|
||||
@@ -42,7 +42,7 @@ public sealed class DefibrillatorSystem : EntitySystem
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly UseDelaySystem _useDelay = default!;
|
||||
[Dependency] private readonly MindSystem _mind = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mind = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
@@ -208,7 +208,7 @@ public sealed class DefibrillatorSystem : EntitySystem
|
||||
component.NextZapTime = _timing.CurTime + component.ZapDelay;
|
||||
_appearance.SetData(uid, DefibrillatorVisuals.Ready, false);
|
||||
|
||||
IPlayerSession? session = null;
|
||||
ICommonSession? session = null;
|
||||
|
||||
if (_rotting.IsRotten(target))
|
||||
{
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.NPC.Components;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Emoting;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Speech;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using System.Text;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Roles;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -31,7 +32,7 @@ namespace Content.Server.Mind.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
var minds = _entities.System<MindSystem>();
|
||||
var minds = _entities.System<SharedMindSystem>();
|
||||
if (!minds.TryGetMind(session, out var mindId, out var mind))
|
||||
{
|
||||
shell.WriteLine("Can't find that mind");
|
||||
@@ -41,7 +42,7 @@ namespace Content.Server.Mind.Commands
|
||||
var builder = new StringBuilder();
|
||||
builder.AppendFormat("player: {0}, mob: {1}\nroles: ", mind.UserId, mind.OwnedEntity);
|
||||
|
||||
var roles = _entities.System<RoleSystem>();
|
||||
var roles = _entities.System<SharedRoleSystem>();
|
||||
foreach (var role in roles.MindGetAllRoles(mindId))
|
||||
{
|
||||
builder.AppendFormat("{0} ", role.Name);
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.PDA;
|
||||
using Content.Server.StationRecords.Systems;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.PDA;
|
||||
using Content.Shared.StationRecords;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -45,7 +46,7 @@ public sealed class RenameCommand : IConsoleCommand
|
||||
var oldName = metadata.EntityName;
|
||||
entMan.System<MetaDataSystem>().SetEntityName(entityUid, name, metadata);
|
||||
|
||||
var minds = entMan.System<MindSystem>();
|
||||
var minds = entMan.System<SharedMindSystem>();
|
||||
|
||||
if (minds.TryGetMind(entityUid, out var mindId, out var mind))
|
||||
{
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Ghost;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Objectives;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Players;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Map;
|
||||
@@ -21,90 +15,22 @@ using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Mind;
|
||||
|
||||
public sealed class MindSystem : EntitySystem
|
||||
public sealed class MindSystem : SharedMindSystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly GameTicker _gameTicker = default!;
|
||||
[Dependency] private readonly ActorSystem _actor = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||
[Dependency] private readonly GhostSystem _ghostSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly GameTicker _gameTicker = default!;
|
||||
[Dependency] private readonly SharedGhostSystem _ghosts = default!;
|
||||
[Dependency] private readonly IMapManager _maps = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
|
||||
// This is dictionary is required to track the minds of disconnected players that may have had their entity deleted.
|
||||
private readonly Dictionary<NetUserId, EntityUid> _userMinds = new();
|
||||
[Dependency] private readonly IPlayerManager _players = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<MindContainerComponent, ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<MindContainerComponent, SuicideEvent>(OnSuicide);
|
||||
SubscribeLocalEvent<MindContainerComponent, EntityTerminatingEvent>(OnMindContainerTerminating);
|
||||
SubscribeLocalEvent<VisitingMindComponent, EntityTerminatingEvent>(OnVisitingTerminating);
|
||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnReset);
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
WipeAllMinds();
|
||||
}
|
||||
|
||||
private void OnReset(RoundRestartCleanupEvent ev)
|
||||
{
|
||||
WipeAllMinds();
|
||||
}
|
||||
|
||||
public void WipeAllMinds()
|
||||
{
|
||||
foreach (var mind in _userMinds.Values)
|
||||
{
|
||||
WipeMind(mind);
|
||||
}
|
||||
DebugTools.Assert(_userMinds.Count == 0);
|
||||
|
||||
foreach (var unCastData in _playerManager.GetAllPlayerData())
|
||||
{
|
||||
if (unCastData.ContentData()?.Mind is not { } mind)
|
||||
continue;
|
||||
|
||||
Log.Error("Player mind was missing from MindSystem dictionary.");
|
||||
WipeMind(mind);
|
||||
}
|
||||
}
|
||||
|
||||
public EntityUid? GetMind(NetUserId user)
|
||||
{
|
||||
TryGetMind(user, out var mind, out _);
|
||||
return mind;
|
||||
}
|
||||
|
||||
public bool TryGetMind(NetUserId user, [NotNullWhen(true)] out EntityUid? mindId, [NotNullWhen(true)] out MindComponent? mind)
|
||||
{
|
||||
if (_userMinds.TryGetValue(user, out var mindIdValue) &&
|
||||
TryComp(mindIdValue, out mind))
|
||||
{
|
||||
DebugTools.Assert(mind.UserId == user);
|
||||
DebugTools.Assert(_playerManager.GetPlayerData(user).ContentData() is not {} data
|
||||
|| data.Mind == mindIdValue);
|
||||
|
||||
mindId = mindIdValue;
|
||||
return true;
|
||||
}
|
||||
|
||||
DebugTools.Assert(_playerManager.GetPlayerData(user).ContentData()?.Mind == null);
|
||||
mindId = null;
|
||||
mind = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void OnVisitingTerminating(EntityUid uid, VisitingMindComponent component, ref EntityTerminatingEvent args)
|
||||
{
|
||||
if (component.MindId != null)
|
||||
UnVisit(component.MindId.Value);
|
||||
}
|
||||
|
||||
private void OnMindContainerTerminating(EntityUid uid, MindContainerComponent component, ref EntityTerminatingEvent args)
|
||||
@@ -124,7 +50,7 @@ public sealed class MindSystem : EntitySystem
|
||||
{
|
||||
TransferTo(mindId, visiting, mind: mind);
|
||||
if (TryComp(visiting, out GhostComponent? ghost))
|
||||
_ghostSystem.SetCanReturnToBody(ghost, false);
|
||||
_ghosts.SetCanReturnToBody(ghost, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -144,7 +70,7 @@ public sealed class MindSystem : EntitySystem
|
||||
return;
|
||||
|
||||
// Async this so that we don't throw if the grid we're on is being deleted.
|
||||
if (!_mapManager.GridExists(gridId))
|
||||
if (!_maps.GridExists(gridId))
|
||||
spawnPosition = _gameTicker.GetObserverSpawnPoint();
|
||||
|
||||
// TODO refactor observer spawning.
|
||||
@@ -159,7 +85,7 @@ public sealed class MindSystem : EntitySystem
|
||||
|
||||
var ghost = Spawn("MobObserver", spawnPosition);
|
||||
var ghostComponent = Comp<GhostComponent>(ghost);
|
||||
_ghostSystem.SetCanReturnToBody(ghostComponent, false);
|
||||
_ghosts.SetCanReturnToBody(ghostComponent, false);
|
||||
|
||||
// Log these to make sure they're not causing the GameTicker round restart bugs...
|
||||
Log.Debug($"Entity \"{ToPrettyString(uid)}\" for {mind.CharacterName} was deleted, spawned \"{ToPrettyString(ghost)}\".");
|
||||
@@ -171,92 +97,52 @@ public sealed class MindSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, MindContainerComponent mindContainer, ExaminedEvent args)
|
||||
public override bool TryGetMind(NetUserId user, [NotNullWhen(true)] out EntityUid? mindId, [NotNullWhen(true)] out MindComponent? mind)
|
||||
{
|
||||
if (!mindContainer.ShowExamineInfo || !args.IsInDetailsRange)
|
||||
return;
|
||||
|
||||
var dead = _mobStateSystem.IsDead(uid);
|
||||
var hasSession = CompOrNull<MindComponent>(mindContainer.Mind)?.Session;
|
||||
|
||||
if (dead && !mindContainer.HasMind)
|
||||
args.PushMarkup($"[color=mediumpurple]{Loc.GetString("comp-mind-examined-dead-and-irrecoverable", ("ent", uid))}[/color]");
|
||||
else if (dead && hasSession == null)
|
||||
args.PushMarkup($"[color=yellow]{Loc.GetString("comp-mind-examined-dead-and-ssd", ("ent", uid))}[/color]");
|
||||
else if (dead)
|
||||
args.PushMarkup($"[color=red]{Loc.GetString("comp-mind-examined-dead", ("ent", uid))}[/color]");
|
||||
else if (!mindContainer.HasMind)
|
||||
args.PushMarkup($"[color=mediumpurple]{Loc.GetString("comp-mind-examined-catatonic", ("ent", uid))}[/color]");
|
||||
else if (hasSession == null)
|
||||
args.PushMarkup($"[color=yellow]{Loc.GetString("comp-mind-examined-ssd", ("ent", uid))}[/color]");
|
||||
}
|
||||
|
||||
private void OnSuicide(EntityUid uid, MindContainerComponent component, SuicideEvent args)
|
||||
if (base.TryGetMind(user, out mindId, out mind))
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
if (TryComp(component.Mind, out MindComponent? mind) && mind.PreventSuicide)
|
||||
{
|
||||
args.BlockSuicideAttempt(true);
|
||||
}
|
||||
}
|
||||
|
||||
public EntityUid? GetMind(EntityUid uid, MindContainerComponent? mind = null)
|
||||
{
|
||||
if (!Resolve(uid, ref mind))
|
||||
return null;
|
||||
|
||||
if (mind.HasMind)
|
||||
return mind.Mind;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public EntityUid CreateMind(NetUserId? userId, string? name = null)
|
||||
{
|
||||
var mindId = Spawn(null, MapCoordinates.Nullspace);
|
||||
var mind = EnsureComp<MindComponent>(mindId);
|
||||
mind.CharacterName = name;
|
||||
SetUserId(mindId, userId, mind);
|
||||
|
||||
Dirty(mindId, MetaData(mindId));
|
||||
|
||||
return mindId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if the OwnedEntity of this mind is physically dead.
|
||||
/// This specific definition, as opposed to CharacterDeadIC, is used to determine if ghosting should allow return.
|
||||
/// </summary>
|
||||
public bool IsCharacterDeadPhysically(MindComponent mind)
|
||||
{
|
||||
// This is written explicitly so that the logic can be understood.
|
||||
// But it's also weird and potentially situational.
|
||||
// Specific considerations when updating this:
|
||||
// + Does being turned into a borg (if/when implemented) count as dead?
|
||||
// *If not, add specific conditions to users of this property where applicable.*
|
||||
// + Is being transformed into a donut 'dead'?
|
||||
// TODO: Consider changing the way ghost roles work.
|
||||
// Mind is an *IC* mind, therefore ghost takeover is IC revival right now.
|
||||
// + Is it necessary to have a reference to a specific 'mind iteration' to cycle when certain events happen?
|
||||
// (If being a borg or AI counts as dead, then this is highly likely, as it's still the same Mind for practical purposes.)
|
||||
|
||||
if (mind.OwnedEntity == null)
|
||||
DebugTools.Assert(_players.GetPlayerData(user).ContentData() is not { } data || data.Mind == mindId);
|
||||
return true;
|
||||
|
||||
// This can be null if they're deleted (spike / brain nom)
|
||||
var targetMobState = EntityManager.GetComponentOrNull<MobStateComponent>(mind.OwnedEntity);
|
||||
// This can be null if it's a brain (this happens very often)
|
||||
// Brains are the result of gibbing so should definitely count as dead
|
||||
if (targetMobState == null)
|
||||
return true;
|
||||
// They might actually be alive.
|
||||
return _mobStateSystem.IsDead(mind.OwnedEntity.Value, targetMobState);
|
||||
}
|
||||
|
||||
public void Visit(EntityUid mindId, EntityUid entity, MindComponent? mind = null)
|
||||
DebugTools.Assert(_players.GetPlayerData(user).ContentData()?.Mind == null);
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetSession(EntityUid? mindId, [NotNullWhen(true)] out IPlayerSession? session)
|
||||
{
|
||||
session = null;
|
||||
return TryComp(mindId, out MindComponent? mind) && (session = (IPlayerSession?) mind.Session) != null;
|
||||
}
|
||||
|
||||
public IPlayerSession? GetSession(MindComponent mind)
|
||||
{
|
||||
return (IPlayerSession?) mind.Session;
|
||||
}
|
||||
|
||||
public bool TryGetSession(MindComponent mind, [NotNullWhen(true)] out IPlayerSession? session)
|
||||
{
|
||||
return (session = GetSession(mind)) != null;
|
||||
}
|
||||
|
||||
public override void WipeAllMinds()
|
||||
{
|
||||
base.WipeAllMinds();
|
||||
|
||||
foreach (var unCastData in _players.GetAllPlayerData())
|
||||
{
|
||||
if (unCastData.ContentData()?.Mind is not { } mind)
|
||||
continue;
|
||||
|
||||
Log.Error("Player mind was missing from MindSystem dictionary.");
|
||||
WipeMind(mind);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Visit(EntityUid mindId, EntityUid entity, MindComponent? mind = null)
|
||||
{
|
||||
base.Visit(mindId, entity, mind);
|
||||
|
||||
if (!Resolve(mindId, ref mind))
|
||||
return;
|
||||
|
||||
@@ -272,7 +158,7 @@ public sealed class MindSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
mind.Session?.AttachToEntity(entity);
|
||||
GetSession(mind)?.AttachToEntity(entity);
|
||||
mind.VisitingEntity = entity;
|
||||
|
||||
// EnsureComp instead of AddComp to deal with deferred deletions.
|
||||
@@ -281,11 +167,10 @@ public sealed class MindSystem : EntitySystem
|
||||
Log.Info($"Session {mind.Session?.Name} visiting entity {entity}.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the mind to its original entity.
|
||||
/// </summary>
|
||||
public void UnVisit(EntityUid mindId, MindComponent? mind = null)
|
||||
public override void UnVisit(EntityUid mindId, MindComponent? mind = null)
|
||||
{
|
||||
base.UnVisit(mindId, mind);
|
||||
|
||||
if (!Resolve(mindId, ref mind))
|
||||
return;
|
||||
|
||||
@@ -298,7 +183,7 @@ public sealed class MindSystem : EntitySystem
|
||||
return;
|
||||
|
||||
var owned = mind.OwnedEntity;
|
||||
mind.Session.AttachToEntity(owned);
|
||||
GetSession(mind)?.AttachToEntity(owned);
|
||||
|
||||
if (owned.HasValue)
|
||||
{
|
||||
@@ -307,74 +192,11 @@ public sealed class MindSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the mind to its original entity.
|
||||
/// </summary>
|
||||
public void UnVisit(IPlayerSession? player)
|
||||
public override void TransferTo(EntityUid mindId, EntityUid? entity, bool ghostCheckOverride = false, bool createGhost = true,
|
||||
MindComponent? mind = null)
|
||||
{
|
||||
if (player == null || !TryGetMind(player, out var mindId, out var mind))
|
||||
return;
|
||||
base.TransferTo(mindId, entity, ghostCheckOverride, createGhost, mind);
|
||||
|
||||
UnVisit(mindId, mind);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleans up the VisitingEntity.
|
||||
/// </summary>
|
||||
/// <param name="mind"></param>
|
||||
private void RemoveVisitingEntity(MindComponent mind)
|
||||
{
|
||||
if (mind.VisitingEntity == null)
|
||||
return;
|
||||
|
||||
var oldVisitingEnt = mind.VisitingEntity.Value;
|
||||
// Null this before removing the component to avoid any infinite loops.
|
||||
mind.VisitingEntity = null;
|
||||
|
||||
if (TryComp(oldVisitingEnt, out VisitingMindComponent? visitComp))
|
||||
{
|
||||
visitComp.MindId = null;
|
||||
RemCompDeferred(oldVisitingEnt, visitComp);
|
||||
}
|
||||
|
||||
RaiseLocalEvent(oldVisitingEnt, new MindUnvisitedMessage(), true);
|
||||
}
|
||||
|
||||
public void WipeMind(IPlayerSession player)
|
||||
{
|
||||
var mind = player.ContentData()?.Mind;
|
||||
DebugTools.Assert(GetMind(player.UserId) == mind);
|
||||
WipeMind(mind);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Detaches a mind from all entities and clears the user ID.
|
||||
/// </summary>
|
||||
public void WipeMind(EntityUid? mindId, MindComponent? mind = null)
|
||||
{
|
||||
if (mindId == null || !Resolve(mindId.Value, ref mind, false))
|
||||
return;
|
||||
|
||||
TransferTo(mindId.Value, null, mind: mind);
|
||||
SetUserId(mindId.Value, null, mind: mind);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transfer this mind's control over to a new entity.
|
||||
/// </summary>
|
||||
/// <param name="mindId">The mind to transfer</param>
|
||||
/// <param name="entity">
|
||||
/// The entity to control.
|
||||
/// Can be null, in which case it will simply detach the mind from any entity.
|
||||
/// </param>
|
||||
/// <param name="ghostCheckOverride">
|
||||
/// If true, skips ghost check for Visiting Entity
|
||||
/// </param>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown if <paramref name="entity"/> is already controlled by another player.
|
||||
/// </exception>
|
||||
public void TransferTo(EntityUid mindId, EntityUid? entity, bool ghostCheckOverride = false, bool createGhost = true, MindComponent? mind = null)
|
||||
{
|
||||
if (!Resolve(mindId, ref mind))
|
||||
return;
|
||||
|
||||
@@ -410,7 +232,7 @@ public sealed class MindSystem : EntitySystem
|
||||
|
||||
entity = Spawn("MobObserver", position);
|
||||
var ghostComponent = Comp<GhostComponent>(entity.Value);
|
||||
_ghostSystem.SetCanReturnToBody(ghostComponent, false);
|
||||
_ghosts.SetCanReturnToBody(ghostComponent, false);
|
||||
}
|
||||
|
||||
var oldComp = mind.OwnedComponent;
|
||||
@@ -440,10 +262,11 @@ public sealed class MindSystem : EntitySystem
|
||||
}
|
||||
|
||||
// Player is CURRENTLY connected.
|
||||
if (mind.Session != null && !alreadyAttached && mind.VisitingEntity == null)
|
||||
var session = GetSession(mind);
|
||||
if (session != null && !alreadyAttached && mind.VisitingEntity == null)
|
||||
{
|
||||
_actor.Attach(entity, mind.Session, true);
|
||||
Log.Info($"Session {mind.Session.Name} transferred to entity {entity}.");
|
||||
_actor.Attach(entity, session, true);
|
||||
Log.Info($"Session {session.Name} transferred to entity {entity}.");
|
||||
}
|
||||
|
||||
if (mind.OwnedComponent != null)
|
||||
@@ -454,127 +277,17 @@ public sealed class MindSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an objective to this mind.
|
||||
/// </summary>
|
||||
public bool TryAddObjective(EntityUid mindId, MindComponent mind, ObjectivePrototype objectivePrototype)
|
||||
public override void SetUserId(EntityUid mindId, NetUserId? userId, MindComponent? mind = null)
|
||||
{
|
||||
if (!objectivePrototype.CanBeAssigned(mindId, mind))
|
||||
return false;
|
||||
var objective = objectivePrototype.GetObjective(mindId, mind);
|
||||
if (mind.Objectives.Contains(objective))
|
||||
return false;
|
||||
base.SetUserId(mindId, userId, mind);
|
||||
|
||||
foreach (var condition in objective.Conditions)
|
||||
{
|
||||
_adminLogger.Add(LogType.Mind, LogImpact.Low, $"'{condition.Title}' added to mind of {MindOwnerLoggingString(mind)}");
|
||||
}
|
||||
|
||||
mind.Objectives.Add(objective);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes an objective to this mind.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the removal succeeded.</returns>
|
||||
public bool TryRemoveObjective(MindComponent mind, int index)
|
||||
{
|
||||
if (index < 0 || index >= mind.Objectives.Count)
|
||||
return false;
|
||||
|
||||
var objective = mind.Objectives[index];
|
||||
|
||||
foreach (var condition in objective.Conditions)
|
||||
{
|
||||
_adminLogger.Add(LogType.Mind, LogImpact.Low, $"'{condition.Title}' removed from the mind of {MindOwnerLoggingString(mind)}");
|
||||
}
|
||||
|
||||
mind.Objectives.Remove(objective);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryGetSession(EntityUid? mindId, [NotNullWhen(true)] out IPlayerSession? session)
|
||||
{
|
||||
session = null;
|
||||
return TryComp(mindId, out MindComponent? mind) && (session = mind.Session) != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a mind from uid and/or MindContainerComponent. Used for null checks.
|
||||
/// </summary>
|
||||
/// <param name="uid">Entity UID that owns the mind.</param>
|
||||
/// <param name="mindId">The mind id.</param>
|
||||
/// <param name="mind">The returned mind.</param>
|
||||
/// <param name="container">Mind component on <paramref name="uid"/> to get the mind from.</param>
|
||||
/// <returns>True if mind found. False if not.</returns>
|
||||
public bool TryGetMind(
|
||||
EntityUid uid,
|
||||
out EntityUid mindId,
|
||||
[NotNullWhen(true)] out MindComponent? mind,
|
||||
MindContainerComponent? container = null)
|
||||
{
|
||||
mindId = default;
|
||||
mind = null;
|
||||
|
||||
if (!Resolve(uid, ref container, false))
|
||||
return false;
|
||||
|
||||
if (!container.HasMind)
|
||||
return false;
|
||||
|
||||
mindId = container.Mind ?? default;
|
||||
return TryComp(mindId, out mind);
|
||||
}
|
||||
|
||||
public bool TryGetMind(
|
||||
PlayerData player,
|
||||
out EntityUid mindId,
|
||||
[NotNullWhen(true)] out MindComponent? mind)
|
||||
{
|
||||
mindId = player.Mind ?? default;
|
||||
return TryComp(mindId, out mind);
|
||||
}
|
||||
|
||||
public bool TryGetMind(
|
||||
IPlayerSession? player,
|
||||
out EntityUid mindId,
|
||||
[NotNullWhen(true)] out MindComponent? mind)
|
||||
{
|
||||
mindId = default;
|
||||
mind = null;
|
||||
return player?.ContentData() is { } data && TryGetMind(data, out mindId, out mind);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Mind's OwnedComponent and OwnedEntity
|
||||
/// </summary>
|
||||
/// <param name="mind">Mind to set OwnedComponent and OwnedEntity on</param>
|
||||
/// <param name="uid">Entity owned by <paramref name="mind"/></param>
|
||||
/// <param name="mindContainerComponent">MindContainerComponent owned by <paramref name="mind"/></param>
|
||||
private void SetOwnedEntity(MindComponent mind, EntityUid? uid, MindContainerComponent? mindContainerComponent)
|
||||
{
|
||||
if (uid != null)
|
||||
Resolve(uid.Value, ref mindContainerComponent);
|
||||
|
||||
mind.OwnedEntity = uid;
|
||||
mind.OwnedComponent = mindContainerComponent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Mind's UserId, Session, and updates the player's PlayerData. This should have no direct effect on the
|
||||
/// entity that any mind is connected to, except as a side effect of the fact that it may change a player's
|
||||
/// attached entity. E.g., ghosts get deleted.
|
||||
/// </summary>
|
||||
public void SetUserId(EntityUid mindId, NetUserId? userId, MindComponent? mind = null)
|
||||
{
|
||||
if (!Resolve(mindId, ref mind))
|
||||
return;
|
||||
|
||||
if (mind.UserId == userId)
|
||||
return;
|
||||
|
||||
if (userId != null && !_playerManager.TryGetPlayerData(userId.Value, out _))
|
||||
if (userId != null && !_players.TryGetPlayerData(userId.Value, out _))
|
||||
{
|
||||
Log.Error($"Attempted to set mind user to invalid value {userId}");
|
||||
return;
|
||||
@@ -582,14 +295,14 @@ public sealed class MindSystem : EntitySystem
|
||||
|
||||
if (mind.Session != null)
|
||||
{
|
||||
_actor.Attach(null, mind.Session);
|
||||
_actor.Attach(null, GetSession(mind)!);
|
||||
mind.Session = null;
|
||||
}
|
||||
|
||||
if (mind.UserId != null)
|
||||
{
|
||||
_userMinds.Remove(mind.UserId.Value);
|
||||
if (_playerManager.GetPlayerData(mind.UserId.Value).ContentData() is { } oldData)
|
||||
UserMinds.Remove(mind.UserId.Value);
|
||||
if (_players.GetPlayerData(mind.UserId.Value).ContentData() is { } oldData)
|
||||
oldData.Mind = null;
|
||||
mind.UserId = null;
|
||||
}
|
||||
@@ -600,71 +313,26 @@ public sealed class MindSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
if (_userMinds.TryGetValue(userId.Value, out var oldMindId) &&
|
||||
if (UserMinds.TryGetValue(userId.Value, out var oldMindId) &&
|
||||
TryComp(oldMindId, out MindComponent? oldMind))
|
||||
{
|
||||
SetUserId(oldMindId, null, oldMind);
|
||||
}
|
||||
|
||||
DebugTools.AssertNull(_playerManager.GetPlayerData(userId.Value).ContentData()?.Mind);
|
||||
DebugTools.AssertNull(_players.GetPlayerData(userId.Value).ContentData()?.Mind);
|
||||
|
||||
_userMinds[userId.Value] = mindId;
|
||||
UserMinds[userId.Value] = mindId;
|
||||
mind.UserId = userId;
|
||||
mind.OriginalOwnerUserId ??= userId;
|
||||
|
||||
if (_playerManager.TryGetSessionById(userId.Value, out var ret))
|
||||
if (_players.TryGetSessionById(userId.Value, out var ret))
|
||||
{
|
||||
mind.Session = ret;
|
||||
_actor.Attach(mind.CurrentEntity, mind.Session);
|
||||
_actor.Attach(mind.CurrentEntity, ret);
|
||||
}
|
||||
|
||||
// session may be null, but user data may still exist for disconnected players.
|
||||
if (_playerManager.GetPlayerData(userId.Value).ContentData() is { } data)
|
||||
if (_players.GetPlayerData(userId.Value).ContentData() is { } data)
|
||||
data.Mind = mindId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if this Mind is 'sufficiently dead' IC (Objectives, EndText).
|
||||
/// Note that this is *IC logic*, it's not necessarily tied to any specific truth.
|
||||
/// "If administrators decide that zombies are dead, this returns true for zombies."
|
||||
/// (Maybe you were looking for the action blocker system?)
|
||||
/// </summary>
|
||||
public bool IsCharacterDeadIc(MindComponent mind)
|
||||
{
|
||||
if (mind.OwnedEntity is { } owned)
|
||||
{
|
||||
var ev = new GetCharactedDeadIcEvent(null);
|
||||
RaiseLocalEvent(owned, ref ev);
|
||||
|
||||
if (ev.Dead != null)
|
||||
return ev.Dead.Value;
|
||||
}
|
||||
|
||||
return IsCharacterDeadPhysically(mind);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A string to represent the mind for logging
|
||||
/// </summary>
|
||||
public string MindOwnerLoggingString(MindComponent mind)
|
||||
{
|
||||
if (mind.OwnedEntity != null)
|
||||
return ToPrettyString(mind.OwnedEntity.Value);
|
||||
if (mind.UserId != null)
|
||||
return mind.UserId.Value.ToString();
|
||||
return "(originally " + mind.OriginalOwnerUserId + ")";
|
||||
}
|
||||
|
||||
public string? GetCharacterName(NetUserId userId)
|
||||
{
|
||||
return TryGetMind(userId, out _, out var mind) ? mind.CharacterName : null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raised on an entity to determine whether or not they are "dead" in IC-logic.
|
||||
/// If not handled, then it will simply check if they are dead physically.
|
||||
/// </summary>
|
||||
/// <param name="Dead"></param>
|
||||
[ByRefEvent]
|
||||
public record struct GetCharactedDeadIcEvent(bool? Dead);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Server.Player;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Toolshed;
|
||||
using Robust.Shared.Toolshed.Errors;
|
||||
using Robust.Shared.Toolshed.Syntax;
|
||||
@@ -11,19 +12,19 @@ namespace Content.Server.Mind.Toolshed;
|
||||
[ToolshedCommand]
|
||||
public sealed class MindCommand : ToolshedCommand
|
||||
{
|
||||
private MindSystem? _mind;
|
||||
private SharedMindSystem? _mind;
|
||||
|
||||
[CommandImplementation("get")]
|
||||
public MindComponent? Get([PipedArgument] IPlayerSession session)
|
||||
{
|
||||
_mind ??= GetSys<MindSystem>();
|
||||
_mind ??= GetSys<SharedMindSystem>();
|
||||
return _mind.TryGetMind(session, out _, out var mind) ? mind : null;
|
||||
}
|
||||
|
||||
[CommandImplementation("get")]
|
||||
public MindComponent? Get([PipedArgument] EntityUid ent)
|
||||
{
|
||||
_mind ??= GetSys<MindSystem>();
|
||||
_mind ??= GetSys<SharedMindSystem>();
|
||||
return _mind.TryGetMind(ent, out _, out var mind) ? mind : null;
|
||||
}
|
||||
|
||||
@@ -33,7 +34,7 @@ public sealed class MindCommand : ToolshedCommand
|
||||
[PipedArgument] EntityUid target,
|
||||
[CommandArgument] ValueRef<IPlayerSession> playerRef)
|
||||
{
|
||||
_mind ??= GetSys<MindSystem>();
|
||||
_mind ??= GetSys<SharedMindSystem>();
|
||||
|
||||
var player = playerRef.Evaluate(ctx);
|
||||
if (player is null)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -15,7 +16,7 @@ public sealed class TransferMindOnGibSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly TagSystem _tag = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Speech.Muting;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.GameObjects;
|
||||
using System;
|
||||
|
||||
namespace Content.Server.Mobs;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Morgue.Components;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Server.Storage.EntitySystems;
|
||||
@@ -7,6 +6,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Morgue;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Standing;
|
||||
@@ -26,7 +26,7 @@ public sealed class CrematoriumSystem : EntitySystem
|
||||
[Dependency] private readonly EntityStorageSystem _entityStorage = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly StandingStateSystem _standing = default!;
|
||||
[Dependency] private readonly MindSystem _minds = default!;
|
||||
[Dependency] private readonly SharedMindSystem _minds = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Interaction.Components;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Nutrition.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Nutrition.AnimalHusbandry;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Nutrition.EntitySystems;
|
||||
using Content.Shared.Storage;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Collections;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -30,7 +31,7 @@ namespace Content.Server.Objectives.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
var minds = _entityManager.System<MindSystem>();
|
||||
var minds = _entityManager.System<SharedMindSystem>();
|
||||
if (!minds.TryGetMind(data, out var mindId, out var mind))
|
||||
{
|
||||
shell.WriteLine("Can't find the mind.");
|
||||
@@ -44,7 +45,7 @@ namespace Content.Server.Objectives.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
var mindSystem = _entityManager.System<MindSystem>();
|
||||
var mindSystem = _entityManager.System<SharedMindSystem>();
|
||||
if (!mindSystem.TryAddObjective(mindId, mind, objectivePrototype))
|
||||
{
|
||||
shell.WriteLine("Objective requirements dont allow that objective to be added.");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.Objectives.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
var minds = _entities.System<MindSystem>();
|
||||
var minds = _entities.System<SharedMindSystem>();
|
||||
if (!minds.TryGetMind(player, out _, out var mind))
|
||||
{
|
||||
shell.WriteError(LocalizationManager.GetString("shell-target-entity-does-not-have-message", ("missing", "mind")));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Server.Objectives.Commands
|
||||
}
|
||||
|
||||
var mgr = IoCManager.Resolve<IPlayerManager>();
|
||||
var minds = _entityManager.System<MindSystem>();
|
||||
var minds = _entityManager.System<SharedMindSystem>();
|
||||
if (!mgr.TryGetSessionByUsername(args[0], out var session))
|
||||
{
|
||||
shell.WriteLine("Can't find the playerdata.");
|
||||
@@ -38,7 +38,7 @@ namespace Content.Server.Objectives.Commands
|
||||
|
||||
if (int.TryParse(args[1], out var i))
|
||||
{
|
||||
var mindSystem = _entityManager.System<MindSystem>();
|
||||
var mindSystem = _entityManager.System<SharedMindSystem>();
|
||||
shell.WriteLine(mindSystem.TryRemoveObjective(mind, i)
|
||||
? "Objective successfully removed!"
|
||||
: "Objective removing failed. Maybe the index is out of bounds? Check lsobjectives!");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives.Interfaces;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.Server.Objectives.Conditions
|
||||
get
|
||||
{
|
||||
var entityManager = IoCManager.Resolve<EntityManager>();
|
||||
var mindSystem = entityManager.System<MindSystem>();
|
||||
var mindSystem = entityManager.System<SharedMindSystem>();
|
||||
return _mind == null || mindSystem.IsCharacterDeadIc(_mind) ? 1f : 0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Server.Shuttles.Systems;
|
||||
using Content.Shared.Cuffs.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives.Interfaces;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.Objectives.Conditions
|
||||
{
|
||||
get {
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var mindSystem = entMan.System<MindSystem>();
|
||||
var mindSystem = entMan.System<SharedMindSystem>();
|
||||
|
||||
if (_mind?.OwnedEntity == null
|
||||
|| !entMan.TryGetComponent<TransformComponent>(_mind.OwnedEntity, out var xform))
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Server.Roles.Jobs;
|
||||
using Content.Server.Shuttles.Systems;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Objectives.Interfaces;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace Content.Server.Objectives.Conditions
|
||||
{
|
||||
// TODO refactor all of this to be ecs
|
||||
protected IEntityManager EntityManager => IoCManager.Resolve<IEntityManager>();
|
||||
protected MindSystem Minds => EntityManager.System<MindSystem>();
|
||||
protected JobSystem Jobs => EntityManager.System<JobSystem>();
|
||||
protected SharedMindSystem Minds => EntityManager.System<SharedMindSystem>();
|
||||
protected SharedJobSystem Jobs => EntityManager.System<SharedJobSystem>();
|
||||
protected MobStateSystem MobStateSystem => EntityManager.System<MobStateSystem>();
|
||||
protected EntityUid? TargetMindId;
|
||||
protected MindComponent? TargetMind => EntityManager.GetComponentOrNull<MindComponent>(TargetMindId);
|
||||
@@ -52,7 +52,7 @@ namespace Content.Server.Objectives.Conditions
|
||||
return 1f;
|
||||
|
||||
var entMan = IoCManager.Resolve<EntityManager>();
|
||||
var mindSystem = entMan.System<MindSystem>();
|
||||
var mindSystem = entMan.System<SharedMindSystem>();
|
||||
if (mindSystem.IsCharacterDeadIc(TargetMind))
|
||||
return 1f;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Objectives.Interfaces;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Objectives.Conditions;
|
||||
@@ -17,7 +17,7 @@ public sealed partial class KillRandomHeadCondition : KillPersonCondition
|
||||
|
||||
var allHumans = EntityManager.EntityQuery<MindContainerComponent>(true).Where(mc =>
|
||||
{
|
||||
var entity = EntityManager.GetComponentOrNull<MindComponent>(mc.Mind)?.OwnedEntity;
|
||||
var entity = EntityManagerExt.GetComponentOrNull<MindComponent>(EntityManager, (EntityUid?) mc.Mind)?.OwnedEntity;
|
||||
|
||||
if (entity == default)
|
||||
return false;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Objectives.Interfaces;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Objectives.Conditions;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Linq;
|
||||
using Content.Server.GameTicking.Rules;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Server.Roles.Jobs;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives.Interfaces;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Content.Server.Objectives.Conditions
|
||||
{
|
||||
var entityMgr = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
var traitors = entityMgr.System<TraitorRuleSystem>().GetOtherTraitorMindsAliveAndConnected(mind).ToList();
|
||||
var traitors = Enumerable.ToList<(EntityUid Id, MindComponent Mind)>(entityMgr.System<TraitorRuleSystem>().GetOtherTraitorMindsAliveAndConnected(mind));
|
||||
|
||||
if (traitors.Count == 0)
|
||||
return new EscapeShuttleCondition(); //You were made a traitor by admins, and are the first/only.
|
||||
@@ -30,7 +30,7 @@ namespace Content.Server.Objectives.Conditions
|
||||
{
|
||||
var targetName = string.Empty;
|
||||
var ents = IoCManager.Resolve<IEntityManager>();
|
||||
var jobs = ents.System<JobSystem>();
|
||||
var jobs = ents.System<SharedJobSystem>();
|
||||
var jobName = jobs.MindTryGetJobName(_targetMind);
|
||||
|
||||
if (_targetMind == null)
|
||||
@@ -55,7 +55,7 @@ namespace Content.Server.Objectives.Conditions
|
||||
get
|
||||
{
|
||||
var entityManager = IoCManager.Resolve<EntityManager>();
|
||||
var mindSystem = entityManager.System<MindSystem>();
|
||||
var mindSystem = entityManager.System<SharedMindSystem>();
|
||||
return !entityManager.TryGetComponent(_targetMind, out MindComponent? mind) ||
|
||||
!mindSystem.IsCharacterDeadIc(mind)
|
||||
? 1f
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Linq;
|
||||
using Content.Server.GameTicking.Rules;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Server.Roles.Jobs;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives.Interfaces;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Content.Server.Objectives.Conditions
|
||||
{
|
||||
var targetName = string.Empty;
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
var jobs = entities.System<JobSystem>();
|
||||
var jobs = entities.System<SharedJobSystem>();
|
||||
var jobName = jobs.MindTryGetJobName(_targetMind);
|
||||
|
||||
if (_targetMind == null)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives.Interfaces;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives;
|
||||
using Content.Shared.Random;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives.Interfaces;
|
||||
|
||||
namespace Content.Server.Objectives.Requirements
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives.Interfaces;
|
||||
|
||||
namespace Content.Server.Objectives.Requirements
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Server.GameTicking.Rules;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives.Interfaces;
|
||||
|
||||
namespace Content.Server.Objectives.Requirements
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Server.Roles.Jobs;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives.Interfaces;
|
||||
using Content.Shared.Roles;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.Objectives.Requirements
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Server.Roles;
|
||||
using Content.Server.Roles;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives.Interfaces;
|
||||
using Content.Shared.Roles;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Objectives.Requirements
|
||||
@@ -11,7 +12,7 @@ namespace Content.Server.Objectives.Requirements
|
||||
{
|
||||
public bool CanBeAssigned(EntityUid mindId, MindComponent mind)
|
||||
{
|
||||
var roleSystem = IoCManager.Resolve<IEntityManager>().System<RoleSystem>();
|
||||
var roleSystem = IoCManager.Resolve<IEntityManager>().System<SharedRoleSystem>();
|
||||
return roleSystem.MindHasRole<TraitorRoleComponent>(mindId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Server.Instruments;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.PAI;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
|
||||
@@ -2,11 +2,12 @@ using System.Linq;
|
||||
using Content.Server.Afk;
|
||||
using Content.Server.Afk.Events;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Roles;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Players;
|
||||
using Content.Shared.Players.PlayTimeTracking;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -27,6 +28,7 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypes = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
[Dependency] private readonly MindSystem _minds = default!;
|
||||
[Dependency] private readonly PlayTimeTrackingManager _tracking = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -103,18 +105,14 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
|
||||
|
||||
private void OnRoleRemove(RoleRemovedEvent ev)
|
||||
{
|
||||
if (ev.Mind.Session == null)
|
||||
return;
|
||||
|
||||
_tracking.QueueRefreshTrackers(ev.Mind.Session);
|
||||
if (_minds.TryGetSession(ev.Mind, out var session))
|
||||
_tracking.QueueRefreshTrackers(session);
|
||||
}
|
||||
|
||||
private void OnRoleAdd(RoleAddedEvent ev)
|
||||
{
|
||||
if (ev.Mind.Session == null)
|
||||
return;
|
||||
|
||||
_tracking.QueueRefreshTrackers(ev.Mind.Session);
|
||||
if (_minds.TryGetSession(ev.Mind, out var session))
|
||||
_tracking.QueueRefreshTrackers(session);
|
||||
}
|
||||
|
||||
private void OnRoundEnd(RoundRestartCleanupEvent ev)
|
||||
|
||||
@@ -1,59 +1,11 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Players;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Players;
|
||||
|
||||
namespace Content.Server.Players
|
||||
{
|
||||
/// <summary>
|
||||
/// Content side for all data that tracks a player session.
|
||||
/// Use <see cref="PlayerDataExt.ContentData(IPlayerData)"/> to retrieve this from an <see cref="IPlayerData"/>.
|
||||
/// </summary>
|
||||
public sealed class PlayerData
|
||||
{
|
||||
/// <summary>
|
||||
/// The session ID of the player owning this data.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public NetUserId UserId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// This is a backup copy of the player name stored on connection.
|
||||
/// This is useful in the event the player disconnects.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The currently occupied mind of the player owning this data.
|
||||
/// DO NOT DIRECTLY SET THIS UNLESS YOU KNOW WHAT YOU'RE DOING.
|
||||
/// </summary>
|
||||
[ViewVariables, Access(typeof(MindSystem), typeof(GameTicker))]
|
||||
public EntityUid? Mind { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true, the player is an admin and they explicitly de-adminned mid-game,
|
||||
/// so they should not regain admin if they reconnect.
|
||||
/// </summary>
|
||||
public bool ExplicitlyDeadminned { get; set; }
|
||||
|
||||
public PlayerData(NetUserId userId, string name)
|
||||
{
|
||||
UserId = userId;
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerDataExt
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the correctly cast instance of content player data from an engine player data storage.
|
||||
/// </summary>
|
||||
public static PlayerData? ContentData(this IPlayerData data)
|
||||
{
|
||||
return (PlayerData?) data.ContentDataUncast;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the correctly cast instance of content player data from an engine player data storage.
|
||||
/// </summary>
|
||||
@@ -62,6 +14,11 @@ namespace Content.Server.Players
|
||||
return session.Data.ContentData();
|
||||
}
|
||||
|
||||
public static PlayerData? ContentData(this ICommonSession session)
|
||||
{
|
||||
return ((IPlayerSession) session).ContentData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the mind that is associated with this player.
|
||||
/// </summary>
|
||||
|
||||
12
Content.Server/Players/PlayerSystem.cs
Normal file
12
Content.Server/Players/PlayerSystem.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Content.Shared.Players;
|
||||
using Robust.Shared.Players;
|
||||
|
||||
namespace Content.Server.Players;
|
||||
|
||||
public sealed class PlayerSystem : SharedPlayerSystem
|
||||
{
|
||||
public override PlayerData? ContentData(ICommonSession? session)
|
||||
{
|
||||
return session?.ContentData();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Pointing.Components;
|
||||
using Content.Server.Visible;
|
||||
using Content.Shared.Bed.Sleep;
|
||||
@@ -10,6 +9,7 @@ using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Pointing;
|
||||
using Content.Shared.Popups;
|
||||
@@ -38,7 +38,7 @@ namespace Content.Server.Pointing.EntitySystems
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly VisibilitySystem _visibilitySystem = default!;
|
||||
[Dependency] private readonly MindSystem _minds = default!;
|
||||
[Dependency] private readonly SharedMindSystem _minds = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
|
||||
private static readonly TimeSpan PointDelay = TimeSpan.FromSeconds(0.5f);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Content.Server.Actions;
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Server.Inventory;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Commands;
|
||||
using Content.Server.Nutrition;
|
||||
using Content.Server.Polymorph.Components;
|
||||
@@ -11,6 +10,7 @@ using Content.Shared.Buckle;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Polymorph;
|
||||
@@ -41,7 +41,7 @@ namespace Content.Server.Polymorph.Systems
|
||||
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
|
||||
private ISawmill _sawmill = default!;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Revenant.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Revenant.Components;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Players;
|
||||
using Content.Server.Roles.Jobs;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Players;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -1,23 +1,17 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
|
||||
namespace Content.Server.Roles.Jobs;
|
||||
|
||||
/// <summary>
|
||||
/// Handles the job data on mind entities.
|
||||
/// </summary>
|
||||
public sealed class JobSystem : EntitySystem
|
||||
public sealed class JobSystem : SharedJobSystem
|
||||
{
|
||||
[Dependency] private readonly IChatManager _chat = default!;
|
||||
[Dependency] private readonly MindSystem _mind = default!;
|
||||
[Dependency] private readonly RoleSystem _roles = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypes = default!;
|
||||
[Dependency] private readonly MindSystem _minds = default!;
|
||||
[Dependency] private readonly SharedRoleSystem _roles = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -29,7 +23,7 @@ public sealed class JobSystem : EntitySystem
|
||||
if (args.Silent)
|
||||
return;
|
||||
|
||||
if (!_mind.TryGetSession(mindId, out var session))
|
||||
if (!_minds.TryGetSession(mindId, out var session))
|
||||
return;
|
||||
|
||||
if (!MindTryGetJob(mindId, out _, out var prototype))
|
||||
@@ -51,59 +45,4 @@ public sealed class JobSystem : EntitySystem
|
||||
|
||||
_roles.MindAddRole(mindId, new JobComponent { PrototypeId = jobPrototypeId });
|
||||
}
|
||||
|
||||
public bool MindHasJobWithId(EntityUid? mindId, string prototypeId)
|
||||
{
|
||||
return CompOrNull<JobComponent>(mindId)?.PrototypeId == prototypeId;
|
||||
}
|
||||
|
||||
public bool MindTryGetJob(
|
||||
[NotNullWhen(true)] EntityUid? mindId,
|
||||
[NotNullWhen(true)] out JobComponent? comp,
|
||||
[NotNullWhen(true)] out JobPrototype? prototype)
|
||||
{
|
||||
comp = null;
|
||||
prototype = null;
|
||||
|
||||
return TryComp(mindId, out comp) &&
|
||||
comp.PrototypeId != null &&
|
||||
_prototypes.TryIndex(comp.PrototypeId, out prototype);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get the job name for this mind.
|
||||
/// Returns unknown if not found.
|
||||
/// </summary>
|
||||
public bool MindTryGetJobName([NotNullWhen(true)] EntityUid? mindId, out string name)
|
||||
{
|
||||
if (MindTryGetJob(mindId, out _, out var prototype))
|
||||
{
|
||||
name = prototype.LocalizedName;
|
||||
return true;
|
||||
}
|
||||
|
||||
name = Loc.GetString("generic-unknown-title");
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get the job name for this mind.
|
||||
/// Returns unknown if not found.
|
||||
/// </summary>
|
||||
public string MindTryGetJobName([NotNullWhen(true)] EntityUid? mindId)
|
||||
{
|
||||
MindTryGetJobName(mindId, out var name);
|
||||
return name;
|
||||
}
|
||||
|
||||
public bool CanBeAntag(IPlayerSession player)
|
||||
{
|
||||
if (player.ContentData() is not { Mind: { } mindId })
|
||||
return false;
|
||||
|
||||
if (!MindTryGetJob(mindId, out _, out var prototype))
|
||||
return true;
|
||||
|
||||
return prototype.CanBeAntag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace Content.Server.Roles;
|
||||
using Content.Shared.Roles;
|
||||
|
||||
namespace Content.Server.Roles;
|
||||
|
||||
/// <summary>
|
||||
/// Added to mind entities to tag that they are a nuke operative.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Players;
|
||||
using Content.Server.Roles.Jobs;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Players;
|
||||
using Content.Shared.Roles;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -43,8 +44,8 @@ namespace Content.Server.Roles
|
||||
return;
|
||||
}
|
||||
|
||||
var roles = _entityManager.System<RoleSystem>();
|
||||
var jobs = _entityManager.System<JobSystem>();
|
||||
var roles = _entityManager.System<SharedRoleSystem>();
|
||||
var jobs = _entityManager.System<SharedJobSystem>();
|
||||
if (jobs.MindHasJobWithId(mind, args[1]))
|
||||
roles.MindRemoveRole<JobComponent>(mind.Value);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user