Skip to content

Commit 682e52b

Browse files
committed
chore: generate interfaces
1 parent e638c6b commit 682e52b

File tree

4 files changed

+124
-0
lines changed

4 files changed

+124
-0
lines changed

docs/game-events.md

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
## Game events
2+
3+
List of game events that may be trigerred during parsing, some events are available only in GOTV and/or POV demos.
4+
5+
You can add a listener on the parser's event `GenericGameEvent` to listen to all events, example:
6+
7+
```go
8+
parser.RegisterEventHandler(func(event events.GenericGameEvent) {
9+
fmt.Println(event.Name, event.Data)
10+
})
11+
```
12+
13+
> **Warning**
14+
> It has been noticed that some demos may not fire events when it should. A noticable one is the `round_end` event.
15+
> If you encounter this problem it's probably not a parser bug but simply a demo with missing events.
16+
> As a workaround you may subscribe to properties update.
17+
> For example to detect rounds end you could subscribe to updates of the property `m_iRoundWinStatus` of the entity `CCSGameRulesProxy`.
18+
19+
✅ = Available, ❌ = Not available, ? = Not sure, need to be tested
20+
21+
| Event name | GOTV | POV |
22+
| ------------------------------- | ---- | --- |
23+
| ammo_pickup |||
24+
| announce_phase_end |||
25+
| begin_new_match |||
26+
| bomb_beep |||
27+
| bomb_begindefuse |||
28+
| bomb_beginplant |||
29+
| bomb_defused |||
30+
| bomb_dropped |||
31+
| bomb_exploded |||
32+
| bomb_pickup |||
33+
| bomb_planted |||
34+
| bot_takeover |||
35+
| buytime_ended |||
36+
| choppers_incoming_warning | ? ||
37+
| cs_intermission |||
38+
| cs_match_end_restart |||
39+
| cs_pre_restart |||
40+
| cs_round_final_beep |||
41+
| cs_round_start_beep |||
42+
| cs_win_panel_match |||
43+
| cs_win_panel_round |||
44+
| decoy_detonate |||
45+
| decoy_started |||
46+
| endmatch_cmm_start_reveal_items |||
47+
| enter_bombzone |||
48+
| enter_buyzone |||
49+
| entity_visible |||
50+
| exit_bombzone |||
51+
| exit_buyzone |||
52+
| firstbombs_incoming_warning | ? ||
53+
| flashbang_detonate |||
54+
| hegrenade_detonate |||
55+
| hltv_chase |||
56+
| hltv_fixed || ? |
57+
| hltv_message || ? |
58+
| hltv_status |||
59+
| hostage_follows |||
60+
| hostage_hurt |||
61+
| hostage_killed |||
62+
| hostage_rescued |||
63+
| hostage_rescued_all |||
64+
| hostname_changed |||
65+
| inferno_expire |||
66+
| inferno_startburn |||
67+
| inspect_weapon |||
68+
| item_equip |||
69+
| item_pickup |||
70+
| item_pickup_slerp |||
71+
| item_remove |||
72+
| jointeam_failed |||
73+
| other_death |||
74+
| player_blind |||
75+
| player_connect |||
76+
| player_connect_full |||
77+
| player_death |||
78+
| player_disconnect |||
79+
| player_falldamage |||
80+
| player_footstep |||
81+
| player_given_c4 |||
82+
| player_hurt |||
83+
| player_jump |||
84+
| player_changename |||
85+
| player_ping |||
86+
| player_ping_stop |||
87+
| player_spawn |||
88+
| player_spawned |||
89+
| player_team |||
90+
| round_announce_final |||
91+
| round_announce_last_round_half |||
92+
| round_announce_match_point |||
93+
| round_announce_match_start |||
94+
| round_announce_warmup |||
95+
| round_end |||
96+
| round_end_upload_stats |||
97+
| round_freeze_end |||
98+
| round_mvp |||
99+
| round_poststart |||
100+
| round_prestart |||
101+
| round_officially_ended |||
102+
| round_start |||
103+
| round_time_warning |||
104+
| server_cvar |||
105+
| show_survival_respawn_status | ? ||
106+
| smokegrenade_detonate |||
107+
| smokegrenade_expired |||
108+
| survival_paradrop_spawn | ? ||
109+
| switch_team |||
110+
| tournament_reward || ? |
111+
| vote_cast |||
112+
| weapon_fire |||
113+
| weapon_fire_on_empty |||
114+
| weapon_reload |||
115+
| weapon_zoom |||
116+
| weapon_zoom_rifle |||

pkg/demoinfocs/fake/parser.go

+5
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ func NewParser() *Parser {
8484
return p
8585
}
8686

87+
// IsPOV is a mock-implementation of Parser.IsPOV().
88+
func (p *Parser) IsPOV() bool {
89+
return p.Called().Bool(0)
90+
}
91+
8792
// ServerClasses is a mock-implementation of Parser.ServerClasses().
8893
//
8994
// Unfortunately sendtables.ServerClasses currently isn't mockable.

pkg/demoinfocs/parser_interface.go

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ type Parser interface {
6464
// Might not be 100% correct since it's just based on the reported tick count of the header.
6565
// May always return 0 if the demo header is corrupt.
6666
Progress() float32
67+
// IsPOV indicates if the demo being parsed is a POV demo.
68+
IsPOV() bool
6769
/*
6870
RegisterEventHandler registers a handler for game events.
6971

pkg/demoinfocs/sendtables/property_interface.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type Property interface {
2222
Bind binds a property's value to a pointer.
2323
2424
Example:
25+
2526
var i int
2627
property.Bind(&i, ValTypeInt)
2728

0 commit comments

Comments
 (0)