@@ -3451,27 +3451,31 @@ void AHuman::Update()
3451
3451
// Item dropping logic
3452
3452
3453
3453
if (m_Controller.IsState (WEAPON_DROP) && m_Status != INACTIVE) {
3454
- bool anyDropped = false ;
3454
+ Arm *dropperArm = nullptr ;
3455
3455
for (Arm *arm : { m_pFGArm, m_pBGArm }) {
3456
- if (!anyDropped && arm && arm->GetHeldDevice ()) {
3456
+ if (arm && arm->GetHeldDevice ()) {
3457
3457
HeldDevice *heldDevice = arm->GetHeldDevice ();
3458
3458
arm->RemoveAttachable (heldDevice, true , false );
3459
+ if (dropperArm) {
3460
+ if (heldDevice) {
3461
+ dropperArm->SetHeldDevice (heldDevice);
3462
+ arm->SetHandPos (dropperArm->GetPos ());
3463
+ }
3464
+ } else {
3465
+ heldDevice->SetPos (arm->GetJointPos () + Vector (arm->GetMaxLength () * GetFlipFactor (), 0 ).RadRotate (adjustedAimAngle));
3466
+ Vector tossVec (1 .0F + std::sqrt (std::abs (arm->GetThrowStrength ()) / std::sqrt (std::abs (heldDevice->GetMass ()) + 1 .0F )), RandomNormalNum ());
3467
+ heldDevice->SetVel (heldDevice->GetVel () * 0 .5F + tossVec.RadRotate (m_AimAngle).GetXFlipped (m_HFlipped));
3468
+ heldDevice->SetAngularVel (heldDevice->GetAngularVel () + m_AngularVel * 0 .5F + 3 .0F * RandomNormalNum ());
3459
3469
3460
- heldDevice->SetPos (arm->GetJointPos () + Vector (arm->GetMaxLength () * GetFlipFactor (), 0 ).RadRotate (adjustedAimAngle));
3461
- Vector tossVec (1 .0F + std::sqrt (std::abs (arm->GetThrowStrength ()) / std::sqrt (std::abs (heldDevice->GetMass ()) + 1 .0F )), RandomNormalNum ());
3462
- heldDevice->SetVel (heldDevice->GetVel () * 0 .5F + tossVec.RadRotate (m_AimAngle).GetXFlipped (m_HFlipped));
3463
- heldDevice->SetAngularVel (heldDevice->GetAngularVel () + m_AngularVel * 0 .5F + 3 .0F * RandomNormalNum ());
3464
-
3465
- arm->SetHandPos (heldDevice->GetPos ());
3466
- if (!m_Inventory.empty ()) {
3467
- arm->SetHeldDevice (dynamic_cast <HeldDevice *>(SwapNextInventory ()));
3468
- arm->SetHandPos (m_Pos + RotateOffset (m_HolsterOffset));
3470
+ arm->SetHandPos (heldDevice->GetPos ());
3469
3471
}
3470
- anyDropped = true ;
3471
- break ;
3472
+ dropperArm = arm;
3473
+ } else if (dropperArm && !m_Inventory.empty ()) {
3474
+ dropperArm->SetHeldDevice (dynamic_cast <HeldDevice*>(SwapNextInventory ()));
3475
+ dropperArm->SetHandPos (m_Pos + RotateOffset (m_HolsterOffset));
3472
3476
}
3473
3477
}
3474
- if (!anyDropped && !m_Inventory.empty () && !m_pFGArm) {
3478
+ if (!dropperArm && !m_Inventory.empty () && !m_pFGArm) {
3475
3479
DropAllInventory ();
3476
3480
if (m_pBGArm) {
3477
3481
m_pBGArm->SetHandPos (m_Pos + RotateOffset (m_HolsterOffset));
0 commit comments