Skip to content

Commit 323aba3

Browse files
vidositsmarkus-wa
authored andcommitted
delayed all bomb events until there are players in the game
Solves issue #180. Additionally, formatted the file because comments were getting too close to the code lines.
1 parent c287ce3 commit 323aba3

File tree

1 file changed

+52
-52
lines changed

1 file changed

+52
-52
lines changed

game_events.go

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -99,58 +99,58 @@ func newGameEventHandler(parser *Parser) gameEventHandler {
9999

100100
geh.gameEventNameToHandler = map[string]gameEventHandlerFunc{
101101
// sorted alphabetically
102-
"announce_phase_end": nil, // Dunno
103-
"begin_new_match": geh.beginNewMatch, // Match started
104-
"bomb_beep": nil, // Bomb beep
105-
"bomb_begindefuse": geh.bombBeginDefuse, // Defuse started
106-
"bomb_beginplant": geh.bombBeginPlant, // Plant started
107-
"bomb_defused": geh.bombDefused, // Defuse finished
108-
"bomb_dropped": geh.bombDropped, // Bomb dropped
109-
"bomb_exploded": geh.bombExploded, // Bomb exploded
110-
"bomb_pickup": geh.bombPickup, // Bomb picked up
111-
"bomb_planted": geh.bombPlanted, // Plant finished
112-
"bot_takeover": delay(geh.botTakeover), // Bot got taken over
113-
"buytime_ended": nil, // Not actually end of buy time, seems to only be sent once per game at the start
114-
"cs_match_end_restart": nil, // Yawn
115-
"cs_pre_restart": nil, // Not sure, doesn't seem to be important
116-
"cs_round_final_beep": nil, // Final beep
117-
"cs_round_start_beep": nil, // Round start beeps
118-
"cs_win_panel_match": geh.csWinPanelMatch, // Not sure, maybe match end event???
119-
"cs_win_panel_round": nil, // Win panel, (==end of match?)
120-
"decoy_detonate": geh.decoyDetonate, // Decoy exploded/expired
121-
"decoy_started": delay(geh.decoyStarted), // Decoy started. Delayed because projectile entity is not yet created
122-
"endmatch_cmm_start_reveal_items": nil, // Drops
123-
"entity_visible": nil, // Dunno, only in locally recorded demo
124-
"enter_bombzone": nil, // Dunno, only in locally recorded demo
125-
"exit_bombzone": nil, // Dunno, only in locally recorded demo
126-
"enter_buyzone": nil, // Dunno, only in locally recorded demo
127-
"exit_buyzone": nil, // Dunno, only in locally recorded demo
128-
"flashbang_detonate": geh.flashBangDetonate, // Flash exploded
129-
"hegrenade_detonate": geh.heGrenadeDetonate, // HE exploded
130-
"hltv_chase": nil, // Don't care
131-
"hltv_fixed": nil, // Dunno
132-
"hltv_message": nil, // No clue
133-
"hltv_status": nil, // Don't know
134-
"inferno_expire": geh.infernoExpire, // Incendiary expired
135-
"inferno_startburn": delay(geh.infernoStartBurn), // Incendiary exploded/started. Delayed because inferno entity is not yet created
136-
"inspect_weapon": nil, // Dunno, only in locally recorded demo
137-
"item_equip": delay(geh.itemEquip), // Equipped / weapon swap, I think. Delayed because of #142 - Bot entity possibly not yet created
138-
"item_pickup": delay(geh.itemPickup), // Picked up or bought? Delayed because of #119 - Equipment.UniqueID()
139-
"item_remove": geh.itemRemove, // Dropped?
140-
"jointeam_failed": nil, // Dunno, only in locally recorded demo
141-
"other_death": nil, // Dunno
142-
"player_blind": delay(geh.playerBlind), // Player got blinded by a flash. Delayed because Player.FlashDuration hasn't been updated yet
143-
"player_changename": nil, // Name change
144-
"player_connect": geh.playerConnect, // Bot connected or player reconnected, players normally come in via string tables & data tables
145-
"player_connect_full": nil, // Connecting finished
146-
"player_death": delayIfNoPlayers(geh.playerDeath), // Player died
147-
"player_disconnect": geh.playerDisconnect, // Player disconnected (kicked, quit, timed out etc.)
148-
"player_falldamage": nil, // Falldamage
149-
"player_footstep": delayIfNoPlayers(geh.playerFootstep), // Footstep sound.- Delayed because otherwise Player might be nil
150-
"player_hurt": geh.playerHurt, // Player got hurt
151-
"player_jump": geh.playerJump, // Player jumped
152-
"player_spawn": nil, // Player spawn
153-
"player_given_c4": nil, // Dunno, only present in POV demos
102+
"announce_phase_end": nil, // Dunno
103+
"begin_new_match": geh.beginNewMatch, // Match started
104+
"bomb_beep": nil, // Bomb beep
105+
"bomb_begindefuse": delayIfNoPlayers(geh.bombBeginDefuse), // Defuse started
106+
"bomb_beginplant": delayIfNoPlayers(geh.bombBeginPlant), // Plant started
107+
"bomb_defused": delayIfNoPlayers(geh.bombDefused), // Defuse finished
108+
"bomb_dropped": delayIfNoPlayers(geh.bombDropped), // Bomb dropped
109+
"bomb_exploded": delayIfNoPlayers(geh.bombExploded), // Bomb exploded
110+
"bomb_pickup": delayIfNoPlayers(geh.bombPickup), // Bomb picked up
111+
"bomb_planted": delayIfNoPlayers(geh.bombPlanted), // Plant finished
112+
"bot_takeover": delay(geh.botTakeover), // Bot got taken over
113+
"buytime_ended": nil, // Not actually end of buy time, seems to only be sent once per game at the start
114+
"cs_match_end_restart": nil, // Yawn
115+
"cs_pre_restart": nil, // Not sure, doesn't seem to be important
116+
"cs_round_final_beep": nil, // Final beep
117+
"cs_round_start_beep": nil, // Round start beeps
118+
"cs_win_panel_match": geh.csWinPanelMatch, // Not sure, maybe match end event???
119+
"cs_win_panel_round": nil, // Win panel, (==end of match?)
120+
"decoy_detonate": geh.decoyDetonate, // Decoy exploded/expired
121+
"decoy_started": delay(geh.decoyStarted), // Decoy started. Delayed because projectile entity is not yet created
122+
"endmatch_cmm_start_reveal_items": nil, // Drops
123+
"entity_visible": nil, // Dunno, only in locally recorded demo
124+
"enter_bombzone": nil, // Dunno, only in locally recorded demo
125+
"exit_bombzone": nil, // Dunno, only in locally recorded demo
126+
"enter_buyzone": nil, // Dunno, only in locally recorded demo
127+
"exit_buyzone": nil, // Dunno, only in locally recorded demo
128+
"flashbang_detonate": geh.flashBangDetonate, // Flash exploded
129+
"hegrenade_detonate": geh.heGrenadeDetonate, // HE exploded
130+
"hltv_chase": nil, // Don't care
131+
"hltv_fixed": nil, // Dunno
132+
"hltv_message": nil, // No clue
133+
"hltv_status": nil, // Don't know
134+
"inferno_expire": geh.infernoExpire, // Incendiary expired
135+
"inferno_startburn": delay(geh.infernoStartBurn), // Incendiary exploded/started. Delayed because inferno entity is not yet created
136+
"inspect_weapon": nil, // Dunno, only in locally recorded demo
137+
"item_equip": delay(geh.itemEquip), // Equipped / weapon swap, I think. Delayed because of #142 - Bot entity possibly not yet created
138+
"item_pickup": delay(geh.itemPickup), // Picked up or bought? Delayed because of #119 - Equipment.UniqueID()
139+
"item_remove": geh.itemRemove, // Dropped?
140+
"jointeam_failed": nil, // Dunno, only in locally recorded demo
141+
"other_death": nil, // Dunno
142+
"player_blind": delay(geh.playerBlind), // Player got blinded by a flash. Delayed because Player.FlashDuration hasn't been updated yet
143+
"player_changename": nil, // Name change
144+
"player_connect": geh.playerConnect, // Bot connected or player reconnected, players normally come in via string tables & data tables
145+
"player_connect_full": nil, // Connecting finished
146+
"player_death": delayIfNoPlayers(geh.playerDeath), // Player died
147+
"player_disconnect": geh.playerDisconnect, // Player disconnected (kicked, quit, timed out etc.)
148+
"player_falldamage": nil, // Falldamage
149+
"player_footstep": delayIfNoPlayers(geh.playerFootstep), // Footstep sound.- Delayed because otherwise Player might be nil
150+
"player_hurt": geh.playerHurt, // Player got hurt
151+
"player_jump": geh.playerJump, // Player jumped
152+
"player_spawn": nil, // Player spawn
153+
"player_given_c4": nil, // Dunno, only present in POV demos
154154

155155
// Player changed team. Delayed for two reasons
156156
// - team IDs of other players changing teams in the same tick might not have changed yet

0 commit comments

Comments
 (0)