This commit is contained in:
ShadowCommander
2023-03-26 11:31:13 -07:00
committed by GitHub
parent 0e5dc41fe8
commit bfc4da9377
85 changed files with 1150 additions and 684 deletions

View File

@@ -1,5 +1,6 @@
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;
@@ -10,6 +11,8 @@ namespace Content.Server.Body.Systems
{
public sealed class BrainSystem : EntitySystem
{
[Dependency] private readonly MindSystem _mindSystem = default!;
public override void Initialize()
{
base.Initialize();
@@ -34,8 +37,8 @@ namespace Content.Server.Body.Systems
private void HandleMind(EntityUid newEntity, EntityUid oldEntity)
{
EntityManager.EnsureComponent<MindComponent>(newEntity);
var oldMind = EntityManager.EnsureComponent<MindComponent>(oldEntity);
EntityManager.EnsureComponent<MindContainerComponent>(newEntity);
var oldMind = EntityManager.EnsureComponent<MindContainerComponent>(oldEntity);
EnsureComp<GhostOnMoveComponent>(newEntity);
if (HasComp<BodyComponent>(newEntity))
@@ -44,7 +47,10 @@ namespace Content.Server.Body.Systems
// TODO: This is an awful solution.
EnsureComp<InputMoverComponent>(newEntity);
oldMind.Mind?.TransferTo(newEntity);
if (!_mindSystem.TryGetMind(oldEntity, out var mind, oldMind))
return;
_mindSystem.TransferTo(mind, newEntity);
}
}
}