@@ -91,11 +91,11 @@ func (p *Parser) bindBomb() {
9191 bomb .LastOnGroundPosition = pos
9292 })
9393
94- bombEntity .FindPropertyI ("m_hOwner" ).OnUpdate (func (val st.PropertyValue ) {
94+ bombEntity .FindProperty ("m_hOwner" ).OnUpdate (func (val st.PropertyValue ) {
9595 bomb .Carrier = p .gameState .Participants ().FindByHandle (val .IntVal )
9696 })
9797
98- bombEntity .FindPropertyI ("m_bStartedArming" ).OnUpdate (func (val st.PropertyValue ) {
98+ bombEntity .FindProperty ("m_bStartedArming" ).OnUpdate (func (val st.PropertyValue ) {
9999 if val .IntVal != 0 {
100100 p .gameState .currentPlanter = bomb .Carrier
101101 } else if p .gameState .currentPlanter != nil {
@@ -117,7 +117,7 @@ func (p *Parser) bindBomb() {
117117
118118func (p * Parser ) bindTeamStates () {
119119 p .stParser .ServerClasses ().FindByName ("CCSTeam" ).OnEntityCreated (func (entity * st.Entity ) {
120- team := entity .FindPropertyI ("m_szTeamname" ).Value ().StringVal
120+ team := entity .FindProperty ("m_szTeamname" ).Value ().StringVal
121121
122122 var s * common.TeamState
123123
@@ -141,7 +141,7 @@ func (p *Parser) bindTeamStates() {
141141 entity .BindProperty ("m_szClanTeamname" , & s .ClanName , st .ValTypeString )
142142 entity .BindProperty ("m_szTeamFlagImage" , & s .Flag , st .ValTypeString )
143143
144- entity .FindPropertyI ("m_scoreTotal" ).OnUpdate (func (val st.PropertyValue ) {
144+ entity .FindProperty ("m_scoreTotal" ).OnUpdate (func (val st.PropertyValue ) {
145145 oldScore := s .Score
146146 s .Score = val .IntVal
147147
@@ -256,7 +256,7 @@ func (p *Parser) bindNewPlayer(playerEntity st.IEntity) {
256256 })
257257
258258 // General info
259- playerEntity .FindPropertyI ("m_iTeamNum" ).OnUpdate (func (val st.PropertyValue ) {
259+ playerEntity .FindProperty ("m_iTeamNum" ).OnUpdate (func (val st.PropertyValue ) {
260260 pl .Team = common .Team (val .IntVal ) // Need to cast to team so we can't use BindProperty
261261 pl .TeamState = p .gameState .Team (pl .Team )
262262 })
@@ -269,7 +269,7 @@ func (p *Parser) bindNewPlayer(playerEntity st.IEntity) {
269269
270270 playerEntity .BindProperty ("m_angEyeAngles[1]" , & pl .ViewDirectionX , st .ValTypeFloat32 )
271271 playerEntity .BindProperty ("m_angEyeAngles[0]" , & pl .ViewDirectionY , st .ValTypeFloat32 )
272- playerEntity .FindPropertyI ("m_flFlashDuration" ).OnUpdate (func (val st.PropertyValue ) {
272+ playerEntity .FindProperty ("m_flFlashDuration" ).OnUpdate (func (val st.PropertyValue ) {
273273 if val .FloatVal == 0 {
274274 pl .FlashTick = 0
275275 } else {
@@ -291,7 +291,7 @@ func (p *Parser) bindNewPlayer(playerEntity st.IEntity) {
291291 p .bindPlayerWeapons (playerEntity , pl )
292292
293293 // Active weapon
294- playerEntity .FindPropertyI ("m_hActiveWeapon" ).OnUpdate (func (val st.PropertyValue ) {
294+ playerEntity .FindProperty ("m_hActiveWeapon" ).OnUpdate (func (val st.PropertyValue ) {
295295 pl .IsReloading = false
296296 pl .ActiveWeaponID = val .IntVal & entityHandleIndexMask
297297 })
@@ -301,21 +301,21 @@ func (p *Parser) bindNewPlayer(playerEntity st.IEntity) {
301301 playerEntity .BindProperty ("m_iAmmo." + fmt .Sprintf ("%03d" , i2 ), & pl .AmmoLeft [i2 ], st .ValTypeInt )
302302 }
303303
304- playerEntity .FindPropertyI ("m_bIsDefusing" ).OnUpdate (func (val st.PropertyValue ) {
304+ playerEntity .FindProperty ("m_bIsDefusing" ).OnUpdate (func (val st.PropertyValue ) {
305305 if p .gameState .currentDefuser == pl && pl .IsDefusing && val .IntVal == 0 {
306306 p .eventDispatcher .Dispatch (events.BombDefuseAborted {Player : pl })
307307 p .gameState .currentDefuser = nil
308308 }
309309 pl .IsDefusing = val .IntVal != 0
310310 })
311311
312- spottedByMaskProp := playerEntity .FindPropertyI ("m_bSpottedByMask.000" )
312+ spottedByMaskProp := playerEntity .FindProperty ("m_bSpottedByMask.000" )
313313 if spottedByMaskProp != nil {
314314 spottersChanged := func (val st.PropertyValue ) {
315315 p .eventDispatcher .Dispatch (events.PlayerSpottersChanged {Spotted : pl })
316316 }
317317 spottedByMaskProp .OnUpdate (spottersChanged )
318- playerEntity .FindPropertyI ("m_bSpottedByMask.001" ).OnUpdate (spottersChanged )
318+ playerEntity .FindProperty ("m_bSpottedByMask.001" ).OnUpdate (spottersChanged )
319319 }
320320
321321 if isNew && pl .SteamID != 0 {
@@ -326,7 +326,7 @@ func (p *Parser) bindNewPlayer(playerEntity st.IEntity) {
326326func (p * Parser ) bindPlayerWeapons (playerEntity st.IEntity , pl * common.Player ) {
327327 // Some demos have an additional prefix for player weapons weapon
328328 var wepPrefix string
329- if playerEntity .FindPropertyI (playerWeaponPrefix + "000" ) != nil {
329+ if playerEntity .FindProperty (playerWeaponPrefix + "000" ) != nil {
330330 wepPrefix = playerWeaponPrefix
331331 } else {
332332 wepPrefix = playerWeaponPrePrefix + playerWeaponPrefix
@@ -336,7 +336,7 @@ func (p *Parser) bindPlayerWeapons(playerEntity st.IEntity, pl *common.Player) {
336336 var cache [maxWeapons ]int
337337 for i := range cache {
338338 i2 := i // Copy for passing to handler
339- playerEntity .FindPropertyI (wepPrefix + fmt .Sprintf ("%03d" , i )).OnUpdate (func (val st.PropertyValue ) {
339+ playerEntity .FindProperty (wepPrefix + fmt .Sprintf ("%03d" , i )).OnUpdate (func (val st.PropertyValue ) {
340340 entityID := val .IntVal & entityHandleIndexMask
341341 if entityID != entityHandleIndexMask {
342342 if cache [i2 ] != 0 {
@@ -423,17 +423,16 @@ func (p *Parser) bindGrenadeProjectiles(entity *st.Entity) {
423423 p .nadeProjectileDestroyed (proj )
424424 })
425425
426- entity .FindPropertyI ("m_nModelIndex" ).OnUpdate (func (val st.PropertyValue ) {
427- proj .Weapon = p .grenadeModelIndices [val .IntVal ]
426+ entity .FindProperty ("m_nModelIndex" ).OnUpdate (func (val st.PropertyValue ) {
428427 wep = p .grenadeModelIndices [val .IntVal ]
429428 })
430429
431430 // @micvbang: not quite sure what the difference between Thrower and Owner is.
432- entity .FindPropertyI ("m_hThrower" ).OnUpdate (func (val st.PropertyValue ) {
431+ entity .FindProperty ("m_hThrower" ).OnUpdate (func (val st.PropertyValue ) {
433432 proj .Thrower = p .gameState .Participants ().FindByHandle (val .IntVal )
434433 })
435434
436- entity .FindPropertyI ("m_hOwnerEntity" ).OnUpdate (func (val st.PropertyValue ) {
435+ entity .FindProperty ("m_hOwnerEntity" ).OnUpdate (func (val st.PropertyValue ) {
437436 proj .Owner = p .gameState .Participants ().FindByHandle (val .IntVal )
438437 })
439438
@@ -445,7 +444,7 @@ func (p *Parser) bindGrenadeProjectiles(entity *st.Entity) {
445444
446445 // Some demos don't have this property as it seems
447446 // So we need to check for nil and can't send out bounce events if it's missing
448- if bounceProp := entity .FindPropertyI ("m_nBounces" ); bounceProp != nil {
447+ if bounceProp := entity .FindProperty ("m_nBounces" ); bounceProp != nil {
449448 bounceProp .OnUpdate (func (val st.PropertyValue ) {
450449 if val .IntVal != 0 {
451450 p .eventDispatcher .Dispatch (events.GrenadeProjectileBounce {
@@ -506,23 +505,23 @@ func (p *Parser) bindWeapon(entity *st.Entity, wepType common.EquipmentType) {
506505 delete (p .gameState .weapons , entityID )
507506 })
508507
509- entity .FindPropertyI ("m_iClip1" ).OnUpdate (func (val st.PropertyValue ) {
508+ entity .FindProperty ("m_iClip1" ).OnUpdate (func (val st.PropertyValue ) {
510509 if eq .Owner != nil {
511510 eq .Owner .IsReloading = false
512511 }
513512 })
514513
515514 // Only weapons with scopes have m_zoomLevel property
516- if zoomLvlProp := entity .FindPropertyI ("m_zoomLevel" ); zoomLvlProp != nil {
515+ if zoomLvlProp := entity .FindProperty ("m_zoomLevel" ); zoomLvlProp != nil {
517516 zoomLvlProp .OnUpdate (func (value st.PropertyValue ) {
518517 eq .ZoomLevel = common .ZoomLevel (value .IntVal )
519518 })
520519 }
521520
522- eq .AmmoType = entity .FindPropertyI ("LocalWeaponData.m_iPrimaryAmmoType" ).Value ().IntVal
521+ eq .AmmoType = entity .FindProperty ("LocalWeaponData.m_iPrimaryAmmoType" ).Value ().IntVal
523522
524523 // Detect alternative weapons (P2k -> USP, M4A4 -> M4A1-S etc.)
525- modelIndex := entity .FindPropertyI ("m_nModelIndex" ).Value ().IntVal
524+ modelIndex := entity .FindProperty ("m_nModelIndex" ).Value ().IntVal
526525 eq .OriginalString = p .modelPreCache [modelIndex ]
527526
528527 wepFix := func (defaultName , altName string , alt common.EquipmentType ) {
@@ -565,13 +564,13 @@ func (p *Parser) bindNewInferno(entity *st.Entity) {
565564 origin := entity .Position ()
566565 nFires := 0
567566
568- entity .FindPropertyI ("m_fireCount" ).OnUpdate (func (val st.PropertyValue ) {
567+ entity .FindProperty ("m_fireCount" ).OnUpdate (func (val st.PropertyValue ) {
569568 for i := nFires ; i < val .IntVal ; i ++ {
570569 iStr := fmt .Sprintf ("%03d" , i )
571570 offset := r3.Vector {
572- X : float64 (entity .FindPropertyI ("m_fireXDelta." + iStr ).Value ().IntVal ),
573- Y : float64 (entity .FindPropertyI ("m_fireYDelta." + iStr ).Value ().IntVal ),
574- Z : float64 (entity .FindPropertyI ("m_fireZDelta." + iStr ).Value ().IntVal ),
571+ X : float64 (entity .FindProperty ("m_fireXDelta." + iStr ).Value ().IntVal ),
572+ Y : float64 (entity .FindProperty ("m_fireYDelta." + iStr ).Value ().IntVal ),
573+ Z : float64 (entity .FindProperty ("m_fireZDelta." + iStr ).Value ().IntVal ),
575574 }
576575
577576 fire := & common.Fire {Vector : origin .Add (offset ), IsBurning : true }
@@ -607,7 +606,7 @@ func (p *Parser) bindGameRules() {
607606
608607 gameRules := p .ServerClasses ().FindByName ("CCSGameRulesProxy" )
609608 gameRules .OnEntityCreated (func (entity * st.Entity ) {
610- entity .FindPropertyI (grPrefix ("m_gamePhase" )).OnUpdate (func (val st.PropertyValue ) {
609+ entity .FindProperty (grPrefix ("m_gamePhase" )).OnUpdate (func (val st.PropertyValue ) {
611610 oldGamePhase := p .gameState .gamePhase
612611 p .gameState .gamePhase = common .GamePhase (val .IntVal )
613612
@@ -625,7 +624,7 @@ func (p *Parser) bindGameRules() {
625624 })
626625
627626 entity .BindProperty (grPrefix ("m_totalRoundsPlayed" ), & p .gameState .totalRoundsPlayed , st .ValTypeInt )
628- entity .FindPropertyI (grPrefix ("m_bWarmupPeriod" )).OnUpdate (func (val st.PropertyValue ) {
627+ entity .FindProperty (grPrefix ("m_bWarmupPeriod" )).OnUpdate (func (val st.PropertyValue ) {
629628 oldIsWarmupPeriod := p .gameState .isWarmupPeriod
630629 p .gameState .isWarmupPeriod = val .IntVal == 1
631630
@@ -635,7 +634,7 @@ func (p *Parser) bindGameRules() {
635634 })
636635 })
637636
638- entity .FindPropertyI (grPrefix ("m_bHasMatchStarted" )).OnUpdate (func (val st.PropertyValue ) {
637+ entity .FindProperty (grPrefix ("m_bHasMatchStarted" )).OnUpdate (func (val st.PropertyValue ) {
639638 oldMatchStarted := p .gameState .isMatchStarted
640639 p .gameState .isMatchStarted = val .IntVal == 1
641640
0 commit comments