Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/demoinfocs/common/equipment.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ func initEqNameToWeapon() {
eqNameToWeapon["hkp2000"] = EqP2000
eqNameToWeapon["incgrenade"] = EqIncendiary
eqNameToWeapon["incendiarygrenade"] = EqIncendiary
eqNameToWeapon["inferno"] = EqIncendiary
eqNameToWeapon["m249"] = EqM249
eqNameToWeapon["m4a1"] = EqM4A4
eqNameToWeapon["mac10"] = EqMac10
Expand Down
18 changes: 17 additions & 1 deletion pkg/demoinfocs/game_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,11 @@ func (geh gameEventHandler) playerDeath(data map[string]*msg.CSVCMsg_GameEventKe
victimUserID := data["userid"].GetValShort()
wepType = geh.attackerWeaponType(wepType, victimUserID)

if killer == nil && data["attacker_pawn"] != nil {
// CS2 only, fallback to pawn handle if the killer was not found by its user ID
killer = geh.parser.gameState.Participants().FindByPawnHandle(uint64(data["attacker_pawn"].GetValLong()))
}

Comment on lines +473 to +477
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

geh.dispatch(events.Kill{
Victim: geh.playerByUserID32(data["userid"].GetValShort()),
Killer: killer,
Expand Down Expand Up @@ -997,7 +1002,18 @@ func (geh gameEventHandler) bombPickup(data map[string]*msg.CSVCMsg_GameEventKey

// Just so we can nicely create GrenadeEvents in one line
func (geh gameEventHandler) nadeEvent(data map[string]*msg.CSVCMsg_GameEventKeyT, nadeType common.EquipmentType) events.GrenadeEvent {
thrower := geh.playerByUserID32(data["userid"].GetValShort())
var thrower *common.Player
// Sometimes only the position and the entityid are present.
// Since GetValShort() returns 0 for nil values, the thrower would be the player with UserID 0, so we need to check for the existence of the key.
if data["userid"] != nil {
thrower = geh.playerByUserID32(data["userid"].GetValShort())
}

// CS2 only - userid may be missing, but userid_pawn present.
if thrower == nil && data["userid_pawn"] != nil {
thrower = geh.gameState().Participants().FindByPawnHandle(uint64(data["userid_pawn"].GetValLong()))
}

position := r3.Vector{
X: float64(data["x"].GetValFloat()),
Y: float64(data["y"].GetValFloat()),
Expand Down
1 change: 1 addition & 0 deletions pkg/demoinfocs/net_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func (p *parser) handleMessageSayText2(msg *msgs2.CUserMessageSayText2) {

case "#CSGO_Coach_Join_T": // Ignore these
case "#CSGO_Coach_Join_CT":
case "#CSGO_No_Longer_Coach":
case "#Cstrike_Name_Change":
case "Cstrike_Chat_T_Loc":
case "Cstrike_Chat_CT_Loc":
Expand Down
1 change: 1 addition & 0 deletions pkg/demoinfocs/user_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func (umh userMessageHandler) sayText2(um *msg.CSVCMsg_UserMessage) {

case "#CSGO_Coach_Join_T": // Ignore these
case "#CSGO_Coach_Join_CT":
case "#CSGO_No_Longer_Coach":
case "#Cstrike_Name_Change":
case "Cstrike_Chat_T_Loc":
case "Cstrike_Chat_CT_Loc":
Expand Down
Loading