remove Session from MindComponent (#34753)

* yummy

* fix tests
This commit is contained in:
Milon
2025-04-19 00:23:01 +02:00
committed by GitHub
parent ba6d8f5376
commit 3fc9bcbbbe
25 changed files with 149 additions and 134 deletions

View File

@@ -35,7 +35,9 @@ using Content.Shared.Prying.Components;
using Content.Shared.Traits.Assorted;
using Robust.Shared.Audio.Systems;
using Content.Shared.Ghost.Roles.Components;
using Content.Shared.Roles;
using Content.Shared.Tag;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
namespace Content.Server.Zombies;
@@ -61,6 +63,8 @@ public sealed partial class ZombieSystem
[Dependency] private readonly NPCSystem _npc = default!;
[Dependency] private readonly TagSystem _tag = default!;
[Dependency] private readonly NameModifierSystem _nameMod = default!;
[Dependency] private readonly SharedRoleSystem _roles = default!;
[Dependency] private readonly ISharedPlayerManager _player = default!;
private static readonly ProtoId<TagPrototype> InvalidForGlobalSpawnSpellTag = "InvalidForGlobalSpawnSpell";
private static readonly ProtoId<TagPrototype> CannotSuicideTag = "CannotSuicide";
@@ -234,8 +238,8 @@ public sealed partial class ZombieSystem
_npc.SleepNPC(target, htn);
//He's gotta have a mind
var hasMind = _mind.TryGetMind(target, out var mindId, out _);
if (hasMind && _mind.TryGetSession(mindId, out var session))
var hasMind = _mind.TryGetMind(target, out var mindId, out var mind);
if (hasMind && mind != null && _player.TryGetSessionById(mind.UserId, out var session))
{
//Zombie role for player manifest
_role.MindAddRole(mindId, "MindRoleZombie", mind: null, silent: true);