Skip to content

Commit 05e2f04

Browse files
committed
add PropertyValue.R3VecOrNil()
1 parent f7c304e commit 05e2f04

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pkg/demoinfocs/sendtables/propdecoder.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,24 @@ func (v PropertyValue) R3Vec() r3.Vector {
114114
return v.VectorVal
115115
}
116116

117+
func (v PropertyValue) R3VecOrNil() *r3.Vector {
118+
if v.S2 {
119+
if v.Any == nil {
120+
return nil
121+
}
122+
123+
fs := v.Any.([]float32)
124+
125+
return &r3.Vector{
126+
X: float64(fs[0]),
127+
Y: float64(fs[1]),
128+
Z: float64(fs[2]),
129+
}
130+
}
131+
132+
return &v.VectorVal
133+
}
134+
117135
func (v PropertyValue) Int() int {
118136
if v.S2 {
119137
return int(v.Any.(int32))

0 commit comments

Comments
 (0)