File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff 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().
502503func (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.
519520func (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 {
You can’t perform that action at this time.
0 commit comments