Even more resolve removals.

This commit is contained in:
Vera Aguilera Puerto
2021-12-08 17:32:32 +01:00
parent 684cb76173
commit cdc8336695
61 changed files with 364 additions and 278 deletions

View File

@@ -13,6 +13,8 @@ namespace Content.Server.ParticleAccelerator.Components
[RegisterComponent]
public class ParticleProjectileComponent : Component
{
[Dependency] private readonly IEntityManager _entMan = default!;
public override string Name => "ParticleProjectile";
public ParticleAcceleratorPowerState State;
@@ -20,21 +22,21 @@ namespace Content.Server.ParticleAccelerator.Components
{
State = state;
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(Owner, out var physicsComponent))
if (!_entMan.TryGetComponent<PhysicsComponent?>(Owner, out var physicsComponent))
{
Logger.Error("ParticleProjectile tried firing, but it was spawned without a CollidableComponent");
return;
}
physicsComponent.BodyStatus = BodyStatus.InAir;
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ProjectileComponent?>(Owner, out var projectileComponent))
if (!_entMan.TryGetComponent<ProjectileComponent?>(Owner, out var projectileComponent))
{
Logger.Error("ParticleProjectile tried firing, but it was spawned without a ProjectileComponent");
return;
}
projectileComponent.IgnoreEntity(firer);
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SinguloFoodComponent?>(Owner, out var singuloFoodComponent))
if (!_entMan.TryGetComponent<SinguloFoodComponent?>(Owner, out var singuloFoodComponent))
{
Logger.Error("ParticleProjectile tried firing, but it was spawned without a SinguloFoodComponent");
return;
@@ -59,7 +61,7 @@ namespace Content.Server.ParticleAccelerator.Components
_ => "0"
};
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SpriteComponent?>(Owner, out var spriteComponent))
if (!_entMan.TryGetComponent<SpriteComponent?>(Owner, out var spriteComponent))
{
Logger.Error("ParticleProjectile tried firing, but it was spawned without a SpriteComponent");
return;
@@ -69,8 +71,8 @@ namespace Content.Server.ParticleAccelerator.Components
physicsComponent
.LinearVelocity = angle.ToWorldVec() * 20f;
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation = angle;
Timer.Spawn(3000, () => IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner));
_entMan.GetComponent<TransformComponent>(Owner).LocalRotation = angle;
Timer.Spawn(3000, () => _entMan.DeleteEntity(Owner));
}
}
}