Skip to content

Commit

Permalink
Add loading BH palmed round to mags/clips
Browse files Browse the repository at this point in the history
  • Loading branch information
Maiq-The-Dude committed Aug 4, 2021
1 parent 7e72829 commit bc299f7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/BetterHands/MagPalming/Functionality.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,36 @@ private void FVRFireArmRound_FVRFixedUpdate(On.FistVR.FVRFireArmRound.orig_FVRFi
MP.GetHandFromSlot(qbSlot).UpdateControllerDefinition();
UnityEngine.Object.Destroy(self.gameObject);
}
else if (self.m_hoverOverReloadTrigger != null)
{
if (self.m_hoverOverReloadTrigger.Magazine != null)
{
var mag = self.m_hoverOverReloadTrigger.Magazine;
if (mag.RoundType == self.RoundType)
{
mag.AddRound(self, true, true);
DestroyRound(self, qbSlot);
}
}
else if (self.m_hoverOverReloadTrigger.Clip != null)
{
var clip = self.m_hoverOverReloadTrigger.Clip;
if (clip.RoundType == self.RoundType)
{
clip.AddRound(self, true, true);
DestroyRound(self, qbSlot);
}
}
}
}
}

private void DestroyRound(FVRFireArmRound round, FVRQuickBeltSlot qbSlot)
{
Object.Destroy(round.gameObject);
MP.GetHandFromSlot(qbSlot).UpdateControllerDefinition();
}

// Allow palmed mags to hit physical mag releases
private void PhysicalMagazineReleaseLatch_OnCollisionStay(On.FistVR.PhysicalMagazineReleaseLatch.orig_OnCollisionStay orig, PhysicalMagazineReleaseLatch self, Collision col)
{
Expand Down

0 comments on commit bc299f7

Please sign in to comment.