Skip to content

Commit b350cce

Browse files
committed
common: Player.Inventory / Weapons() docs
1 parent 4e49452 commit b350cce

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/demoinfocs/common/player.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type Player struct {
2525
LastAlivePosition r3.Vector // The location where the player was last alive. Should be equal to Position if the player is still alive.
2626
UserID int // Mostly used in game-events to address this player
2727
Name string // Steam / in-game user name
28-
Inventory map[int]*Equipment // All weapons / equipment the player is currently carrying
28+
Inventory map[int]*Equipment // All weapons / equipment the player is currently carrying. See also Weapons().
2929
AmmoLeft [32]int // Ammo left for special weapons (e.g. grenades), index corresponds Equipment.AmmoType
3030
EntityID int // Usually the same as Entity.ID() but may be different between player death and re-spawn.
3131
Entity st.IEntity // May be nil between player-death and re-spawn
@@ -132,6 +132,7 @@ func (p *Player) ActiveWeapon() *Equipment {
132132
}
133133

134134
// Weapons returns all weapons in the player's possession.
135+
// Contains all entries from Player.Inventory but as a slice instead of a map.
135136
func (p *Player) Weapons() []*Equipment {
136137
res := make([]*Equipment, 0, len(p.Inventory))
137138
for _, w := range p.Inventory {

0 commit comments

Comments
 (0)