Closed cooltg66 closed 8 months ago
Describe the bug Event PlayerDisconnected is not triggered anymore for bot leaving the game (on v4.0.2, it was working on v4.0.1)
To Reproduce Download link to an affected demo: https://pub-de8f82f716174101a8e11da069a07907.r2.dev/demo_with_bots.dem (https://www.faceit.com/en/cs2/room/1-d3fea1aa-a28c-4c70-8732-9d1f493f4b53)
Code:
package main import ( "fmt" "log" "os" dem "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs" events "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events" ) func main() { f, err := os.Open("C:\\demo_to_parse\\demo_with_bots.dem") if err != nil { log.Panic("failed to open demo file: ", err) } defer f.Close() p := dem.NewParser(f) defer p.Close() p.RegisterEventHandler(func(e events.PlayerDisconnected) { if e.Player.SteamID64 == 0 { fmt.Printf("PlayerDisconnected %d %d %s %d %d\n", p.GameState().IngameTick(), e.Player.SteamID64, e.Player.Name, e.Player.UserID, e.Player.EntityID) } }) p.RegisterEventHandler(func(e events.BotConnect) { if e.Player.SteamID64 == 0 { fmt.Printf("BotConnect %d %d %s %d %d\n", p.GameState().IngameTick(), e.Player.SteamID64, e.Player.Name, e.Player.UserID, e.Player.EntityID) } }) // Parse to end err = p.ParseToEnd() if err != nil { log.Panic("failed to parse demo: ", err) } }
Expected behavior On v4.0.1 sample code prints:
BotConnect 3853 0 Crew 13 14 PlayerDisconnected 5655 0 Crew 13 14 BotConnect 20855 0 Osiris 0 15 BotConnect 38408 0 Shark 15 16 PlayerDisconnected 49689 0 Shark 15 16
On v4.0.2 & v4.0.3 sample code prints:
BotConnect 0 0 SourceTV 2 3 BotConnect 3853 0 Crew 13 14 BotConnect 20855 0 Osiris 0 15 BotConnect 37961 0 Shark 15 16
Library version v4.0.2 & v4.0.3
Additional context If this is a correct behavior, could you please add a BotDisconnected event? Many thanks
Fixed in v4.0.4 - go get github.com/markus-wa/demoinfocs-golang/v4@v4.0.4 to receive
v4.0.4
go get github.com/markus-wa/demoinfocs-golang/v4@v4.0.4
Describe the bug Event PlayerDisconnected is not triggered anymore for bot leaving the game (on v4.0.2, it was working on v4.0.1)
To Reproduce Download link to an affected demo: https://pub-de8f82f716174101a8e11da069a07907.r2.dev/demo_with_bots.dem (https://www.faceit.com/en/cs2/room/1-d3fea1aa-a28c-4c70-8732-9d1f493f4b53)
Code:
Expected behavior On v4.0.1 sample code prints:
On v4.0.2 & v4.0.3 sample code prints:
Library version v4.0.2 & v4.0.3
Additional context If this is a correct behavior, could you please add a BotDisconnected event? Many thanks