Skip to content

Commit

Permalink
fix: Fix 1st person spec with newest pac
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinFunk committed Feb 11, 2018
1 parent 6f3efe6 commit 5a3d72d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
19 changes: 4 additions & 15 deletions lua/ps2/client/cl_0_pointshop2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,31 +129,20 @@ concommand.Add( "pointshop2_toggle", function()
Pointshop2View:getInstance( ):toggleMenu( )
end )

-- Hide PAC Parts on First Person spectated player
hook.Add( "PostDrawOpaqueRenderables", "UnhookPac", function( )
-- Hide 1st person spectated player's parts
function Pointshop2.HidePacOnSpectate( )
if LocalPlayer( ):GetObserverMode() == OBS_MODE_IN_EYE then
local ply = LocalPlayer( ):GetObserverTarget( )
LocalPlayer( ).lastSpecTarget = ply
if IsValid( ply ) then
ply.partsHidden = ply.partsHidden or {}
pac.HideEntityParts( ply )
for k, v in pairs( ply.pac_parts or {} ) do
table.insert( ply.partsHidden, k )
pac.UnhookEntityRender( ply, k )
end
pac.ToggleIgnoreEntity( ply, false, "ps2_spectate_firstperson" )
end
end
end )

-- Unhide parts when player is not spectated anymore
function Pointshop2.HidePacOnSpectate( )
if IsValid( LocalPlayer( ).lastSpecTarget )
and LocalPlayer( ):GetObserverMode() != OBS_MODE_IN_EYE
then
pac.ShowEntityParts( LocalPlayer( ).lastSpecTarget )
for k, v in pairs( LocalPlayer( ).lastSpecTarget.partsHidden or {} ) do
pac.HookEntityRender( LocalPlayer( ).lastSpecTarget, v )
end
pac.ToggleIgnoreEntity( ply, true, "ps2_spectate_firstperson" )
LocalPlayer( ).lastSpecTarget = nil
end
end
Expand Down
2 changes: 1 addition & 1 deletion lua/ps2/client/tabs/management_tab/cl_hoverpanel.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local hoverPanel, lastHoveredPanel, hoverStart

hook.Add( "DrawOverlay", "KInvItemInfoPaint", function( )
hook.Add( "DrawOverlay", "KInvItemInfoPaintAdmin", function( )
if ( dragndrop.m_Dragging != nil ) then return end

local hoveredPanel = vgui.GetHoveredPanel( )
Expand Down
1 change: 0 additions & 1 deletion lua/ps2/server/sv_pointshopcontroller_userdetails.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ function Pointshop2Controller:getUserDetails( adminPly, kPlayerId )
dbPlayer.wallet = wallet
dbPlayer.inventory = inventory
dbPlayer.slots = slots
print(dbPlayer, wallet, inventory, slots)
if not wallet or not inventory then
local def = Deferred( )
def:Reject( 1, "Player is not a Pointshop2 User" )
Expand Down

0 comments on commit 5a3d72d

Please sign in to comment.