ECSatize CameraRecoilSystem (#5448)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Camera;
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Server.Items;
|
||||
using Content.Server.Nutrition.Components;
|
||||
@@ -11,6 +10,7 @@ using Content.Server.Storage.Components;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Server.Throwing;
|
||||
using Content.Server.Tools.Components;
|
||||
using Content.Shared.Camera;
|
||||
using Content.Shared.CombatMode;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.PneumaticCannon;
|
||||
@@ -34,6 +34,7 @@ namespace Content.Server.PneumaticCannon
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly StunSystem _stun = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmos = default!;
|
||||
[Dependency] private readonly CameraRecoilSystem _cameraRecoil = default!;
|
||||
|
||||
private HashSet<PneumaticCannonComponent> _currentlyFiring = new();
|
||||
|
||||
@@ -229,9 +230,10 @@ namespace Content.Server.PneumaticCannon
|
||||
storage.Remove(ent);
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(data.User), comp.FireSound.GetSound(), ((IComponent) comp).Owner, AudioParams.Default);
|
||||
if (EntityManager.TryGetComponent<CameraRecoilComponent?>(data.User, out var recoil))
|
||||
if (EntityManager.HasComponent<CameraRecoilComponent>(data.User))
|
||||
{
|
||||
recoil.Kick(Vector2.One * data.Strength);
|
||||
var kick = Vector2.One * data.Strength;
|
||||
_cameraRecoil.KickCamera(data.User, kick);
|
||||
}
|
||||
|
||||
ent.TryThrow(data.Direction, data.Strength, data.User, GetPushbackRatioFromPower(comp.Power));
|
||||
|
||||
Reference in New Issue
Block a user