Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rhailrake committed Nov 6, 2024
1 parent 9e38ce3 commit 2069ee5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion Content.Shared/Camera/SharedCameraRecoilSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Numerics;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Item;
using Content.Shared.Telescope;
using JetBrains.Annotations;
using Robust.Shared.Network;
using Robust.Shared.Serialization;
Expand Down Expand Up @@ -30,6 +33,8 @@ public abstract class SharedCameraRecoilSystem : EntitySystem

[Dependency] private readonly SharedEyeSystem _eye = default!;
[Dependency] private readonly INetManager _net = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!;


public override void Initialize()
{
Expand All @@ -38,7 +43,14 @@ public override void Initialize()

private void OnCameraRecoilGetEyeOffset(Entity<CameraRecoilComponent> ent, ref GetEyeOffsetEvent args)
{
args.Offset += ent.Comp.BaseOffset + ent.Comp.CurrentKick;
if (_hands.TryGetActiveItem(ent.Owner, out var item) && HasComp<TelescopeComponent>(item.Value))
{
args.Offset += ent.Comp.BaseOffset;
}
else
{
args.Offset += ent.Comp.BaseOffset + ent.Comp.CurrentKick;
}
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Telescope/SharedTelescopeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private void SetOffset(Entity<EyeComponent> ent, Vector2 offset, TelescopeCompon
if (TryComp(ent, out CameraRecoilComponent? recoil))
{
recoil.BaseOffset = offset;
_eye.SetOffset(ent, offset + recoil.CurrentKick, ent);
_eye.SetOffset(ent, offset, ent);
}
else
{
Expand Down

0 comments on commit 2069ee5

Please sign in to comment.