Update content vectors to numerics (#17759)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Camera;
|
||||
|
||||
namespace Content.Client.Camera;
|
||||
@@ -17,15 +18,16 @@ public sealed class CameraRecoilSystem : SharedCameraRecoilSystem
|
||||
|
||||
public override void KickCamera(EntityUid uid, Vector2 recoil, CameraRecoilComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, false)) return;
|
||||
if (!Resolve(uid, ref component, false))
|
||||
return;
|
||||
|
||||
// Use really bad math to "dampen" kicks when we're already kicked.
|
||||
var existing = component.CurrentKick.Length;
|
||||
var existing = component.CurrentKick.Length();
|
||||
var dampen = existing / KickMagnitudeMax;
|
||||
component.CurrentKick += recoil * (1 - dampen);
|
||||
|
||||
if (component.CurrentKick.Length > KickMagnitudeMax)
|
||||
component.CurrentKick = component.CurrentKick.Normalized * KickMagnitudeMax;
|
||||
if (component.CurrentKick.Length() > KickMagnitudeMax)
|
||||
component.CurrentKick = component.CurrentKick.Normalized() * KickMagnitudeMax;
|
||||
|
||||
component.LastKickTime = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user