Inline TryGetComponent completely, for real

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 14:17:01 +01:00
parent 2ff4ec65d5
commit 69b270017b
425 changed files with 1143 additions and 995 deletions

View File

@@ -60,7 +60,7 @@ namespace Content.Server.Body.Components
// a crash within the character preview menu in the lobby
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(preset.PartIDs[slot.Id], Owner.Transform.MapPosition);
if (!entity.TryGetComponent(out SharedBodyPartComponent? part))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Uid, out SharedBodyPartComponent? part))
{
Logger.Error($"Entity {slot.Id} does not have a {nameof(SharedBodyPartComponent)} component.");
continue;
@@ -90,7 +90,7 @@ namespace Content.Server.Body.Components
SoundSystem.Play(Filter.Pvs(Owner), _gibSound.GetSound(), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.025f));
if (Owner.TryGetComponent(out ContainerManagerComponent? container))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner.Uid, out ContainerManagerComponent? container))
{
foreach (var cont in container.GetAllContainers())
{