Remove usages of obsolete MetaDataComponent setters (#19582)

This commit is contained in:
Visne
2023-08-28 11:20:31 +02:00
committed by GitHub
parent 38c6b4d07a
commit b88c2cbb49
32 changed files with 86 additions and 65 deletions

View File

@@ -33,8 +33,9 @@ namespace Content.Server.Administration.Commands
shell.WriteLine("You can't ghost here!");
return;
}
var mindSystem = _entities.System<MindSystem>();
var metaDataSystem = _entities.System<MetaDataSystem>();
if (mind.VisitingEntity != default && _entities.TryGetComponent<GhostComponent>(mind.VisitingEntity, out var oldGhostComponent))
{
@@ -55,16 +56,16 @@ namespace Content.Server.Administration.Commands
if (canReturn)
{
// TODO: Remove duplication between all this and "GamePreset.OnGhostAttempt()"...
if(!string.IsNullOrWhiteSpace(mind.CharacterName))
_entities.GetComponent<MetaDataComponent>(ghost).EntityName = mind.CharacterName;
if (!string.IsNullOrWhiteSpace(mind.CharacterName))
metaDataSystem.SetEntityName(ghost, mind.CharacterName);
else if (!string.IsNullOrWhiteSpace(mind.Session?.Name))
_entities.GetComponent<MetaDataComponent>(ghost).EntityName = mind.Session.Name;
metaDataSystem.SetEntityName(ghost, mind.Session.Name);
mindSystem.Visit(mind, ghost);
}
else
{
_entities.GetComponent<MetaDataComponent>(ghost).EntityName = player.Name;
metaDataSystem.SetEntityName(ghost, player.Name);
mindSystem.TransferTo(mind, ghost);
}

View File

@@ -34,10 +34,10 @@ public sealed class OwoifyCommand : IConsoleCommand
var meta = entityManager.GetComponent<MetaDataComponent>(eUid);
var random = IoCManager.Resolve<IRobustRandom>();
var owoSys = EntitySystem.Get<OwOAccentSystem>();
var owoSys = entityManager.System<OwOAccentSystem>();
var metaDataSys = entityManager.System<MetaDataSystem>();
meta.EntityName = owoSys.Accentuate(meta.EntityName);
meta.EntityDescription = owoSys.Accentuate(meta.EntityDescription);
metaDataSys.SetEntityName(eUid, owoSys.Accentuate(meta.EntityName), meta);
metaDataSys.SetEntityDescription(eUid, owoSys.Accentuate(meta.EntityDescription), meta);
}
}