Closed xGuysOG closed 5 days ago
Does HasMatchEnded change to false and the RoundEnd event fire on the same tick? If so, this is expected.
On any given tick, entity properties (including game rules) change before events are fired.
As the library is just exposing the data in the demo file itself, I'm not too keen to add workarounds to the core.
Does HasMatchEnded change to false and the RoundEnd event fire on the same tick? If so, this is expected.
On any given tick, entity properties (including game rules) change before events are fired.
As the library is just exposing the data in the demo file itself, I'm not too keen to add workarounds to the core.
There sadly is no "HasMatchEnded" in the gamerules, i did some tick tests and you are correct it happens on the same tick. How annoying, since i use "HasMatchStarted" to know if i should track stats or not track stats.
I guess id have to make a check on round start, and see if the next round might be the last round, and track the stats that way. Unless there is a better way then to track"HasMatchStarted"?
This is not a problem of the library, this is simply the way how server updates GameRules
entity properties.
There sadly is no "HasMatchEnded" in the gamerules
Yes, there is an equivalent : GameRules.GamePhase
== CSGamePhase.MatchEnded
.
However, you don't need that. The proper way to detect if match has started would be something like this :
bool hasMatchEverStarted = false;
demo.EntityEvents.CCSGameRulesProxy.AddChangeCallback(proxy => proxy.GameRules?.HasMatchStarted, (proxy, _, _) =>
{
hasMatchEverStarted |= demo.GameRules.HasMatchStarted;
});
Research
Description
GameRule "HasMatchStarted" turns to false before match has really ended. As you can see in my debugs the last round end is called after, so is win match.
and while i can create my own method to check this, i feel like it should be fixed in the main Lib.
Debugs from the code: `Starting the Socket Client... ROund end called but we have an issue, it seems match was not started yet ROund end called but we have an issue, it seems match was not started yet ct:0 and t: 0 Round start called at round ct:0 and t:0 Round End called at round ct:0 and t:1 Round end called at round ct:0 and t:1 winner? Terrorist Reason TerroristsWin message #SFUI_Notice_Terrorists_Win Round start called at round ct:0 and t:1 Round End called at round ct:1 and t:1 Round end called at round ct:1 and t:1 winner? CounterTerrorist Reason CTsWin message #SFUI_Notice_CTs_Win Round start called at round ct:1 and t:1 Round End called at round ct:2 and t:1 Round end called at round ct:2 and t:1 winner? CounterTerrorist Reason CTsWin message #SFUI_Notice_CTs_Win Round start called at round ct:2 and t:1 Round End called at round ct:3 and t:1 Round end called at round ct:3 and t:1 winner? CounterTerrorist Reason CTsWin message #SFUI_Notice_CTs_Win Round start called at round ct:3 and t:1 Round End called at round ct:3 and t:2 Round end called at round ct:3 and t:2 winner? Terrorist Reason TerroristsWin message #SFUI_Notice_Terrorists_Win Round start called at round ct:3 and t:2 Round End called at round ct:3 and t:3 Bomb exploded Round end called at round ct:3 and t:3 winner? Terrorist Reason TargetBombed message #SFUI_Notice_Target_Bombed Round start called at round ct:3 and t:3 Round End called at round ct:3 and t:4 Bomb exploded Round end called at round ct:3 and t:4 winner? Terrorist Reason TargetBombed message #SFUI_Notice_Target_Bombed Round start called at round ct:3 and t:4 Round End called at round ct:4 and t:4 Round end called at round ct:4 and t:4 winner? CounterTerrorist Reason CTsWin message #SFUI_Notice_CTs_Win Round start called at round ct:4 and t:4 Round End called at round ct:5 and t:4 Round end called at round ct:5 and t:4 winner? CounterTerrorist Reason BombDefused message #SFUI_Notice_Bomb_Defused Round start called at round ct:5 and t:4 Round End called at round ct:6 and t:4 Round end called at round ct:6 and t:4 winner? CounterTerrorist Reason CTsWin message #SFUI_Notice_CTs_Win Round start called at round ct:6 and t:4 Round End called at round ct:7 and t:4 Round end called at round ct:7 and t:4 winner? CounterTerrorist Reason CTsWin message #SFUI_Notice_CTs_Win Round start called at round ct:7 and t:4 Round End called at round ct:7 and t:5 Round end called at round ct:7 and t:5 winner? Terrorist Reason TerroristsWin message #SFUI_Notice_Terrorists_Win Round start called at round ct:5 and t:7 Round End called at round ct:5 and t:8 Round end called at round ct:5 and t:8 winner? Terrorist Reason TerroristsWin message #SFUI_Notice_Terrorists_Win Round start called at round ct:5 and t:8 Round End called at round ct:6 and t:8 Round end called at round ct:6 and t:8 winner? CounterTerrorist Reason CTsWin message #SFUI_Notice_CTs_Win Round start called at round ct:6 and t:8 Round End called at round ct:7 and t:8 Round end called at round ct:7 and t:8 winner? CounterTerrorist Reason CTsWin message #SFUI_Notice_CTs_Win Round start called at round ct:7 and t:8 Round End called at round ct:8 and t:8 Round end called at round ct:8 and t:8 winner? CounterTerrorist Reason BombDefused message #SFUI_Notice_Bomb_Defused Round start called at round ct:8 and t:8 Round End called at round ct:9 and t:8 Round end called at round ct:9 and t:8 winner? CounterTerrorist Reason CTsWin message #SFUI_Notice_CTs_Win Round start called at round ct:9 and t:8 Round End called at round ct:10 and t:8 Round end called at round ct:10 and t:8 winner? CounterTerrorist Reason CTsWin message #SFUI_Notice_CTs_Win Round start called at round ct:10 and t:8 Round End called at round ct:10 and t:9 Round end called at round ct:10 and t:9 winner? Terrorist Reason TerroristsWin message #SFUI_Notice_Terrorists_Win Round start called at round ct:10 and t:9 Round End called at round ct:11 and t:9 Round end called at round ct:11 and t:9 winner? CounterTerrorist Reason CTsWin message #SFUI_Notice_CTs_Win Round start called at round ct:11 and t:9 Round End called at round ct:12 and t:9 Round end called at round ct:12 and t:9 winner? CounterTerrorist Reason BombDefused message #SFUI_Notice_Bomb_Defused Round start called at round ct:12 and t:9 ROund end called but we have an issue, it seems match was not started yet ROund end called but we have an issue, it seems match was not started yet ct:13 and t: 9 WIn match has ended Time elapsed after file data: 00:00:03.5268049 Time elapsed: 00:00:03.5955110
Finished! `
Code to reproduce
Affected demos
https://drive.google.com/file/d/1kmBKcxTRMJMc9kcLWSC9-8Q2ZBP4EQvd/view?usp=sharing