Skip to content

Commit

Permalink
fix: Participants().Playing() may returned disconnected players
Browse files Browse the repository at this point in the history
  • Loading branch information
akiver committed Dec 30, 2023
1 parent 0ac0c4b commit a96cc7b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/demoinfocs/datatables.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,12 @@ func (p *parser) getOrCreatePlayerFromControllerEntity(controllerEntity st.Entit
func (p *parser) bindNewPlayerControllerS2(controllerEntity st.Entity) {
pl := p.getOrCreatePlayerFromControllerEntity(controllerEntity)

controllerEntity.Property("m_hPawn").OnUpdate(func(val st.PropertyValue) {
if val.Handle() == constants.InvalidEntityHandleSource2 {
pl.IsConnected = false
}
})

controllerEntity.Property("m_iTeamNum").OnUpdate(func(val st.PropertyValue) {
pl.Team = common.Team(val.S2UInt64())
pl.TeamState = p.gameState.Team(pl.Team)
Expand Down

0 comments on commit a96cc7b

Please sign in to comment.