File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff 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.
135136func (p * Player ) Weapons () []* Equipment {
136137 res := make ([]* Equipment , 0 , len (p .Inventory ))
137138 for _ , w := range p .Inventory {
You can’t perform that action at this time.
0 commit comments