Update content vectors to numerics (#17759)

This commit is contained in:
metalgearsloth
2023-07-08 14:08:32 +10:00
committed by GitHub
parent 15772478c9
commit 68480af109
383 changed files with 978 additions and 575 deletions

View File

@@ -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;
}