Skip to content

Commit c3c593e

Browse files
committed
docs: Spotters is not "Line of Sight" / FOV - use TraceRay
fixes #262
1 parent 8efc9e0 commit c3c593e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pkg/demoinfocs/common/player.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ func (p *Player) Weapons() []*Equipment {
142142
}
143143

144144
// IsSpottedBy returns true if the player has been spotted by the other player.
145+
// This is NOT "Line of Sight" / FOV - look up "CSGO TraceRay" for that.
146+
// May not behave as expected with multiple spotters.
145147
func (p *Player) IsSpottedBy(other *Player) bool {
146148
if p.Entity == nil {
147149
return false
@@ -162,6 +164,8 @@ func (p *Player) IsSpottedBy(other *Player) bool {
162164
}
163165

164166
// HasSpotted returns true if the player has spotted the other player.
167+
// This is NOT "Line of Sight" / FOV - look up "CSGO TraceRay" for that.
168+
// May not behave as expected with multiple spotters.
165169
func (p *Player) HasSpotted(other *Player) bool {
166170
return other.IsSpottedBy(p)
167171
}

pkg/demoinfocs/game_state.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ func (ptcp participants) initializeSliceFromByUserID() ([]*common.Player, map[in
286286
}
287287

288288
// SpottersOf returns a list of all players who have spotted the passed player.
289+
// This is NOT "Line of Sight" / FOV - look up "CSGO TraceRay" for that.
290+
// May not behave as expected with multiple spotters.
289291
func (ptcp participants) SpottersOf(spotted *common.Player) (spotters []*common.Player) {
290292
for _, other := range ptcp.playersByUserID {
291293
if spotted.IsSpottedBy(other) {
@@ -297,6 +299,8 @@ func (ptcp participants) SpottersOf(spotted *common.Player) (spotters []*common.
297299
}
298300

299301
// SpottedBy returns a list of all players that the passed player has spotted.
302+
// This is NOT "Line of Sight" / FOV - look up "CSGO TraceRay" for that.
303+
// May not behave as expected with multiple spotters.
300304
func (ptcp participants) SpottedBy(spotter *common.Player) (spotted []*common.Player) {
301305
for _, other := range ptcp.playersByUserID {
302306
if other.Entity != nil && other.IsSpottedBy(spotter) {

0 commit comments

Comments
 (0)