Monday, December 8, 2008

Weapons Menu

Today I got about 1 and a half to 2 solid hours of work done on the spawnmenu, specifically the weapons portion of it.

I was searching Garry's blog when I came across this interesting post, specifically:




A few people had requested the ability to draw models onto panels too, so I give
you.. DModelPanel!

local Window = vgui.Create( "DFrame" )
local mdlPanel =
vgui.Create( "DModelPanel", Window )
mdlPanel:SetSize( 300, 300
)
mdlPanel:SetPos( 10, 20 )
mdlPanel:SetModel( "models/player/breen.mdl"
)
mdlPanel:SetAnimSpeed( 0.5 )
mdlPanel:SetAnimated( false
)
mdlPanel:SetAmbientLight( Color( 50, 50, 50 )
)
mdlPanel:SetDirectionalLight( BOX_TOP, Color( 255, 255, 255 )
)
mdlPanel:SetDirectionalLight( BOX_FRONT, Color( 255, 255, 255 )
)
mdlPanel:SetCamPos( Vector( 50, 50, 50 ) )
mdlPanel:SetLookAt( Vector(
0, 0, 40 ) )
mdlPanel:SetFOV( 70 )
Window:SetSize( 320, 330
)
Window:Center()
Window:MakePopup()
Window:SetKeyboardInputEnabled(
false )




I never knew about DModelPanels before this post, so I decided to mess around and give it a shot. Heres some screenshots of the weapons section of the spawnmenu now:





As you can see, weapons without formal pictures will now display their world model, schnazzy eh? Yeah, the camera isn't really centered and zoomed properly so it looks weird, but maybe i'll work on that a little tomorrow, its bed time for now.

(On the second picture you can also see another addition that I made a while back. By default all additional server sweps (excluding the GRP ones) will be spawnable only via admins. However, you can customize this in the config files, giving admins total and easy management of sweps and their spawning.)

No comments: