Skip to content

Commit

Permalink
Parity with wiremod#2399 (#112)
Browse files Browse the repository at this point in the history
**DO NOT MERGE THIS UNTIL wiremod/wire#2399 IS MERGED.**

This PR converts functions that return a table with three numbers to proper Vector/Angle userdata, since that is what vector and angle types will now use in E2 for efficiency.

I'm sweeping through found instances of this on github and making these PRs to make sure the amount of extensions broken by this is minimal.
  • Loading branch information
Vurv78 authored Sep 9, 2022
1 parent 4a0733e commit d321013
Show file tree
Hide file tree
Showing 5 changed files with 683 additions and 860 deletions.
11 changes: 5 additions & 6 deletions lua/entities/gmod_wire_expression2/core/custom/camera.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ __e2setcost( 10 )
e2function void cameraPos( index, vector position )
local camera = GetCamera( self, index )
if not camera then return end
camera:SetPos( Vector(position[1],position[2],position[3]) )
camera:SetPos(position)
end

__e2setcost( 2 )
e2function vector cameraPos( index )
local camera = GetCamera( self, index )
if not camera then return {0,0,0} end
if not camera then return Vector(0,0,0) end
return camera:GetPos()
end

Expand All @@ -155,15 +155,14 @@ __e2setcost( 10 )
e2function void cameraAng( index, angle ang )
local camera = GetCamera( self, index )
if not camera then return end
camera:SetAngles( Angle(ang[1],ang[2],ang[3]) )
camera:SetAngles(ang)
end

__e2setcost( 2 )
e2function angle cameraAng( index )
local camera = GetCamera( self, index )
if not camera then return {0,0,0} end
local ang = camera:GetAngles()
return {ang.p, ang.y, ang.r}
if not camera then return Angle(0, 0, 0) end
return camera:GetAngles()
end

-----------------
Expand Down
Loading

0 comments on commit d321013

Please sign in to comment.