Skip to content

Commit

Permalink
add PropertyValue.R3VecOrNil()
Browse files Browse the repository at this point in the history
  • Loading branch information
markus-wa committed Sep 20, 2023
1 parent f7c304e commit 05e2f04
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/demoinfocs/sendtables/propdecoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,24 @@ func (v PropertyValue) R3Vec() r3.Vector {
return v.VectorVal
}

func (v PropertyValue) R3VecOrNil() *r3.Vector {
if v.S2 {
if v.Any == nil {
return nil
}

fs := v.Any.([]float32)

return &r3.Vector{
X: float64(fs[0]),
Y: float64(fs[1]),
Z: float64(fs[2]),
}
}

return &v.VectorVal
}

func (v PropertyValue) Int() int {
if v.S2 {
return int(v.Any.(int32))
Expand Down

0 comments on commit 05e2f04

Please sign in to comment.