Skip to content

Commit

Permalink
Tiny bit more turret optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
thecraftianman committed May 10, 2024
1 parent 0a56b74 commit c066f3d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lua/entities/acf_turret/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -789,27 +789,28 @@ do -- Metamethods
end

function ENT:InputDirection(Direction)
if self.Disabled then return end
local SelfTbl = self:GetTable()
if SelfTbl.Disabled then return end

self.Manual = true
self.UseVector = false
SelfTbl.Manual = true
SelfTbl.UseVector = false

if isnumber(Direction) then
self.DesiredDeg = math.NormalizeAngle(Direction)
SelfTbl.DesiredDeg = math.NormalizeAngle(Direction)
return
end

self.Manual = false
SelfTbl.Manual = false

if isangle(Direction) then
Direction:Normalize()
self.DesiredAngle = Direction
SelfTbl.DesiredAngle = Direction

return
end
if isvector(Direction) then
self.UseVector = true
self.DesiredVector = Direction
SelfTbl.UseVector = true
SelfTbl.DesiredVector = Direction

return
end
Expand Down

0 comments on commit c066f3d

Please sign in to comment.