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

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

View File

@@ -1,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.");

View File

@@ -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()

View File

@@ -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;

View File

@@ -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; }
}

View File

@@ -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;

View File

@@ -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

View File

@@ -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!;