File tree Expand file tree Collapse file tree 5 files changed +15
-6
lines changed Expand file tree Collapse file tree 5 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -419,6 +419,8 @@ func (p *Parser) nadeProjectileDestroyed(proj *common.GrenadeProjectile) {
419419 })
420420
421421 delete (p .gameState .grenadeProjectiles , proj .EntityID )
422+
423+ p .gameState .lastFlash .projectile = proj
422424}
423425
424426func (p * Parser ) bindWeapon (entity * st.Entity , wepType common.EquipmentElement ) {
Original file line number Diff line number Diff line change @@ -248,8 +248,9 @@ type GrenadeProjectileDestroy struct {
248248
249249// PlayerFlashed signals that a player was flashed.
250250type PlayerFlashed struct {
251- Player * common.Player
252- Attacker * common.Player
251+ Player * common.Player
252+ Attacker * common.Player
253+ Projectile * common.GrenadeProjectile
253254}
254255
255256// FlashDuration returns the duration of the blinding effect.
Original file line number Diff line number Diff line change @@ -320,15 +320,16 @@ func (geh gameEventHandler) playerHurt(data map[string]*msg.CSVCMsg_GameEventKey
320320
321321func (geh gameEventHandler ) playerBlind (data map [string ]* msg.CSVCMsg_GameEventKeyT ) {
322322 geh .dispatch (events.PlayerFlashed {
323- Player : geh .playerByUserID32 (data ["userid" ].GetValShort ()),
324- Attacker : geh .gameState ().lastFlasher ,
323+ Player : geh .playerByUserID32 (data ["userid" ].GetValShort ()),
324+ Attacker : geh .gameState ().lastFlash .player ,
325+ Projectile : geh .gameState ().lastFlash .projectile ,
325326 })
326327}
327328
328329func (geh gameEventHandler ) flashBangDetonate (data map [string ]* msg.CSVCMsg_GameEventKeyT ) {
329330 nadeEvent := geh .nadeEvent (data , common .EqFlash )
330331
331- geh .gameState ().lastFlasher = nadeEvent .Thrower
332+ geh .gameState ().lastFlash . player = nadeEvent .Thrower
332333 geh .dispatch (events.FlashExplode {
333334 GrenadeEvent : nadeEvent ,
334335 })
Original file line number Diff line number Diff line change @@ -24,11 +24,16 @@ type GameState struct {
2424 gamePhase common.GamePhase
2525 isWarmupPeriod bool
2626 isMatchStarted bool
27- lastFlasher * common. Player // Last player whose flash exploded, used to find the attacker for player_blind events
27+ lastFlash lastFlasher // Information about the last flash that exploded, used to find the attacker and projectile for player_blind events
2828 currentDefuser * common.Player // Player currently defusing the bomb, if any
2929 currentPlanter * common.Player // Player currently planting the bomb, if any
3030}
3131
32+ type lastFlasher struct {
33+ player * common.Player
34+ projectile * common.GrenadeProjectile
35+ }
36+
3237type ingameTickNumber int
3338
3439func (gs * GameState ) handleIngameTickNumber (n ingameTickNumber ) {
You can’t perform that action at this time.
0 commit comments