Skip to content

Commit 9d80bca

Browse files
authored
Merge pull request #449 from esbengc/cs2-starting-weapons
CS2: Player Inventory now includes initial loadout at the beginning of the game
2 parents 1c75df8 + 25c4bf5 commit 9d80bca

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/demoinfocs/datatables.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ func (p *parser) bindPlayerWeaponsS2(pawnEntity st.Entity, pl *common.Player) {
655655
var cache [maxWeapons]uint64
656656
for i := range cache {
657657
i2 := i // Copy for passing to handler
658-
pawnEntity.Property(playerWeaponPrefixS2 + fmt.Sprintf("%04d", i)).OnUpdate(func(val st.PropertyValue) {
658+
updateWeapon := func(val st.PropertyValue) {
659659
if val.Any == nil {
660660
return
661661
}
@@ -691,7 +691,10 @@ func (p *parser) bindPlayerWeaponsS2(pawnEntity st.Entity, pl *common.Player) {
691691

692692
cache[i2] = 0
693693
}
694-
})
694+
}
695+
property := pawnEntity.Property(playerWeaponPrefixS2 + fmt.Sprintf("%04d", i))
696+
updateWeapon(property.Value())
697+
property.OnUpdate(updateWeapon)
695698
}
696699
}
697700

0 commit comments

Comments
 (0)