@@ -3,6 +3,7 @@ package demoinfocs
3
3
import (
4
4
"fmt"
5
5
"math"
6
+ "time"
6
7
7
8
"github.com/golang/geo/r3"
8
9
"github.com/markus-wa/go-unassert"
@@ -257,7 +258,7 @@ func newGameEventHandler(parser *parser, ignoreBombsiteIndexNotFound bool) gameE
257
258
"player_given_c4" : nil , // Dunno, only present in locally recorded (POV) demos
258
259
"player_ping" : nil , // When a player uses the "ping system" added with the operation Broken Fang, only present in locally recorded (POV) demos
259
260
"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
261
262
262
263
// Player changed team. Delayed for two reasons
263
264
// - 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
420
421
})
421
422
}
422
423
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
+
423
432
func (geh gameEventHandler ) weaponFire (data map [string ]* msg.CSVCMsg_GameEventKeyT ) {
424
433
if geh .parser .isSource2 () && ! geh .parser .disableMimicSource1GameEvents {
425
434
return
0 commit comments