Skip to content

Commit 44a1654

Browse files
committed
events: add utility function Kill.IsWallBang()
1 parent 94b3361 commit 44a1654

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

pkg/demoinfocs/events/events.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ type Kill struct {
142142
IsHeadshot bool
143143
}
144144

145+
// IsWallBang returns true if PenetratedObjects is larger than 0.
146+
func (k Kill) IsWallBang() bool {
147+
return k.PenetratedObjects > 0
148+
}
149+
145150
// BotTakenOver signals that a player took over a bot.
146151
type BotTakenOver struct {
147152
Taker *common.Player

pkg/demoinfocs/events/events_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ func TestRankUpdate_SteamID64(t *testing.T) {
4949
assert.Equal(t, uint64(76561198012952267), event.SteamID64())
5050
}
5151

52+
func TestKill_IsWallBang(t *testing.T) {
53+
event := Kill{PenetratedObjects: 1}
54+
55+
assert.True(t, event.IsWallBang())
56+
}
57+
5258
type demoInfoProviderMock struct {
5359
}
5460

0 commit comments

Comments
 (0)