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