Skip to content

Commit

Permalink
Merge pull request #449 from esbengc/cs2-starting-weapons
Browse files Browse the repository at this point in the history
CS2: Player Inventory now includes initial loadout at the beginning of the game
  • Loading branch information
markus-wa authored Oct 18, 2023
2 parents 1c75df8 + 25c4bf5 commit 9d80bca
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/demoinfocs/datatables.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ func (p *parser) bindPlayerWeaponsS2(pawnEntity st.Entity, pl *common.Player) {
var cache [maxWeapons]uint64
for i := range cache {
i2 := i // Copy for passing to handler
pawnEntity.Property(playerWeaponPrefixS2 + fmt.Sprintf("%04d", i)).OnUpdate(func(val st.PropertyValue) {
updateWeapon := func(val st.PropertyValue) {
if val.Any == nil {
return
}
Expand Down Expand Up @@ -691,7 +691,10 @@ func (p *parser) bindPlayerWeaponsS2(pawnEntity st.Entity, pl *common.Player) {

cache[i2] = 0
}
})
}
property := pawnEntity.Property(playerWeaponPrefixS2 + fmt.Sprintf("%04d", i))
updateWeapon(property.Value())
property.OnUpdate(updateWeapon)
}
}

Expand Down

0 comments on commit 9d80bca

Please sign in to comment.