Skip to content

Commit f7c304e

Browse files
committed
cs2: panic for non-implemented funcs
1 parent de94445 commit f7c304e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pkg/demoinfocs/common/player.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func (p *Player) PlayerPawnEntity() st.Entity {
4040
if !exists {
4141
return nil
4242
}
43+
4344
return p.demoInfoProvider.FindEntityByHandle(playerPawn.Handle())
4445
}
4546

@@ -500,26 +501,25 @@ func (p *Player) Position() r3.Vector {
500501
// This is what you get from cl_showpos 1.
501502
// See also Position().
502503
func (p *Player) PositionEyes() r3.Vector {
504+
if p.demoInfoProvider.IsSource2() {
505+
panic("PositionEyes() is not supported for Source 2 demos")
506+
}
507+
503508
if p.Entity == nil {
504509
return r3.Vector{}
505510
}
506511

507512
pos := p.Position()
508-
if p.demoInfoProvider.IsSource2() {
509-
// TODO Find out where we can find the offset in Source 2 demos
510-
return pos
511-
} else {
512-
pos.Z += float64(p.Entity.PropertyValueMust("localdata.m_vecViewOffset[2]").Float())
513-
}
513+
514+
pos.Z += float64(p.Entity.PropertyValueMust("localdata.m_vecViewOffset[2]").Float())
514515

515516
return pos
516517
}
517518

518519
// Velocity returns the player's velocity.
519520
func (p *Player) Velocity() r3.Vector {
520521
if p.demoInfoProvider.IsSource2() {
521-
// TODO Find out where we can find the velocity in Source 2 demos
522-
return r3.Vector{}
522+
panic("Velocity() is not supported for Source 2 demos")
523523
}
524524

525525
if p.Entity == nil {

0 commit comments

Comments
 (0)