Mind ecs (#14412)
This commit is contained in:
@@ -19,6 +19,7 @@ using Content.Server.Construction;
|
||||
using Content.Server.Materials;
|
||||
using Content.Server.Stack;
|
||||
using Content.Server.Jobs;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Humanoid.Prototypes;
|
||||
using Content.Shared.Zombies;
|
||||
@@ -54,6 +55,7 @@ namespace Content.Server.Cloning
|
||||
[Dependency] private readonly ChatSystem _chatSystem = default!;
|
||||
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
||||
[Dependency] private readonly MaterialStorageSystem _material = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
|
||||
public readonly Dictionary<Mind.Mind, EntityUid> ClonesWaitingForMind = new();
|
||||
public const float EasyModeCloningCost = 0.7f;
|
||||
@@ -97,12 +99,12 @@ namespace Content.Server.Cloning
|
||||
{
|
||||
if (!ClonesWaitingForMind.TryGetValue(mind, out var entity) ||
|
||||
!EntityManager.EntityExists(entity) ||
|
||||
!TryComp<MindComponent>(entity, out var mindComp) ||
|
||||
!TryComp<MindContainerComponent>(entity, out var mindComp) ||
|
||||
mindComp.Mind != null)
|
||||
return;
|
||||
|
||||
mind.TransferTo(entity, ghostCheckOverride: true);
|
||||
mind.UnVisit();
|
||||
_mindSystem.TransferTo(mind, entity, ghostCheckOverride: true);
|
||||
_mindSystem.UnVisit(mind);
|
||||
ClonesWaitingForMind.Remove(mind);
|
||||
}
|
||||
|
||||
@@ -157,7 +159,7 @@ namespace Content.Server.Cloning
|
||||
{
|
||||
if (EntityManager.EntityExists(clone) &&
|
||||
!_mobStateSystem.IsDead(clone) &&
|
||||
TryComp<MindComponent>(clone, out var cloneMindComp) &&
|
||||
TryComp<MindContainerComponent>(clone, out var cloneMindComp) &&
|
||||
(cloneMindComp.Mind == null || cloneMindComp.Mind == mind))
|
||||
return false; // Mind already has clone
|
||||
|
||||
|
||||
Reference in New Issue
Block a user