Revert "Mind ecs" (#14881)

This commit is contained in:
Leon Friedrich
2023-03-27 10:24:00 +13:00
committed by GitHub
parent c6c8fa2075
commit 4d71b1b81e
85 changed files with 684 additions and 1150 deletions

View File

@@ -1,6 +1,5 @@
using Content.Server.GameTicking;
using Content.Server.Ghost.Components;
using Content.Server.Mind;
using Content.Server.Players;
using Content.Shared.Administration;
using Content.Shared.Ghost;
@@ -34,12 +33,10 @@ namespace Content.Server.Administration.Commands
shell.WriteLine("You can't ghost here!");
return;
}
var mindSystem = _entities.System<MindSystem>();
if (mind.VisitingEntity != default && _entities.HasComponent<GhostComponent>(mind.VisitingEntity))
{
mindSystem.UnVisit(mind);
player.ContentData()!.Mind?.UnVisit();
return;
}
@@ -59,12 +56,12 @@ namespace Content.Server.Administration.Commands
else if (!string.IsNullOrWhiteSpace(mind.Session?.Name))
_entities.GetComponent<MetaDataComponent>(ghost).EntityName = mind.Session.Name;
mindSystem.Visit(mind, ghost);
mind.Visit(ghost);
}
else
{
_entities.GetComponent<MetaDataComponent>(ghost).EntityName = player.Name;
mindSystem.TransferTo(mind, ghost);
mind.TransferTo(ghost);
}
var comp = _entities.GetComponent<GhostComponent>(ghost);

View File

@@ -1,4 +1,3 @@
using Content.Server.Mind;
using Content.Server.Mind.Components;
using Content.Server.Players;
using Content.Shared.Administration;
@@ -45,7 +44,7 @@ namespace Content.Server.Administration.Commands
return;
}
if (!_entities.HasComponent<MindContainerComponent>(target))
if (!_entities.HasComponent<MindComponent>(target))
{
shell.WriteLine(Loc.GetString("shell-entity-is-not-mob"));
return;
@@ -55,8 +54,7 @@ namespace Content.Server.Administration.Commands
DebugTools.AssertNotNull(mind);
var mindSystem = _entities.System<MindSystem>();
mindSystem.TransferTo(mind!, target);
mind!.TransferTo(target);
}
}
}

View File

@@ -1,4 +1,3 @@
using Content.Server.Mind;
using Content.Server.Mind.Components;
using Content.Server.Players;
using Content.Shared.Administration;
@@ -10,10 +9,9 @@ namespace Content.Server.Administration.Commands
[AdminCommand(AdminFlags.Admin)]
sealed class SetMindCommand : IConsoleCommand
{
public string Command => "setmind";
public string Description => Loc.GetString("set-mind-command-description", ("requiredComponent", nameof(MindContainerComponent)));
public string Description => Loc.GetString("set-mind-command-description", ("requiredComponent", nameof(MindComponent)));
public string Help => Loc.GetString("set-mind-command-help-text", ("command", Command));
@@ -41,7 +39,7 @@ namespace Content.Server.Administration.Commands
return;
}
if (!entityManager.HasComponent<MindContainerComponent>(eUid))
if (!entityManager.HasComponent<MindComponent>(eUid))
{
shell.WriteLine(Loc.GetString("set-mind-command-target-has-no-mind-message"));
return;
@@ -61,16 +59,16 @@ namespace Content.Server.Administration.Commands
return;
}
var mindSystem = entityManager.System<MindSystem>();
var mind = playerCData.Mind;
if (mind == null)
{
mind = mindSystem.CreateMind(session.UserId);
mind.CharacterName = entityManager.GetComponent<MetaDataComponent>(eUid).EntityName;
mind = new Mind.Mind(session.UserId)
{
CharacterName = entityManager.GetComponent<MetaDataComponent>(eUid).EntityName
};
mind.ChangeOwningPlayer(session.UserId);
}
mindSystem.TransferTo(mind, eUid);
mind.TransferTo(eUid);
}
}
}