Skip to content

Commit e53286d

Browse files
authored
Merge pull request #603 from markus-wa/flash
feat: add player.FlashbangCount()
2 parents e330aad + 6fd4f47 commit e53286d

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

pkg/demoinfocs/common/player.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,21 @@ func (p *Player) Weapons() []*Equipment {
175175
return res
176176
}
177177

178+
// FlashbangCount returns the amount of flashbangs the player currently has in his inventory.
179+
func (p *Player) FlashbangCount() uint64 {
180+
pawn := p.PlayerPawnEntity()
181+
if pawn == nil {
182+
return 0
183+
}
184+
185+
flashCountProp, ok := pawn.PropertyValue("m_pWeaponServices.m_iAmmo.0014")
186+
if !ok {
187+
return 0
188+
}
189+
190+
return flashCountProp.UInt64()
191+
}
192+
178193
// IsSpottedBy returns true if the player has been spotted by the other player.
179194
// This is NOT "Line of Sight" / FOV - look up "CSGO TraceRay" for that.
180195
// May not behave as expected with multiple spotters.
15.3 KB
Binary file not shown.

pkg/demoinfocs/s2_commands.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,11 @@ func getGameEventListBinForProtocol(networkProtocol int) ([]byte, error) {
385385
case networkProtocol < 14069:
386386
return eventListFolder.ReadFile("event-list-dump/14023.bin")
387387

388-
default:
388+
case networkProtocol < 14089:
389389
return eventListFolder.ReadFile("event-list-dump/14070.bin")
390+
391+
default:
392+
return eventListFolder.ReadFile("event-list-dump/14089.bin")
390393
}
391394
}
392395

0 commit comments

Comments
 (0)