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

@@ -44,7 +44,7 @@ namespace Content.Server.Singularity.EntitySystems
return;
}
if (component.Owner.TryGetComponent(out PhysicsComponent? phys) && phys.BodyType == BodyType.Static)
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner.Uid, out PhysicsComponent? phys) && phys.BodyType == BodyType.Static)
{
if (!component.IsOn)
{
@@ -168,7 +168,7 @@ namespace Content.Server.Singularity.EntitySystems
{
var projectile = IoCManager.Resolve<IEntityManager>().SpawnEntity(component.BoltType, component.Owner.Transform.Coordinates);
if (!projectile.TryGetComponent<PhysicsComponent>(out var physicsComponent))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(projectile.Uid, out var physicsComponent))
{
Logger.Error("Emitter tried firing a bolt, but it was spawned without a PhysicsComponent");
return;
@@ -176,7 +176,7 @@ namespace Content.Server.Singularity.EntitySystems
physicsComponent.BodyStatus = BodyStatus.InAir;
if (!projectile.TryGetComponent<ProjectileComponent>(out var projectileComponent))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ProjectileComponent?>(projectile.Uid, out var projectileComponent))
{
Logger.Error("Emitter tried firing a bolt, but it was spawned without a ProjectileComponent");
return;