ECSatize CameraRecoilSystem (#5448)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Camera;
|
||||
using Content.Server.Projectiles.Components;
|
||||
using Content.Server.Weapon.Ranged.Ammunition.Components;
|
||||
using Content.Shared.Camera;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Examine;
|
||||
@@ -208,9 +208,10 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
var direction = (targetPos - Entities.GetComponent<TransformComponent>(shooter).WorldPosition).ToAngle();
|
||||
var angle = GetRecoilAngle(direction);
|
||||
// This should really be client-side but for now we'll just leave it here
|
||||
if (Entities.TryGetComponent(shooter, out CameraRecoilComponent? recoilComponent))
|
||||
if (Entities.HasComponent<CameraRecoilComponent>(shooter))
|
||||
{
|
||||
recoilComponent.Kick(-angle.ToVec() * 0.15f);
|
||||
var kick = -angle.ToVec() * 0.15f;
|
||||
EntitySystem.Get<CameraRecoilSystem>().KickCamera(shooter, kick);
|
||||
}
|
||||
|
||||
// This section probably needs tweaking so there can be caseless hitscan etc.
|
||||
|
||||
Reference in New Issue
Block a user