Skip to content

Commit 3ea42aa

Browse files
committed
clean up weapon prop formatting
1 parent ad5a889 commit 3ea42aa

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

pkg/demoinfocs/datatables.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ func (p *parser) bindPlayerWeapons(pawnEntity st.Entity, pl *common.Player) {
549549
inventory := make(map[int]*common.Equipment, inventorySize)
550550

551551
for i := 0; i < inventorySize; i++ {
552-
val := pawnEntity.Property(playerWeaponPrefixS2 + fmt.Sprintf("%04d", i)).Value()
552+
val := pawnEntity.Property(playerWeaponPrefixS2 + fmt.Sprintf(".%04d", i)).Value()
553553
if val.Any == nil {
554554
continue
555555
}
@@ -561,7 +561,7 @@ func (p *parser) bindPlayerWeapons(pawnEntity st.Entity, pl *common.Player) {
561561
pl.Inventory = inventory
562562
}
563563

564-
pawnEntity.Property("m_pWeaponServices.m_hMyWeapons").OnUpdate(func(pv st.PropertyValue) {
564+
pawnEntity.Property(playerWeaponPrefixS2).OnUpdate(func(pv st.PropertyValue) {
565565
inventorySize = len(pv.Array())
566566
setPlayerInventory()
567567
})
@@ -598,7 +598,7 @@ func (p *parser) bindPlayerWeapons(pawnEntity st.Entity, pl *common.Player) {
598598
}
599599
}
600600

601-
property := pawnEntity.Property(playerWeaponPrefixS2 + fmt.Sprintf("%04d", i))
601+
property := pawnEntity.Property(playerWeaponPrefixS2 + fmt.Sprintf(".%04d", i))
602602
updateWeapon(property.Value())
603603
property.OnUpdate(updateWeapon)
604604
}

pkg/demoinfocs/parsing.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ import (
1818
)
1919

2020
const (
21-
playerWeaponPrefix = "m_hMyWeapons."
22-
playerWeaponPrefixS2 = "m_pWeaponServices.m_hMyWeapons."
23-
playerWeaponPrePrefix = "bcc_nonlocaldata."
24-
gameRulesPrefix = "cs_gamerules_data"
25-
gameRulesPrefixS2 = "m_pGameRules"
21+
playerWeaponPrefixS2 = "m_pWeaponServices.m_hMyWeapons"
22+
gameRulesPrefixS2 = "m_pGameRules"
2623
)
2724

2825
// Parsing errors

0 commit comments

Comments
 (0)