Refactor UpdateKinematics() and fix a lot of Content warnings (#1709)

Most warnings were related to EntityQuery and IPhysicsComponent.
Partially fixes #1650 and fixes #1682
This commit is contained in:
Vince
2020-08-16 05:38:35 +02:00
committed by GitHub
parent 8503ab157a
commit b647ad0f42
29 changed files with 65 additions and 151 deletions

View File

@@ -5,7 +5,6 @@ using Content.Server.GameObjects.Components.Damage;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Projectiles;
using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition;
using Content.Server.Interfaces;
using Content.Shared.Audio;
using Content.Shared.GameObjects.Components.Weapons.Ranged;
using Content.Shared.GameObjects.EntitySystems;
@@ -43,7 +42,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
#pragma warning disable 649
[Dependency] private IGameTiming _gameTiming;
[Dependency] private IRobustRandom _robustRandom;
[Dependency] private readonly IServerNotifyManager _notifyManager;
#pragma warning restore 649
public override FireRateSelector FireRateSelector => _fireRateSelector;
@@ -385,15 +383,15 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
projectileAngle = angle;
}
var physicsComponent = projectile.GetComponent<IPhysicsComponent>();
physicsComponent.Status = BodyStatus.InAir;
var collidableComponent = projectile.GetComponent<ICollidableComponent>();
collidableComponent.Status = BodyStatus.InAir;
projectile.Transform.GridPosition = Owner.Transform.GridPosition;
var projectileComponent = projectile.GetComponent<ProjectileComponent>();
projectileComponent.IgnoreEntity(shooter);
projectile
.GetComponent<IPhysicsComponent>()
.GetComponent<ICollidableComponent>()
.EnsureController<BulletController>()
.LinearVelocity = projectileAngle.ToVec() * velocity;