@@ -95,15 +95,15 @@ func (p *Parser) bindBomb() {
9595 // Track bomb when it is being held by a player
9696 scPlayerC4 := p .stParser .ServerClasses ().FindByName ("CC4" )
9797 scPlayerC4 .OnEntityCreated (func (bombEntity * st.Entity ) {
98- bombEntity .FindProperty ("m_hOwner" ).OnUpdate (func (val st.PropertyValue ) {
98+ bombEntity .FindPropertyI ("m_hOwner" ).OnUpdate (func (val st.PropertyValue ) {
9999 bomb .Carrier = p .gameState .Participants ().FindByHandle (val .IntVal )
100100 })
101101 })
102102}
103103
104104func (p * Parser ) bindTeamStates () {
105105 p .stParser .ServerClasses ().FindByName ("CCSTeam" ).OnEntityCreated (func (entity * st.Entity ) {
106- team := entity .FindProperty ("m_szTeamname" ).Value ().StringVal
106+ team := entity .FindPropertyI ("m_szTeamname" ).Value ().StringVal
107107
108108 var s * common.TeamState
109109
@@ -127,7 +127,7 @@ func (p *Parser) bindTeamStates() {
127127 entity .BindProperty ("m_szClanTeamname" , & s .ClanName , st .ValTypeString )
128128 entity .BindProperty ("m_szTeamFlagImage" , & s .Flag , st .ValTypeString )
129129
130- entity .FindProperty ("m_scoreTotal" ).OnUpdate (func (val st.PropertyValue ) {
130+ entity .FindPropertyI ("m_scoreTotal" ).OnUpdate (func (val st.PropertyValue ) {
131131 oldScore := s .Score
132132 s .Score = val .IntVal
133133
@@ -349,16 +349,16 @@ func (p *Parser) bindGrenadeProjectiles(entity *st.Entity) {
349349 p .nadeProjectileDestroyed (proj )
350350 })
351351
352- entity .FindProperty ("m_nModelIndex" ).OnUpdate (func (val st.PropertyValue ) {
352+ entity .FindPropertyI ("m_nModelIndex" ).OnUpdate (func (val st.PropertyValue ) {
353353 proj .Weapon = p .grenadeModelIndices [val .IntVal ]
354354 })
355355
356356 // @micvbang: not quite sure what the difference between Thrower and Owner is.
357- entity .FindProperty ("m_hThrower" ).OnUpdate (func (val st.PropertyValue ) {
357+ entity .FindPropertyI ("m_hThrower" ).OnUpdate (func (val st.PropertyValue ) {
358358 proj .Thrower = p .gameState .Participants ().FindByHandle (val .IntVal )
359359 })
360360
361- entity .FindProperty ("m_hOwnerEntity" ).OnUpdate (func (val st.PropertyValue ) {
361+ entity .FindPropertyI ("m_hOwnerEntity" ).OnUpdate (func (val st.PropertyValue ) {
362362 proj .Owner = p .gameState .Participants ().FindByHandle (val .IntVal )
363363 })
364364
@@ -370,8 +370,7 @@ func (p *Parser) bindGrenadeProjectiles(entity *st.Entity) {
370370
371371 // Some demos don't have this property as it seems
372372 // So we need to check for nil and can't send out bounce events if it's missing
373- bounceProp := entity .FindProperty ("m_nBounces" )
374- if bounceProp != nil {
373+ if bounceProp := entity .FindPropertyI ("m_nBounces" ); bounceProp != nil {
375374 bounceProp .OnUpdate (func (val st.PropertyValue ) {
376375 if val .IntVal != 0 {
377376 p .eventDispatcher .Dispatch (events.GrenadeProjectileBounce {
@@ -405,19 +404,19 @@ func (p *Parser) bindWeapon(entity *st.Entity, wepType common.EquipmentElement)
405404 eq .EntityID = entityID
406405 eq .AmmoInMagazine = - 1
407406
408- entity .FindProperty ("m_iClip1" ).OnUpdate (func (val st.PropertyValue ) {
407+ entity .FindPropertyI ("m_iClip1" ).OnUpdate (func (val st.PropertyValue ) {
409408 eq .AmmoInMagazine = val .IntVal - 1
410409 })
411410
412411 // Only weapons with scopes have m_zoomLevel property
413- if entity .FindProperty ("m_zoomLevel" ) != nil {
414- entity . BindProperty ( "m_zoomLevel" , & eq .ZoomLevel , st .ValTypeInt )
412+ if zoomLvlProp := entity .FindPropertyI ("m_zoomLevel" ); zoomLvlProp != nil {
413+ zoomLvlProp . Bind ( & eq .ZoomLevel , st .ValTypeInt )
415414 }
416415
417- eq .AmmoType = entity .FindProperty ("LocalWeaponData.m_iPrimaryAmmoType" ).Value ().IntVal
416+ eq .AmmoType = entity .FindPropertyI ("LocalWeaponData.m_iPrimaryAmmoType" ).Value ().IntVal
418417
419418 // Detect alternative weapons (P2k -> USP, M4A4 -> M4A1-S etc.)
420- modelIndex := entity .FindProperty ("m_nModelIndex" ).Value ().IntVal
419+ modelIndex := entity .FindPropertyI ("m_nModelIndex" ).Value ().IntVal
421420 eq .OriginalString = p .modelPreCache [modelIndex ]
422421
423422 wepFix := func (defaultName , altName string , alt common.EquipmentElement ) {
@@ -459,13 +458,13 @@ func (p *Parser) bindNewInferno(entity *st.Entity) {
459458
460459 origin := entity .Position ()
461460 nFires := 0
462- entity .FindProperty ("m_fireCount" ).OnUpdate (func (val st.PropertyValue ) {
461+ entity .FindPropertyI ("m_fireCount" ).OnUpdate (func (val st.PropertyValue ) {
463462 for i := nFires ; i < val .IntVal ; i ++ {
464463 iStr := fmt .Sprintf ("%03d" , i )
465464 offset := r3.Vector {
466- X : float64 (entity .FindProperty ("m_fireXDelta." + iStr ).Value ().IntVal ),
467- Y : float64 (entity .FindProperty ("m_fireYDelta." + iStr ).Value ().IntVal ),
468- Z : float64 (entity .FindProperty ("m_fireZDelta." + iStr ).Value ().IntVal ),
465+ X : float64 (entity .FindPropertyI ("m_fireXDelta." + iStr ).Value ().IntVal ),
466+ Y : float64 (entity .FindPropertyI ("m_fireYDelta." + iStr ).Value ().IntVal ),
467+ Z : float64 (entity .FindPropertyI ("m_fireZDelta." + iStr ).Value ().IntVal ),
469468 }
470469
471470 fire := & common.Fire {Vector : origin .Add (offset ), IsBurning : true }
@@ -499,7 +498,7 @@ func (p *Parser) bindGameRules() {
499498
500499 gameRules := p .ServerClasses ().FindByName ("CCSGameRulesProxy" )
501500 gameRules .OnEntityCreated (func (entity * st.Entity ) {
502- entity .FindProperty (grPrefix ("m_gamePhase" )).OnUpdate (func (val st.PropertyValue ) {
501+ entity .FindPropertyI (grPrefix ("m_gamePhase" )).OnUpdate (func (val st.PropertyValue ) {
503502 oldGamePhase := p .gameState .gamePhase
504503 p .gameState .gamePhase = common .GamePhase (val .IntVal )
505504
@@ -517,7 +516,7 @@ func (p *Parser) bindGameRules() {
517516 })
518517
519518 entity .BindProperty (grPrefix ("m_totalRoundsPlayed" ), & p .gameState .totalRoundsPlayed , st .ValTypeInt )
520- entity .FindProperty (grPrefix ("m_bWarmupPeriod" )).OnUpdate (func (val st.PropertyValue ) {
519+ entity .FindPropertyI (grPrefix ("m_bWarmupPeriod" )).OnUpdate (func (val st.PropertyValue ) {
521520 oldIsWarmupPeriod := p .gameState .isWarmupPeriod
522521 p .gameState .isWarmupPeriod = val .IntVal == 1
523522
@@ -527,7 +526,7 @@ func (p *Parser) bindGameRules() {
527526 })
528527 })
529528
530- entity .FindProperty (grPrefix ("m_bHasMatchStarted" )).OnUpdate (func (val st.PropertyValue ) {
529+ entity .FindPropertyI (grPrefix ("m_bHasMatchStarted" )).OnUpdate (func (val st.PropertyValue ) {
531530 oldMatchStarted := p .gameState .isMatchStarted
532531 p .gameState .isMatchStarted = val .IntVal == 1
533532
0 commit comments