Skip to content

Commit 11c3c02

Browse files
authored
adding recoil index property of weapon (#367)
1 parent 0fa6198 commit 11c3c02

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/demoinfocs/common/equipment.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,18 @@ func (e *Equipment) AmmoReserve() int {
384384
return val.IntVal
385385
}
386386

387+
// RecoilIndex returns the weapon's recoil index
388+
func (e *Equipment) RecoilIndex() float32 {
389+
if e.Entity == nil {
390+
return 0
391+
}
392+
393+
// if the property doesn't exist we return 0 by default
394+
val, _ := e.Entity.PropertyValue("m_flRecoilIndex")
395+
396+
return val.FloatVal
397+
}
398+
387399
// NewEquipment creates a new Equipment and sets the UniqueID.
388400
//
389401
// Intended for internal use only.

0 commit comments

Comments
 (0)