Skip to content

Commit 714ecc7

Browse files
xXxhaxmeister42xXxmarkus-wa
authored andcommitted
fix Equipment.AmmoReserve never being updated (#133)
1 parent 8cdc3b8 commit 714ecc7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

datatables.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,10 @@ func (p *Parser) bindWeapon(entity *st.Entity, wepType common.EquipmentElement)
419419
entity.FindPropertyI("m_iClip1").OnUpdate(func(val st.PropertyValue) {
420420
eq.AmmoInMagazine = val.IntVal - 1
421421
})
422+
// Some weapons in some demos might be missing this property
423+
if reserveAmmoProp := entity.FindPropertyI("m_iPrimaryReserveAmmoCount"); reserveAmmoProp != nil {
424+
reserveAmmoProp.Bind(&eq.AmmoReserve, st.ValTypeInt)
425+
}
422426

423427
// Only weapons with scopes have m_zoomLevel property
424428
if zoomLvlProp := entity.FindPropertyI("m_zoomLevel"); zoomLvlProp != nil {

0 commit comments

Comments
 (0)