ECSatize CameraRecoilSystem (#5448)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Camera;
|
||||
using Content.Server.Projectiles.Components;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Camera;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using JetBrains.Annotations;
|
||||
@@ -9,6 +9,7 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
@@ -19,6 +20,7 @@ namespace Content.Server.Projectiles
|
||||
{
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!;
|
||||
[Dependency] private readonly CameraRecoilSystem _cameraRecoil = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -65,10 +67,10 @@ namespace Content.Server.Projectiles
|
||||
|
||||
// Damaging it can delete it
|
||||
if (!EntityManager.GetComponent<MetaDataComponent>(otherEntity).EntityDeleted &&
|
||||
EntityManager.TryGetComponent(otherEntity, out CameraRecoilComponent? recoilComponent))
|
||||
EntityManager.HasComponent<CameraRecoilComponent>(otherEntity))
|
||||
{
|
||||
var direction = args.OurFixture.Body.LinearVelocity.Normalized;
|
||||
recoilComponent.Kick(direction);
|
||||
_cameraRecoil.KickCamera(otherEntity, direction);
|
||||
}
|
||||
|
||||
if (component.DeleteOnCollide)
|
||||
|
||||
Reference in New Issue
Block a user