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

@@ -36,7 +36,7 @@ namespace Content.Client.Ghost
foreach (var ghost in EntityManager.GetAllComponents(typeof(GhostComponent), true))
{
if (ghost.Owner.TryGetComponent(out SpriteComponent? sprite))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(ghost.Owner.Uid, out SpriteComponent? sprite))
{
sprite.Visible = value;
}
@@ -60,7 +60,7 @@ namespace Content.Client.Ghost
private void OnGhostInit(EntityUid uid, GhostComponent component, ComponentInit args)
{
if (component.Owner.TryGetComponent(out SpriteComponent? sprite))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner.Uid, out SpriteComponent? sprite))
{
sprite.Visible = GhostVisibility;
}
@@ -104,7 +104,7 @@ namespace Content.Client.Ghost
var entity = _playerManager.LocalPlayer?.ControlledEntity;
if (entity == null ||
!entity.TryGetComponent(out GhostComponent? ghost))
!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Uid, out GhostComponent? ghost))
{
return;
}