Skip to content

Commit 7d64935

Browse files
game events: revert delaying of decoy_expired (#171)
we can delay the deletion of the thrownGrenades entry instead Co-authored-by: BestAwperEver <mvshirobokov@ya.ru>
1 parent f85887a commit 7d64935

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

game_events.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func newGameEventHandler(parser *Parser) gameEventHandler {
117117
"cs_round_start_beep": nil, // Round start beeps
118118
"cs_win_panel_match": geh.csWinPanelMatch, // Not sure, maybe match end event???
119119
"cs_win_panel_round": nil, // Win panel, (==end of match?)
120-
"decoy_detonate": delay(geh.decoyDetonate), // Decoy exploded/expired. Delayed so deleteThrownGrenade() isn't called before player_hurt
120+
"decoy_detonate": geh.decoyDetonate, // Decoy exploded/expired
121121
"decoy_started": delay(geh.decoyStarted), // Decoy started. Delayed because projectile entity is not yet created
122122
"endmatch_cmm_start_reveal_items": nil, // Drops
123123
"entity_visible": nil, // Dunno, only in locally recorded demo
@@ -380,7 +380,9 @@ func (geh gameEventHandler) decoyDetonate(data map[string]*msg.CSVCMsg_GameEvent
380380
GrenadeEvent: event,
381381
})
382382

383-
geh.deleteThrownGrenade(event.Thrower, common.EqDecoy)
383+
geh.parser.delayedEventHandlers = append(geh.parser.delayedEventHandlers, func() {
384+
geh.deleteThrownGrenade(event.Thrower, common.EqDecoy)
385+
})
384386
}
385387

386388
func (geh gameEventHandler) smokeGrenadeDetonate(data map[string]*msg.CSVCMsg_GameEventKeyT) {

test/default.golden

-15 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)