Skip to content

Commit 44bcacf

Browse files
authored
Merge branch 'master' into fix-nade-counts
2 parents 39822b1 + bb47007 commit 44bcacf

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

pkg/demoinfocs/common/player.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ func (p *Player) Health() int {
363363
// Armor returns the player's armor points, normally 0-100.
364364
func (p *Player) Armor() int {
365365
if p.demoInfoProvider.IsSource2() {
366-
return getInt(p.Entity, "m_iPawnArmor")
366+
return getInt(p.PlayerPawnEntity(), "m_ArmorValue")
367367
}
368368

369369
return getInt(p.Entity, "m_ArmorValue")

pkg/demoinfocs/events/events.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,25 @@ func (ru RankUpdate) SteamID64() uint64 {
510510
return common.ConvertSteamID32To64(uint32(ru.SteamID32))
511511
}
512512

513+
// OtherDeath signals that there has occurred a death of something that is not a player.
514+
// For example chickens.
515+
type OtherDeath struct {
516+
Killer *common.Player // May be nil
517+
Weapon *common.Equipment
518+
PenetratedObjects int
519+
NoScope bool
520+
KillerBlind bool
521+
ThroughSmoke bool
522+
523+
OtherType string
524+
OtherID int32
525+
OtherPosition r3.Vector
526+
}
527+
528+
func (od OtherDeath) IsWallBang() bool {
529+
return od.PenetratedObjects > 0
530+
}
531+
513532
// ItemEquip signals an item was equipped.
514533
// This event is not available in all demos.
515534
type ItemEquip struct {

pkg/demoinfocs/game_events.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func newGameEventHandler(parser *parser, ignoreBombsiteIndexNotFound bool) gameE
210210
"item_pickup_slerp": nil, // Not sure, only in locally recorded (POV) demos
211211
"item_remove": geh.itemRemove, // Dropped?
212212
"jointeam_failed": nil, // Dunno, only in locally recorded (POV) demos
213-
"other_death": nil, // Dunno
213+
"other_death": geh.otherDeath, // Other deaths, like chickens.
214214
"player_blind": delay(geh.playerBlind), // Player got blinded by a flash. Delayed because Player.FlashDuration hasn't been updated yet
215215
"player_changename": nil, // Name change
216216
"player_connect": geh.playerConnect, // Bot connected or player reconnected, players normally come in via string tables & data tables
@@ -839,6 +839,28 @@ func (geh gameEventHandler) itemRemove(data map[string]*msg.CSVCMsg_GameEventKey
839839
})
840840
}
841841

842+
func (geh gameEventHandler) otherDeath(data map[string]*msg.CSVCMsg_GameEventKeyT) {
843+
killer := geh.playerByUserID32(data["attacker"].GetValShort())
844+
otherType := data["othertype"].GetValString()
845+
otherID := data["otherid"].GetValShort()
846+
otherPosition := geh.gameState().entities[int(otherID)].Position()
847+
wepType := common.MapEquipment(data["weapon"].GetValString())
848+
weapon := getPlayerWeapon(killer, wepType)
849+
850+
geh.dispatch(events.OtherDeath{
851+
Killer: killer,
852+
Weapon: weapon,
853+
PenetratedObjects: int(data["penetrated"].GetValShort()),
854+
NoScope: data["noscope"].GetValBool(),
855+
ThroughSmoke: data["thrusmoke"].GetValBool(),
856+
KillerBlind: data["attackerblind"].GetValBool(),
857+
858+
OtherType: otherType,
859+
OtherID: otherID,
860+
OtherPosition: otherPosition,
861+
})
862+
}
863+
842864
func (geh gameEventHandler) itemEvent(data map[string]*msg.CSVCMsg_GameEventKeyT) (*common.Player, *common.Equipment) {
843865
player := geh.playerByUserID32(data["userid"].GetValShort())
844866

pkg/demoinfocs/sendtables2/field_decoder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ func runeTimeDecoder(r *reader) interface{} {
327327
}
328328

329329
func simulationTimeDecoder(r *reader) interface{} {
330-
return float32(r.readVarUint32()) * (1.0 / 30)
330+
return float32(r.readVarUint32()) * (1.0 / 64)
331331
}
332332

333333
func readBitCoordPres(r *reader) float32 {

0 commit comments

Comments
 (0)