@@ -91,11 +91,11 @@ func (p *Parser) bindBomb() {
9191 bomb .LastOnGroundPosition = pos
9292 })
9393
94- bombEntity .FindProperty ("m_hOwner" ).OnUpdate (func (val st.PropertyValue ) {
94+ bombEntity .Property ("m_hOwner" ).OnUpdate (func (val st.PropertyValue ) {
9595 bomb .Carrier = p .gameState .Participants ().FindByHandle (val .IntVal )
9696 })
9797
98- bombEntity .FindProperty ("m_bStartedArming" ).OnUpdate (func (val st.PropertyValue ) {
98+ bombEntity .Property ("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 {
@@ -140,7 +140,7 @@ func (p *Parser) bindTeamStates() {
140140
141141 // Register updates
142142 var score int
143- entity .FindProperty ("m_scoreTotal" ).OnUpdate (func (val st.PropertyValue ) {
143+ entity .Property ("m_scoreTotal" ).OnUpdate (func (val st.PropertyValue ) {
144144 oldScore := score
145145 score = val .IntVal
146146
@@ -187,7 +187,7 @@ func (p *Parser) bindPlayers() {
187187 plInfo .BindProperty ("m_iAssists." + iStr , & p .additionalPlayerInfo [i2 ].Assists , st .ValTypeInt )
188188 plInfo .BindProperty ("m_iMVPs." + iStr , & p .additionalPlayerInfo [i2 ].MVPs , st .ValTypeInt )
189189 plInfo .BindProperty ("m_iTotalCashSpent." + iStr , & p .additionalPlayerInfo [i2 ].MoneySpentTotal , st .ValTypeInt )
190- if prop := plInfo .FindProperty ("m_iCashSpentThisRound." + iStr ); prop != nil {
190+ if prop := plInfo .Property ("m_iCashSpentThisRound." + iStr ); prop != nil {
191191 prop .Bind (& p .additionalPlayerInfo [i2 ].MoneySpentThisRound , st .ValTypeInt )
192192 }
193193 }
@@ -254,12 +254,12 @@ func (p *Parser) bindNewPlayer(playerEntity st.IEntity) {
254254 })
255255
256256 // General info
257- playerEntity .FindProperty ("m_iTeamNum" ).OnUpdate (func (val st.PropertyValue ) {
257+ playerEntity .Property ("m_iTeamNum" ).OnUpdate (func (val st.PropertyValue ) {
258258 pl .Team = common .Team (val .IntVal )
259259 pl .TeamState = p .gameState .Team (pl .Team )
260260 })
261261
262- playerEntity .FindProperty ("m_flFlashDuration" ).OnUpdate (func (val st.PropertyValue ) {
262+ playerEntity .Property ("m_flFlashDuration" ).OnUpdate (func (val st.PropertyValue ) {
263263 if val .FloatVal == 0 {
264264 pl .FlashTick = 0
265265 } else {
@@ -272,7 +272,7 @@ func (p *Parser) bindNewPlayer(playerEntity st.IEntity) {
272272 p .bindPlayerWeapons (playerEntity , pl )
273273
274274 // Active weapon
275- playerEntity .FindProperty ("m_hActiveWeapon" ).OnUpdate (func (val st.PropertyValue ) {
275+ playerEntity .Property ("m_hActiveWeapon" ).OnUpdate (func (val st.PropertyValue ) {
276276 pl .IsReloading = false
277277 })
278278
@@ -281,7 +281,7 @@ func (p *Parser) bindNewPlayer(playerEntity st.IEntity) {
281281 playerEntity .BindProperty ("m_iAmmo." + fmt .Sprintf ("%03d" , i2 ), & pl .AmmoLeft [i2 ], st .ValTypeInt )
282282 }
283283
284- playerEntity .FindProperty ("m_bIsDefusing" ).OnUpdate (func (val st.PropertyValue ) {
284+ playerEntity .Property ("m_bIsDefusing" ).OnUpdate (func (val st.PropertyValue ) {
285285 if p .gameState .currentDefuser == pl && pl .IsDefusing && val .IntVal == 0 {
286286 p .eventDispatcher .Dispatch (events.BombDefuseAborted {Player : pl })
287287 p .gameState .currentDefuser = nil
@@ -290,14 +290,14 @@ func (p *Parser) bindNewPlayer(playerEntity st.IEntity) {
290290 pl .IsDefusing = val .IntVal != 0
291291 })
292292
293- spottedByMaskProp := playerEntity .FindProperty ("m_bSpottedByMask.000" )
293+ spottedByMaskProp := playerEntity .Property ("m_bSpottedByMask.000" )
294294 if spottedByMaskProp != nil {
295295 spottersChanged := func (val st.PropertyValue ) {
296296 p .eventDispatcher .Dispatch (events.PlayerSpottersChanged {Spotted : pl })
297297 }
298298
299299 spottedByMaskProp .OnUpdate (spottersChanged )
300- playerEntity .FindProperty ("m_bSpottedByMask.001" ).OnUpdate (spottersChanged )
300+ playerEntity .Property ("m_bSpottedByMask.001" ).OnUpdate (spottersChanged )
301301 }
302302
303303 if isNew && pl .SteamID != 0 {
@@ -308,7 +308,7 @@ func (p *Parser) bindNewPlayer(playerEntity st.IEntity) {
308308func (p * Parser ) bindPlayerWeapons (playerEntity st.IEntity , pl * common.Player ) {
309309 // Some demos have an additional prefix for player weapons weapon
310310 var wepPrefix string
311- if playerEntity .FindProperty (playerWeaponPrefix + "000" ) != nil {
311+ if playerEntity .Property (playerWeaponPrefix + "000" ) != nil {
312312 wepPrefix = playerWeaponPrefix
313313 } else {
314314 wepPrefix = playerWeaponPrePrefix + playerWeaponPrefix
@@ -318,7 +318,7 @@ func (p *Parser) bindPlayerWeapons(playerEntity st.IEntity, pl *common.Player) {
318318 var cache [maxWeapons ]int
319319 for i := range cache {
320320 i2 := i // Copy for passing to handler
321- playerEntity .FindProperty (wepPrefix + fmt .Sprintf ("%03d" , i )).OnUpdate (func (val st.PropertyValue ) {
321+ playerEntity .Property (wepPrefix + fmt .Sprintf ("%03d" , i )).OnUpdate (func (val st.PropertyValue ) {
322322 entityID := val .IntVal & entityHandleIndexMask
323323 if entityID != entityHandleIndexMask {
324324 if cache [i2 ] != 0 {
@@ -405,16 +405,16 @@ func (p *Parser) bindGrenadeProjectiles(entity *st.Entity) {
405405 p .nadeProjectileDestroyed (proj )
406406 })
407407
408- entity .FindProperty ("m_nModelIndex" ).OnUpdate (func (val st.PropertyValue ) {
408+ entity .Property ("m_nModelIndex" ).OnUpdate (func (val st.PropertyValue ) {
409409 wep = p .grenadeModelIndices [val .IntVal ]
410410 })
411411
412412 // @micvbang: not quite sure what the difference between Thrower and Owner is.
413- entity .FindProperty ("m_hThrower" ).OnUpdate (func (val st.PropertyValue ) {
413+ entity .Property ("m_hThrower" ).OnUpdate (func (val st.PropertyValue ) {
414414 proj .Thrower = p .gameState .Participants ().FindByHandle (val .IntVal )
415415 })
416416
417- entity .FindProperty ("m_hOwnerEntity" ).OnUpdate (func (val st.PropertyValue ) {
417+ entity .Property ("m_hOwnerEntity" ).OnUpdate (func (val st.PropertyValue ) {
418418 proj .Owner = p .gameState .Participants ().FindByHandle (val .IntVal )
419419 })
420420
@@ -424,7 +424,7 @@ func (p *Parser) bindGrenadeProjectiles(entity *st.Entity) {
424424
425425 // Some demos don't have this property as it seems
426426 // So we need to check for nil and can't send out bounce events if it's missing
427- if bounceProp := entity .FindProperty ("m_nBounces" ); bounceProp != nil {
427+ if bounceProp := entity .Property ("m_nBounces" ); bounceProp != nil {
428428 bounceProp .OnUpdate (func (val st.PropertyValue ) {
429429 if val .IntVal != 0 {
430430 p .eventDispatcher .Dispatch (events.GrenadeProjectileBounce {
@@ -485,14 +485,14 @@ func (p *Parser) bindWeapon(entity *st.Entity, wepType common.EquipmentType) {
485485 delete (p .gameState .weapons , entityID )
486486 })
487487
488- entity .FindProperty ("m_iClip1" ).OnUpdate (func (val st.PropertyValue ) {
488+ entity .Property ("m_iClip1" ).OnUpdate (func (val st.PropertyValue ) {
489489 if eq .Owner != nil {
490490 eq .Owner .IsReloading = false
491491 }
492492 })
493493
494494 // Detect alternative weapons (P2k -> USP, M4A4 -> M4A1-S etc.)
495- modelIndex := entity .FindProperty ("m_nModelIndex" ).Value ().IntVal
495+ modelIndex := entity .Property ("m_nModelIndex" ).Value ().IntVal
496496 eq .OriginalString = p .modelPreCache [modelIndex ]
497497
498498 wepFix := func (defaultName , altName string , alt common.EquipmentType ) {
@@ -557,7 +557,7 @@ func (p *Parser) bindGameRules() {
557557
558558 gameRules := p .ServerClasses ().FindByName ("CCSGameRulesProxy" )
559559 gameRules .OnEntityCreated (func (entity * st.Entity ) {
560- entity .FindProperty (grPrefix ("m_gamePhase" )).OnUpdate (func (val st.PropertyValue ) {
560+ entity .Property (grPrefix ("m_gamePhase" )).OnUpdate (func (val st.PropertyValue ) {
561561 oldGamePhase := p .gameState .gamePhase
562562 p .gameState .gamePhase = common .GamePhase (val .IntVal )
563563
@@ -575,7 +575,7 @@ func (p *Parser) bindGameRules() {
575575 })
576576
577577 entity .BindProperty (grPrefix ("m_totalRoundsPlayed" ), & p .gameState .totalRoundsPlayed , st .ValTypeInt )
578- entity .FindProperty (grPrefix ("m_bWarmupPeriod" )).OnUpdate (func (val st.PropertyValue ) {
578+ entity .Property (grPrefix ("m_bWarmupPeriod" )).OnUpdate (func (val st.PropertyValue ) {
579579 oldIsWarmupPeriod := p .gameState .isWarmupPeriod
580580 p .gameState .isWarmupPeriod = val .IntVal == 1
581581
@@ -585,7 +585,7 @@ func (p *Parser) bindGameRules() {
585585 })
586586 })
587587
588- entity .FindProperty (grPrefix ("m_bHasMatchStarted" )).OnUpdate (func (val st.PropertyValue ) {
588+ entity .Property (grPrefix ("m_bHasMatchStarted" )).OnUpdate (func (val st.PropertyValue ) {
589589 oldMatchStarted := p .gameState .isMatchStarted
590590 p .gameState .isMatchStarted = val .IntVal == 1
591591
0 commit comments