@@ -2,6 +2,7 @@ package demoinfocs
22
33import (
44 "fmt"
5+ "time"
56
67 "github.com/golang/geo/r3"
78 "github.com/markus-wa/go-unassert"
@@ -256,7 +257,7 @@ func newGameEventHandler(parser *parser, ignoreBombsiteIndexNotFound bool) gameE
256257 "player_given_c4" : nil , // Dunno, only present in locally recorded (POV) demos
257258 "player_ping" : nil , // When a player uses the "ping system" added with the operation Broken Fang, only present in locally recorded (POV) demos
258259 "player_ping_stop" : nil , // When a player's ping expired, only present in locally recorded (POV) demos
259- "player_sound" : nil , // When a player makes a sound. TODO: implement player_sound
260+ "player_sound" : delayIfNoPlayers ( geh . playerSound ) , // When a player makes a sound
260261
261262 // Player changed team. Delayed for two reasons
262263 // - team IDs of other players changing teams in the same tick might not have changed yet
@@ -419,6 +420,14 @@ func (geh gameEventHandler) playerJump(data map[string]*msg.CSVCMsg_GameEventKey
419420 })
420421}
421422
423+ func (geh gameEventHandler ) playerSound (data map [string ]* msg.CSVCMsg_GameEventKeyT ) {
424+ geh .dispatch (events.PlayerSound {
425+ Player : geh .playerByUserID32 (data ["userid" ].GetValShort ()),
426+ Radius : int (data ["radius" ].GetValLong ()),
427+ Duration : time .Duration (data ["duration" ].GetValFloat () * float32 (time .Second )),
428+ })
429+ }
430+
422431func (geh gameEventHandler ) weaponFire (data map [string ]* msg.CSVCMsg_GameEventKeyT ) {
423432 if geh .parser .isSource2 () && ! geh .parser .disableMimicSource1GameEvents {
424433 return
0 commit comments