Fix turret behavior if parented (#2184)

This commit is contained in:
thegrb93 2021-06-23 02:39:23 -04:00 committed by GitHub
parent f8335f9711
commit f888eb12e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,9 +43,16 @@ function ENT:FireShot()
self:EmitSound( self.sound )
end
local phys = self:GetPhysicsObject()
local shootOrigin = phys:LocalToWorld(self.attachmentPos)
local shootAngles = phys:GetAngles()
local shootOrigin, shootAngles
local parent = self:GetParent()
if parent:IsValid() then
shootOrigin = self:LocalToWorld(self.attachmentPos)
shootAngles = self:GetAngles()
else
local phys = self:GetPhysicsObject()
shootOrigin = phys:LocalToWorld(self.attachmentPos)
shootAngles = phys:GetAngles()
end
-- Shoot a bullet
local bullet = {}