Skip to content

Commit

Permalink
Fixes weapon sound effects not playing when spectating
Browse files Browse the repository at this point in the history
  • Loading branch information
nubpro authored Feb 4, 2017
1 parent aef68fa commit 4a2165e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions gamemode/sv_player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ function PLAYER:ChangeSpectate()
if self.ObsMode2 == 0 then
self:Spectate( OBS_MODE_ROAMING )
--because it's nicer
if self:GetObserverTarget() then
self:SetPos( self:GetObserverTarget():EyePos() or self:GetObserverTarget():OBBCenter() + self:GetObserverTarget():GetPos() )
end
end
if self.ObsMode2 == 1 then self:Spectate( OBS_MODE_CHASE ) end
if self.ObsMode2 == 2 then self:Spectate( OBS_MODE_IN_EYE ) end
Expand Down Expand Up @@ -141,7 +138,13 @@ function PLAYER:SpecModify( n )
if #pool > 0 then
if pool[self.SpecEntIdx] then
self:SpectateEntity( pool[self.SpecEntIdx] )


local target = self:GetObserverTarget()
if target then
self:SetPos( target:EyePos() or target:OBBCenter() + target:GetPos() )
self:SetEyeAngles( target:EyeAngles() )
end

if self:GetObserverMode() == OBS_MODE_IN_EYE then
self:SetupHands( pool[self.SpecEntIdx] )
else
Expand Down Expand Up @@ -239,4 +242,4 @@ timer.Create("MoveSpectatorsToCorrectTeam", 5, 0, function()
end
end
end
end)
end)

0 comments on commit 4a2165e

Please sign in to comment.