Skip to content

Commit a96cc7b

Browse files
committed
fix: Participants().Playing() may returned disconnected players
1 parent 0ac0c4b commit a96cc7b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/demoinfocs/datatables.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,12 @@ func (p *parser) getOrCreatePlayerFromControllerEntity(controllerEntity st.Entit
514514
func (p *parser) bindNewPlayerControllerS2(controllerEntity st.Entity) {
515515
pl := p.getOrCreatePlayerFromControllerEntity(controllerEntity)
516516

517+
controllerEntity.Property("m_hPawn").OnUpdate(func(val st.PropertyValue) {
518+
if val.Handle() == constants.InvalidEntityHandleSource2 {
519+
pl.IsConnected = false
520+
}
521+
})
522+
517523
controllerEntity.Property("m_iTeamNum").OnUpdate(func(val st.PropertyValue) {
518524
pl.Team = common.Team(val.S2UInt64())
519525
pl.TeamState = p.gameState.Team(pl.Team)

0 commit comments

Comments
 (0)