Skip to content

Commit

Permalink
Fix aiming
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Jan 20, 2025
1 parent e449a4b commit bd8c651
Showing 1 changed file with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ public override bool IsAiming
}
if (_isAiming == value)
{
method_64(); // Reset animator flags
return;
}
_isAiming = value;
_player.Skills.FastAimTimer.Target = value ? 0f : 2f;
_player.MovementContext.SetAimingSlowdown(IsAiming, 0.33f + aimMovementSpeed);
_player.Physical.Aim((!_isAiming || !(_player.MovementContext.StationaryWeapon == null)) ? 0f : ErgonomicWeight);
method_63(_isAiming); // Set animator flags
coopPlayer.ProceduralWeaponAnimation.IsAiming = _isAiming;
}
}
Expand Down Expand Up @@ -138,6 +140,29 @@ public override bool CanStartReload()
return true;
}

public override void SetAim(int scopeIndex)
{
Item.AimIndex.Value = Mathf.Max(0, scopeIndex);
SetObservedAim(scopeIndex >= 0);
}

private void SetObservedAim(bool isAiming)
{
IsAiming = isAiming;

// Lacyway: Unsure if this is needed, remove later if it is
/*if (Weapon is GClass3111 && coopPlayer.ProceduralWeaponAnimation.IsAiming != isAiming)
{
FirearmsAnimator.SetAiming(!isAiming);
}*/

_player.method_58(0.2f, false);
if (isAiming)
{
method_60();
}
}

public override void ManualUpdate(float deltaTime)
{
base.ManualUpdate(deltaTime);
Expand Down Expand Up @@ -208,6 +233,7 @@ public override void WeaponOverlapping()
{
return;
}

SetWeaponOverlapValue(coopPlayer.ObservedOverlap);
ObservedOverlapView();
if (overlapCounter <= 1f)
Expand All @@ -224,6 +250,7 @@ public override void WeaponOverlapping()
coopPlayer.MovementContext.LeftStanceController.SetAnimatorLeftStanceToCacheFromHandsAction();
overlapCounter = 0f;
}

coopPlayer.ShouldOverlap = false;
}

Expand All @@ -233,13 +260,14 @@ private void ObservedOverlapView()
{
_player.ProceduralWeaponAnimation.TurnAway.OverlapDepth = coopPlayer.ObservedOverlap;
_player.ProceduralWeaponAnimation.OverlappingAllowsBlindfire = true;
coopPlayer.ShouldOverlap = false;
return;
}

Vector3 vector = _player.ProceduralWeaponAnimation.HandsContainer.HandsPosition.Get();
_player.ProceduralWeaponAnimation.OverlappingAllowsBlindfire = false;
_player.ProceduralWeaponAnimation.TurnAway.OriginZShift = vector.y;
_player.ProceduralWeaponAnimation.TurnAway.OverlapDepth = coopPlayer.ObservedOverlap;
_player.ProceduralWeaponAnimation.TurnAway.OverlapDepth = coopPlayer.ObservedOverlap;
}

public override void OnPlayerDead()
Expand Down

0 comments on commit bd8c651

Please sign in to comment.