Skip to content

Commit e6eea38

Browse files
authored
Fix vector and angle multiply methods (#3665)
Accidentally didn't take into account in #3658 that their __mul method doesn't support multiplication by other angles/vectors
1 parent e7b24df commit e6eea38

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

lua/entities/gmod_wire_expression2/core/angle.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ e2function angle operator-(angle rv1, angle rv2)
105105
end
106106

107107
e2function angle operator*(angle rv1, angle rv2)
108-
return rv1 * rv2
108+
local rp1, ry1, rr1 = rv1:Unpack()
109+
local rp2, ry2, rr2 = rv2:Unpack()
110+
111+
return Angle(rp1 * rp2, ry1 * ry2, rr1 * rr2)
109112
end
110113

111114
e2function angle operator*(rv1, angle rv2)

lua/entities/gmod_wire_expression2/core/vector.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ e2function vector operator*(vector lhs, rhs)
124124
end
125125

126126
e2function vector operator*(vector lhs, vector rhs)
127-
return lhs * rhs
127+
local lx, ly, lz = lhs:Unpack()
128+
local rx, ry, rz = rhs:Unpack()
129+
130+
return Vector(lx * rx, ly * ry, lz * rz)
128131
end
129132

130133
-- Yes this needs to be in pure lua. Angle/Vector operations in reverse order act as Angle / Number rather than Number / Angle properly. Amazing.

0 commit comments

Comments
 (0)